fix: Use count instead of for_each in iam-eks-role (#193) #197
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This is the same method as is used in iam-assumable-role-with-oidc. Since the argument to count is a list, not a set, the number of elements doesn't depend on the values, and terraform can decide how many elements are needed before creating the policies.
Motivation and Context
This fixes #193
This issue is a blocker for using this module in automation.
Breaking Changes
This changes the address of the
aws_iam_role_policy_attachment
resource, since it's index by a number instead of a string.This will cause the resource to be recreated when applying the module after changes.
There are no changes to the outputs of the module, and the created resources should be identical.
How Has This Been Tested?
examples/*
projectsThis was also tested in our automated tests, which create a role and a policy to attach to a service account, like so:
The change has no effects on the code that uses the module - except that it works when applying in an empty workspace.