Skip to content

Atmos attempts to template within TF modules resulting in errorΒ #2145

@BroganRenoworks

Description

@BroganRenoworks

Describe the Bug

I noticed that when using Atmos on some Terraform modules (vendored or self-written), they would immediately error out:

Error: template: templates-all-atmos-sections:156: function "project" not defined

After some digging, it turns out this happens when the module contains anything that looks like a Go template. i.e. some manifest or variable/output description containing double curly braces. Some Terraform vendors (GCP especially) just do this for specifying the format of values.

output "service_id" {
  value       = google_cloud_run_v2_service.main.id
  description = "Unique Identifier for the created service with format projects/{{project}}/locations/{{location}}/services/{{name}}"
}

Expected Behavior

Atmos Go templating should happen in the abstraction above Terraform modules. Configure Atmos to ignore double curly brace sequences that may occur in Terraform modules.

Steps to Reproduce

  • In the Atmos repo, go to examples/quick-start-simple
  • Modify components/terraform/weather/*.tf, such as adding a description containing double curly braces.
output "url" {
  value = local.url
  description = "URL in the format https://{{domain}}/{{foobar}}"
}
  • Run atmos terraform plan station -s dev
  • Receive vague error occurs about undefined templating function
Error: template: templates-all-atmos-sections:156: function "domain" not defined

Screenshots

No response

Environment

Discovered on:

  • Atmos 1.204.0
  • darwin/arm64

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugπŸ› An issue with the system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions