Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Terraform escaping blocks #1644

Open
wata727 opened this issue Jan 10, 2023 · 0 comments
Open

Add support for Terraform escaping blocks #1644

wata727 opened this issue Jan 10, 2023 · 0 comments

Comments

@wata727
Copy link
Member

wata727 commented Jan 10, 2023

Introduction

Since v0.15.4, Terraform introduced the concept of "escaping blocks".
hashicorp/terraform#28709

Attributes defined inside escaping blocks are merged and treated like normal attributes, except meta-arguments. For example:

resource "aws_instance" "main" {
  _ {
    instance_type = "t2.micro" // It works!
  }
}

This is a mechanism for future language extensions and is discouraged in most cases, so I believe users do not use it yet. However, if used, TFLint does not support this syntax and cannot detect errors correctly.

Proposal

Make sure Module.PartialContent respects the escaping blocks and returns the fetched content merged.
https://github.com/terraform-linters/tflint/blob/v0.44.1/terraform/module.go#L89

Escaping blocks are only valid at the top level of a particular block, so nested blocks aren't a concern, but we'll probably need logic to identify the block type. This has some performance implications, so we may need to consider how we implement it.

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant