Update role attachment count#89
Merged
obs-gh-brett-blakeney merged 2 commits intoFeb 24, 2026
Merged
Conversation
changed count on role policy attachment to match the policy resource's count condition
obs-gh-justindaines
left a comment
Contributor
There was a problem hiding this comment.
Thank you for contributing.
This is a great addition to be more consistent and it matches the pattern already used by aws_iam_policy.kms_decrypt on line 177
Can we update to remove the extra count = ?
count = count = var.kms_key != null ? 1 : 0to
count = var.kms_key != null ? 1 : 0Other than that this looks great.
Contributor
Author
|
@obs-gh-justindaines updated to remove the typo, thanks for catching. after this gets merged, would it be possible to cut a new version of this module as well as the module ref in terraform-aws-collection ? The tf import bug, while small, is causing a bit of a headache for my team. |
d77d78c
into
observeinc:main
13 of 15 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do?
Fixes the
countargument onaws_iam_role_policy_attachment.kms_decrypt(line 205 inmain.tf) to use the same static condition as the policy resource it references, instead oflength()on the resource itself.This matches the condition already used by
aws_iam_policy.kms_decrypton line 177.Motivation
length(aws_iam_policy.kms_decrypt)references a resource attribute that Terraform cannot resolve until apply. This causesterraform importandterraform statecommands to fail with:This blocks all terraform state operations in any workspace that includes this module.
Testing
observeinc/lambda/awsv3.6.0 whenkms_key = nullterraform plan/apply,terraform import, andterraform state rmall succeedaws_iam_policy.kms_decryptcount