-
Notifications
You must be signed in to change notification settings - Fork 4k
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
(cli): Review permissions structure for new changeset-based diffs #29767
Comments
Hey @blimmer, thanks for opening this issue with us. A fair number of users have use cases mirroring yours in which they scope certain environments to make diff calls with lookup permissions, and others to make deploy calls with the deploy permissions. The new diff behavior does not fit nicely in that setup. We have three ways to solve this:
We didn't do (2) initially because we needed to make However, we are no longer creating changesets for new stacks, so we do not make To use your table, your setup could look something like this:
Where the |
I like Option 2, as well. Allowing |
Got it, will keep you updated where we go with this. |
We have run into this with the same usecase where we have a PR role used by GitHub Actions running https://github.com/karlderkaefer/cdk-notifier |
WIP |
Hi @blimmer @scanlonp I think we will need to assume the file-publishing-role to upload the template to S3. Is this acceptable?
|
@sakurai-ryo - could we have the new |
Is not the bucket used to upload the cfn templates the same used to upload different CDK assets, such zip file for bundled lambdas ( |
Thanks @blimmer I forgot that the |
Hi @scanlonp |
We're also very interested in this; looks like the PR from @sakurai-ryo is getting closed for staleness though. @scanlonp is there something missing that blocks getting the work merged? Glad to contribute if there is something more to be done. |
I missed the message from the aws-cdk-automation bot. |
@sakurai-ryo, I'll re-open the PR and make sure it stays open. Thanks for opening this PR! I did see it, though I have not had a chance to give a thorough review. @kylebjordahl, not anything missing or blocking it. This is a larger change, so we will want to take some time for the team to review and discuss it, but it is certainly on our radar! |
Describe the feature
I love the goal of the new
cdk diff
behavior that creates a CloudFormation changeset to more accurately show information about what will happen if youcdk deploy
.However, I've encountered many problems with existing IAM Roles and Permission Sets I've created for working with CDK.
In the past, I've always been able to create two roles: one for
diff
-ing and one fordeploy
-ing. These roles only needed to provideiam:AssumeRole
for the following roles created by the CDK bootstrap process:lookup-role
cfn-exec-role
lookup-role
deploy-role
file-publishing-role
image-publishing-role
Since CDK has started generating CloudFormation diffs, I've been receiving and error that, during
cdk diff
, the role needs to assume the CDKdeploy-role
:Before
After
So, I'm opening this issue suggesting that the CDK Bootstrap roles be revisited with the new CFN Changeset behaviors.
Use Case
I'm using GitHub Actions OpenID Connect roles to run
cdk diff
on PRs andcdk deploy
on merge to mymain
branch. Then, I use Trust Relationships to only allow assuming thedeploy
role from Action Workflows run from themain
branch:The
diff
role can be assumed by any branch, since it's assumed to be read-only. However, with the recent CloudFormation changeset diffs, these roles no longer work as expected. To generate the changelogs, they appear to need elevated permissions, including access to thedeploy-role
, which has the ability tocloudformation:DeleteStack
and other destructive behaviors.These OpenID Connect roles are just one example. You could also imagine Permission Sets for Developers that allow them to run
cdk diff
from their local computers, but they should not be allowed to runcdk deploy
.Proposed Solution
No matter the solution, I think the goal should be that CDK users can define IAM roles/policies that slot users into two buckets: people who can do non-destructive things (like
cdk diff
) and those who can do everything (e.g.,cdk deploy
).Could we update the lookup-role to allow the
cloudformation
actions needed to create the changeset for diffing purposes? I think that would just include addingcloudformation:CreateChangeSet
andcloudformation:DeleteChangeSet
? Then, thecdk diff
should not try to assume thedeploy-role
anymore.Other Information
I originally thought this issue was only with the App Staging synthesizer (see #28816), but it feels like there's some overlap here. We might want to close #28816 in favor of this issue?
Acknowledgements
CDK version used
2.136.0 (build 94fd33b)
Environment details (OS name and version, etc.)
MacOS Sonoma
The text was updated successfully, but these errors were encountered: