terraform:map
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
terraform:map [18/02/2025 14:22] – andrew | terraform:map [18/02/2025 15:30] (current) – [Map object] andrew | ||
---|---|---|---|
Line 69: | Line 69: | ||
+ | < | ||
+ | variable " | ||
+ | type = map(object({ | ||
+ | var1 = string | ||
+ | var2 = string | ||
+ | var3 = bool | ||
+ | })) | ||
+ | default = { | ||
+ | " | ||
+ | var1 = " | ||
+ | var2 = " | ||
+ | var3 = true | ||
+ | } | ||
+ | " | ||
+ | var1 = " | ||
+ | var2 = " | ||
+ | var3 = true | ||
+ | } | ||
+ | |||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | output " | ||
+ | value = var.map_object[" | ||
+ | } | ||
+ | |||
+ | output " | ||
+ | value = var.map_object[" | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | <code bash> | ||
+ | $ terraform apply | ||
+ | |||
+ | Changes to Outputs: | ||
+ | + Choice_var1 = " | ||
+ | + choice_obj | ||
+ | + var1 = " | ||
+ | + var2 = " | ||
+ | + var3 = true | ||
+ | } | ||
+ | |||
+ | You can apply this plan to save these new output values to the Terraform state, without changing any real infrastructure. | ||
+ | |||
+ | Do you want to perform these actions? | ||
+ | Terraform will perform the actions described above. | ||
+ | Only ' | ||
+ | |||
+ | Enter a value: yes | ||
+ | |||
+ | |||
+ | Apply complete! Resources: 0 added, 0 changed, 0 destroyed. | ||
+ | |||
+ | Outputs: | ||
+ | |||
+ | Choice_var1 = " | ||
+ | choice_obj = { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | $ | ||
+ | </ | ||
terraform/map.1739888567.txt.gz · Last modified: by andrew