Terraform: for each
(Redirected from For each)
Jump to navigation
Jump to search
for_each
ref
Examples[edit]
Official examples[edit]
resource "azurerm_resource_group" "rg" { for_each = { a_group = "eastus" another_group = "westus2" } name = each.key location = each.value }
resource "aws_ssm_parameter" "secret" { for_each = toset(var.secrets) name = each.key description = each.key type = "SecureString" value = "1" lifecycle { ignore_changes = [value] } }
resource "opsgenie_user" "main" { for_each = local.myusers username = "${each.key}@yourdomain.com" full_name = each.value.name role = each.value.role timezone = each.value.timezone }
Errors[edit]
Related[edit]
See also[edit]
for_each, each.
, Terraform: dynamic_blocksfor, for_each (Terraform), until ... do, while ... do
- Terraform functions, Terraform collection functions:
tolist
,toset
,length
,sum
,file
,join
,depends_on
,zipmap
,replace
,lookup
,read files
,concat
,merge, templatefile, for_each, format, element, slice, try, filebase64, upper, filemd5, coalesce, formatlist, flatten
Advertising: