fpco / terraform-aws-foundation

Establish a solid Foundation on AWS with these modules for Terraform
MIT License
204 stars 98 forks source link

Fix iam-users output. #277

Closed qrilka closed 4 years ago

qrilka commented 4 years ago

When a user gets deleted from user list Terraform will fail creating a plan complaining that number of keys doesn't match number of values. Th solution is taken from https://github.com/terraform-google-modules/terraform-google-cloud-storage/pull/23/files

Example error seen:

  19:   value       = zipmap(var.user_list, aws_iam_user.u.*)
    |----------------
    | aws_iam_user.u is tuple with 8 elements
    | var.user_list is list of string with 7 elements

Call to function "zipmap" failed: number of keys (7) does not match number of
values (8).
ketzacoatl commented 4 years ago

Confirmed in slack.

qrilka commented 4 years ago

It looks like using count is a problem here and it makes sense to switch to using for_each instead with a set of user names