-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix wrong update of externalId for pivotRole #591
Conversation
We have 2 approaches, I have tried them both. 1. use boto3 calls to the infra accounts from the CICD pipelineIt is the current code in the PR. It assumes the CDK look-up-role in the infra accounts.
2. use CDK look-up resources from the infra account while the stack is deployedWe tried several CDK constructs for this.
In conclusion, because of how unstable the solution with CDK constructs is (I am specially worried about the user experience for fresh deployments) I am more inclined to use boto3. What do you think? @noah-paige |
I agree with opting for boto3 at this point since the CDK Construct methods seem to not work as we would like The main issue I see with Option 1 is in my testing the default cdk look up role does not have the required permissions to get the secret either |
I checked the permission on the role and it has |
Yeah but it has |
What if we use boto3 for SSM and CDK Constructs to get secret... I am testing this approach and I think it works as expected Will still have to add permissions to assume role in |
Feature or Bugfix
Detail
Fixes #589 by:
Manual operations needed ONLY if upgrading. Fresh deployments are unaffected
In the first run the CodePipeline will fail in the
CDK Synth
stage if no additional changes are done:CodeBuild needs additional permissions to assume the IAM role in the CDK Synth stage. Since we cannot update this CodeBuild stage without running it, the permissions need to be added manually.
Upgrading from V1.6.0 to v1.6.1
The role that we need to update is a role named
<PREFIX>-<GITBRANCH>-codebuild-baseline-role
. It will say it in the error message in the CodeBuild logs<PREFIX>-<GITBRANCH>-codebuild-baseline-role
) and click onAdd permissions
>Create inline policy
The policy of the Codebuild execution role need to include the following:
After the pipeline has successfully run, go back to the IAM role and remove the manually added policy. The policy is now added as part of infrastructure as code.
Upgrading from <V1.6.0 to v1.6.1
The error points at a different role some. A role created by CDK that looks like the following in the CodeBuild logs:
We find the role and update it as we explained in the "Upgrading from V1.6.0 to v1.6.1" section.
Once that is done, retry the CodeBuild Synth stage. In this case you do NOT need to cleanup the manually added policies as this role will be deleted.
Tests
[X] Tested by merging this branch into a deployment initially in V1.6.0 -> SSM parameter value unmodified
[X] Tested by merging this branch into a deployment initially in V1.5.6 -> Secret value copied to SSM parameter unmodified
[X] Tested by deploying this branch on a fresh account
Relates
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.