iterating over a list
This commit is contained in:
parent
f3b0d73d14
commit
c53be9dae6
1 changed files with 18 additions and 0 deletions
18
project5/base.tf
Normal file
18
project5/base.tf
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
provider "aws" {
|
||||||
|
region = "eu-west-2"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "user_list" {
|
||||||
|
type = list
|
||||||
|
default = [
|
||||||
|
"cedric-user1",
|
||||||
|
"cedric-user2",
|
||||||
|
"cedric-user3"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_iam_user" "user1" {
|
||||||
|
name = element(var.user_list,count.index)
|
||||||
|
count = length(var.user_list)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue