1
0
Fork 0
terraform-training/05_loops/base.tf

31 lines
464 B
Terraform
Raw Normal View History

2020-05-13 12:16:35 +02:00
provider "aws" {
region = "eu-west-2"
}
variable "user_list" {
type = list
default = [
"cedric-user1",
"cedric-user2",
"cedric-user3"
]
}
2020-05-13 12:35:51 +02:00
variable "user_list2" {
type = list
default = [
"cedric-user4",
"cedric-user5"
]
}
2020-05-13 12:16:35 +02:00
resource "aws_iam_user" "user1" {
name = element(var.user_list,count.index)
count = length(var.user_list)
}
2020-05-13 12:35:51 +02:00
resource "aws_iam_user" "user2" {
for_each = toset(var.user_list2)
name = each.value
}