Difference between revisions of "Terraform function: toset"
Jump to navigation
Jump to search
(Created page with "{{lowercase}} * tolist == See also == * {{Terraform}} Category:Terraform") |
|||
(13 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | + | * https://www.terraform.io/docs/language/functions/toset.html Pass a list value to <code>toset</code> to convert it to a <code>[[set]]</code>, which will remove any [[duplicate]] elements and discard the [[ordering]] of the elements. | |
+ | resource "[[aws_ssm_parameter]]" "secret" { | ||
+ | [[for_each]] = toset(var.secrets) | ||
+ | name = each.key | ||
+ | description = each.key | ||
+ | type = "SecureString" | ||
+ | value = "1" | ||
+ | |||
+ | lifecycle { | ||
+ | ignore_changes = [value] | ||
+ | } | ||
+ | } | ||
− | * [[tolist]] | + | |
+ | == Related == | ||
+ | * <code>[[tolist]]</code> | ||
+ | * <code>[[for_each]]</code> | ||
== See also == | == See also == | ||
− | * {{Terraform}} | + | * {{Terraform Functions}} |
[[Category:Terraform]] | [[Category:Terraform]] |
Latest revision as of 17:58, 14 May 2023
- https://www.terraform.io/docs/language/functions/toset.html Pass a list value to
toset
to convert it to aset
, which will remove any duplicate elements and discard the ordering of the elements.
resource "aws_ssm_parameter" "secret" { for_each = toset(var.secrets) name = each.key description = each.key type = "SecureString" value = "1" lifecycle { ignore_changes = [value] } }
Related[edit]
See also[edit]
Advertising: