Skip to content

Support locals block inside tftest.hcl Terraform Test file. #34629

@sheeeng

Description

@sheeeng

Terraform Version

terraform version
Terraform v1.7.2
on darwin_arm64

Use Cases

We don't want to repeat the same template string inside tftest.hcl Terraform Test file.

Please support locals block inside tftest.hcl Terraform Test file.

Attempted Solutions

locals {
  variable_name = "${run.setup_tests.variable_value_one}_${run.setup_tests.variable_value_two}"
}
$ terraform init -backend=false && terraform test --verbose --verbose
Initializing modules...

│ Error: Unsupported block type

│   on tests/main.tftest.hcl line 13:
│   13: locals {

│ Blocks of type "locals" are not expected here.

Proposal

No response

References

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions