for_each
This commit is contained in:
parent
c53be9dae6
commit
fcac3117d1
1 changed files with 12 additions and 0 deletions
|
@ -11,8 +11,20 @@ variable "user_list" {
|
|||
]
|
||||
}
|
||||
|
||||
variable "user_list2" {
|
||||
type = list
|
||||
default = [
|
||||
"cedric-user4",
|
||||
"cedric-user5"
|
||||
]
|
||||
}
|
||||
|
||||
resource "aws_iam_user" "user1" {
|
||||
name = element(var.user_list,count.index)
|
||||
count = length(var.user_list)
|
||||
}
|
||||
|
||||
resource "aws_iam_user" "user2" {
|
||||
for_each = toset(var.user_list2)
|
||||
name = each.value
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue