Skip to content

Add support for Terraform escaping blocks #1644

@wata727

Description

@wata727

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions