Skip to content

terraform.state mishandles some ipv6 stringsΒ #2155

@BroganRenoworks

Description

@BroganRenoworks

Describe the Bug

When a Terraform module outputs an IPv6 string ending in a double colon ::, !terraform.state mishandles the string, converting it into an object where part of the ipv6 is the key, and null is the value.

E.g. 2041:0000:140F::875B:: becomes "2041:0000:140F::875B:": null

Expected Behavior

!terraform.state should preserve the string type on an output that ends in double colons.

Steps to Reproduce

Set up a dummy terraform_data component, and instantiate it twice like so (I used examples/quick-start-start-simple):

# components/terraform/dummy/main.tf
variable "ipv6" {
  type        = string
  description = "The IPv6 address"
}

resource "terraform_data" "this" {
  input = var.ipv6
}

output "ipv6" {
  value       = terraform_data.this.output
  description = "An IPv6 output"
}
# stacks/deploy/dev.yaml
components:
  terraform:
    dummy1:
      metadata:
        component: dummy
      vars:
        ipv6: "2041:0000:140F::875B::"
    dummy2:
      metadata:
        component: dummy
      vars:
        ipv6: !terraform.state dummy1 ipv6

atmos terraform apply -s dev dummy1 applies successfully.
atmos terraform apply -s dev dummy2 returns error.

β”‚ Error: Invalid value for input variable
β”‚ 
β”‚   on dev-dummy2.terraform.tfvars.json line 2:
β”‚    2:   "ipv6": {
β”‚    3:     "2041:0000:140F::875B:": null
β”‚    4:   },
β”‚ 
β”‚ The given value is not suitable for var.ipv6 declared at main.tf:1,1-16: string required, but have object.
β•΅

Screenshots

No response

Environment

  • OS darwin/arm64
  • Atmos 1.204.0

Additional Context

No response

Metadata

Metadata

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