Skip to content

Instantly share code, notes, and snippets.

@joshkitt
Created August 2, 2021 17:17
Show Gist options
  • Save joshkitt/97c87b3d93447a076dd8371706f7a69e to your computer and use it in GitHub Desktop.
Save joshkitt/97c87b3d93447a076dd8371706f7a69e to your computer and use it in GitHub Desktop.
Terraform for_each array list using format and index
locals {
users = [
"SCREENSM1",
"SCREENSM2",
"SCREENSM3",
"SCREENSM4",
"SCREENSA1",
"SCREENSA2",
"SCREENSA3",
"SCREENSA4",
"SCREENSA5",
"SCREENSA6",
]
}
resource "okta_user" "user" {
for_each = toset(local.users)
email = format("%s@mail.com", each.key)
login = each.key
first_name = each.key
last_name = each.key
custom_profile_attributes = format("{ \"id\": \"888%s\" }", index(local.users, each.key))
status = "ACTIVE"
password = var.user_password
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment