Closed
Description
Terraform Version
Terraform v0.11.7
+ provider.aws v1.17.0
Terraform Configuration Files
Attached as ZIP file. The relevant files are:
team-groups-policies.tf
helpers/group-role-with-policies/main.tf
The most relevant parts are:
# "main" tf file
module "team_ci_group" {
source = "helpers/group-role-with-policies"
create_group = 1
team = "team"
name = "ci"
policies = [
"arn:aws:iam::aws:policy/AWSBatchFullAccess",
"${aws_iam_policy.gen_get_ecr_token.arn}",
]
}
... and ...
# module
resource "aws_iam_group" "group" {
count = "${var.create_group}"
name = "${var.prefix}-${var.team}-${var.name}"
path = "/groups/${var.team}/"
}
resource "aws_iam_group_policy_attachment" "group_policy" {
count = "${length(var.policies) * var.create_group }"
group = "${aws_iam_group.group.name}"
policy_arn = "${element(var.policies, count.index)}"
}
Debug Output
In ZIP archive, a file called "TRACE"
Crash Output
No crash.
Expected Behavior
It should have created a group with two policy attachments.
Actual Behavior
Error message: * [...]: value of 'count' cannot be computed
Steps to Reproduce
- Unzip
terraform init
terraform plan
Additional Context
N/A
References
N/A
Metadata
Metadata
Assignees
Labels
No labels