Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform 0.12+ index can be string or number #132

Closed
wants to merge 1 commit into from

Commits on Oct 30, 2019

  1. Terraform 0.12+ index can be string or number

    In the case of when mixing resources into the statefile in terraform, it's now
    possible to have indexes that are not always int. In the example below using the
    new 0.12 syntax `foreach` will result in the index being mapped to the
    `each.key` name instead of the integer indexes.
    
    ```
    variable "test" {
      default = {"testa" = "1.1.1.1", "testb" = "2.2.2.2"}
    }
    
    resource "aws_route53_record" "this" {
      for_each = var.test
      zone_id = "abc"
      name    = "${each.key}.tv."
      type    = "A"
      ttl     = "300"
      records = [each.value]
    }
    ```
    Bao Nguyen committed Oct 30, 2019
    Configuration menu
    Copy the full SHA
    c7ffab8 View commit details
    Browse the repository at this point in the history