-
Notifications
You must be signed in to change notification settings - Fork 37
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
diffProtection
does not work when stack contains tokens
#300
Comments
Oh no... thanks for the report @danieljamesscott. Let me think about what to do here. You're right, turning off diff protection might unblock you but is not the acceptable solution here. |
I think I spoke to soon. What you've described won't work, the GitHub OIDC role must be created separate to the pipeline and its arn must be passed in after it has been created. There should be no tokens in your All of this is described in the documentation, which says to create the GitHub OIDC role separate from the GitHub Pipeline, as a one-off |
Please can you explain why this is? Is it purely to avoid tokens in the pipeline config? I have a role stack at the top of my pipeline config file which I deploy to bootstrap.
This is not an AWS constraint. Is it a constraint of
Yes, that is what I am doing. But I guess that it's not possible to create the stack in the same app as the pipeline, although I do not understand why. |
Oh, I guess this may be possible if I use an explicit |
To clarify, there are no tokens in my locally synthesized |
Sorry. the identity provider is what I'm talking about here. You can create multiple roles, sure, but you'd have to supply the identity provider into the role each time. I think I know what's happening here. The big question is how is your GitHub Workflow going to get the value of the OIDC role arn? Locally, you can resolve your token by running In GHA, it's not possible to run |
The workflow gets the role arn from
Not quite. I have already bootstrapped the pipeline (like we do for cdk) by running a |
+1 would appreciate being able to use tokens in the workflow. Is there some way for diff protection to ignore tokens? They're a fairly useful CDK feature, would be nice to have the same functionality |
The line: https://github.com/cdklabs/cdk-pipelines-github/blob/main/src/pipeline.ts#L300 does not seem to work when the stack contains tokens.
For example. I create the GitHub OIDC role in an app in my root CDK template, and pass this in to my
GitHubWorkflow.gitHubActionRoleArn
variable. When running thecdk synth
in GHA, I get an error:Which is caused because the workflow appears different because the tokens have changed:
This happens even though the template generates properly in the actual workflow file.
Is there a way to fix this? (Apart from setting
"cdk-pipelines-github:diffProtection": false
in mycdk.json
)The text was updated successfully, but these errors were encountered: