Created
June 3, 2020 14:53
-
-
Save gulducat/fb8e9c9035e9ab5b03f58518a277f1d7 to your computer and use it in GitHub Desktop.
example usage of Terraform csvdecode()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# very slightly altered from | |
# https://www.terraform.io/docs/configuration/functions/csvdecode.html#use-with-the-for_each-meta-argument | |
locals { | |
csv_data = <<-CSV | |
local_id,instance_type,ami | |
foo1,t2.micro,ami-54d2a63b | |
foo2,t2.micro,ami-54d2a63b | |
CSV | |
instances = csvdecode(local.csv_data) | |
} | |
resource "null_resource" "nully" { | |
for_each = { for i in local.instances : i.local_id => i } | |
triggers = { | |
my_id = each.value.local_id | |
} | |
} | |
output "nully" { | |
value = null_resource.nully | |
} |
Author
gulducat
commented
Jun 3, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment