Open blakepettersson opened 2 years ago
To add some more context from my experiences with this issue --
The issue is specifically the sequence of ecr:CreateRepository
followed by ecr:SetRepositoryPolicy
(or ecr:PutLifecyclePolicy
) within the same apply
run. Subsequent runs of apply
work; they pick up with a repository that was created in the first run, and the policy(s) are applied without issue.
This does not appear to be a timing issue as I cannot repro the issue using the AWS CLI, but something about the difference between a repository create and a read repository from state.
Capturing debug traces, the outputs between a failure and a success are nearly identical; i.e. the request payloads look the same, just one 403s while one 200s.
Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.
If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!
Community Note
Terraform CLI and Terraform AWS Provider Version
Terraform v1.2.8 on linux_amd64
Affected Resource(s)
aws_ecr_repository_policy
aws_iam_role_policy
Terraform Configuration Files
Debug Output
https://gist.github.com/blakepettersson/58e77cf4e3018cb34e544d9f65f7e67a
Expected Behavior
This should work consistently on the first
terraform apply
.Actual Behavior
This usually takes another
terraform apply
for this to work.Steps to Reproduce
terraform apply