Fix ECR deploy race condition and document developer IAM policy - #213
Conversation
|
| "Sid": "WhoAmI", | ||
| "Effect": "Allow", | ||
| "Action": "sts:GetCallerIdentity", | ||
| "Resource": "*" |
There was a problem hiding this comment.
AWS docs explicitly says no permision is required for GetCallerIdentity (even when it says Deny!) so this inclusion shouldn't be necessary.
| "Effect": "Allow", | ||
| "Action": "iam:GetPolicy", | ||
| "Resource": "arn:aws:iam::*:policy/mcp-tenantOperator-APIG" | ||
| }, |
There was a problem hiding this comment.
Is this sufficient? The data source mcp_operator_policy identifies policies by name but the AWS provider searches using the AWS API ListPolicies, which needs to enumerate them. You might need:
{
"Sid": "FindExternalPermissionBoundaryPolicy",
"Effect": "Allow",
"Action": "iam:ListPolicies",
"Resource": "*" // must be "*", but is at least read-only
},
{
"Sid": "ReadExternalPermissionBoundaryPolicy",
"Effect": "Allow",
"Action": "iam:GetPolicy",
"Resource": "arn:aws:iam::*:policy/mcp-tenantOperator-APIG"
}
nutjob4life
left a comment
There was a problem hiding this comment.
Thanks @ramesh-maddegoda this looks great.
Approved: ✅
I did leave a couple comments intersperesed but I don't think they're blockers for merging. Take a look and see what you think. Thanks again!
Thanks @nutjob4life for your review! |



🗒️ Summary
This pull request fixes a race condition that occasionally encountered when deploying to images to ECR. Also, this provides documentation of creating a suitable developer IAM policy with necessary permissions, if we do the deployment in two steps: Deploy IAM fist, deploy other resources next.
🤖 AI Assistance Disclosure
Estimated % of code influenced by AI: 95 %
⚙️ Test Data and/or Report
Tested by completely destroying the environment and recreating the it with two steps: Deploy IAM fist, deploy other resources next.
♻️ Related Issues
Improve PDS Nucleus pipeline scalability for terabyte to petabyte-scale data ingestion
#205
🤓 Reviewer Checklist
Reviewers: Please verify the following before approving this pull request.
Documentation and PR Content
Security & Quality
Testing & Validation
Maintenance
Terraform (only if this PR touches a
terraform/directory)scripts/validate_terraform.pywas run against the changedterraform/tree and any Must-Have failures were resolved (or are tracked in a reviewed.tfvalidate-ignoreentry, not silently bypassed).pdc-cds-infra, not duplicated in an application repo.modules/stays flat and no new module is just a thin wrapper around a single resource./pds/<component>/...and, if this PR is the consumer side, reads from the correct published parameter rather than another repo's Terraform state.