Skip to content

Atmos fails to load any Terraform component that uses variable interpolation #2913

Description

Describe the Bug

Atmos fails to load any Terraform component that uses variable interpolation in a
module block's source, even though this is valid configuration in Terraform 1.15+
when the referenced variable is declared const = true (and in OpenTofu 1.8+).

variable "org" {
  const   = true
  type    = string
  default = "acme"
}

module "greeting" {
  source = "./mods/${var.org}"
}

Any command that resolves the component fails during config parsing, before Terraform
is ever invoked:

failed to load terraform component
The Terraform component 'testme' contains invalid HCL code at components/terraform/testme/main.tf:27.
Variables not allowed: Variables may not be used here.

Root cause. Atmos parses components with terraform-config-inspect, which decoded
module.source using a nil hcl.EvalContext:

valDiags := gohcl.DecodeExpression(attr.Expr, nil, &source)
diags = append(diags, valDiags...)

Expected Behavior

Atmos should parse the component successfully.

Steps to Reproduce

  1. Create a component components/terraform/testme/main.tf with the snippet above, plus
    a local module at components/terraform/testme/mods/acme/main.tf.
  2. Add a stack that references the component.
  3. Run:
    atmos describe component testme -s test
    
  4. See the failed to load terraform component ... Variables not allowed error.

Screenshots

Image

Environment

  • Atmos: v1.225.0
  • OS: macOS
  • Terraform 1.15.2

Additional Context

No response

Activity

  1. added
    bug
    on Aug 10, 2026
  2. added a commit that references this issue on Aug 25, 2026
    8148b1d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions