Skip to content

hcl2.Builder() quotes provider map keys, causing deprecation warnings #237

@shanukk27

Description

@shanukk27

Summary:

When using hcl2.Builder() to generate HCL files, the providers map for module blocks includes quoted keys
e.g.,

  providers = {
    aws.route53 = "aws.route53"
    aws.rds     = "aws.rds"
  }

This triggers the following deprecation warning from Terraform (version 1.11.4):

Warning: Quoted references are deprecated

What we expect hcl2.Builder() to generate:

  providers = {
    aws.route53 = aws.route53
    aws.rds     = aws.rds
  }

Proposed Action:

Add special handling within hcl2.Builder() for providers maps:

  • Do not quote the keys (provider names).
  • Maintain quotes for values that actually need it (eg. strings).
  • Compatibility across recent versions of Terraform.

Metadata

Metadata

Labels

bugSomething isn't workingbuilderIssue is related to creating HCL2 content with Builder classdeserializationPython dict to LarkElement IR (reverse path)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions