-
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
[cdk-pipelines] stacks cannot be tagged #9260
Comments
Unfortunately this works as intended. There are practical reasons why we can not propagate tags across I will agree that this leads to unintuitive behavior. I will have a think on relaxing the restrictions somewhat or signaling the failure better. In the mean time, you need to apply the aspects to every stage individually. Can you describe your use case a little? What are you trying to achieve? |
So I belong to an organization that requires a very specific tagging specification be applied to all AWS deployed resources. And AWS has, for several years, been making tagging a critical aspect of all resources. I.e., roadmap for AWS at large Obviously you are familiar with tags and their purpose. My organization is using them primarily as for cost tracking. The secondary purpose, someday?, will be security, as that appears to be another roadmap item. So when you use CDK and you specify tags from the command-line one would expect that ALL stacks that are created would receive the tags that are provided. Looking at the architecture it appears that this is an aspect. And generally aspects are intended to be applied across a large number of constructs. Ideally, the command-line should allow for 'include tags' and 'exclude tags', but alas it does not. Making it very hard to determine what the rule should be about tags that are not present in the request and the tags currently present on the resource. That is rather an unfortunate design flaw. I'm assuming that since cdk-pipelines is in preview that this kind of item is something that should be addressed. It seems reasonable to me to confer with others in the CDK space to determine if the Tagging aspect is intended to be applied to all children. If not, then the deficiency of the Aspects should be documented in such away as to clarify any future misunderstandings. |
I've run into the issue he mentions where the stack [in the stage] itself is not tagged. I tried adding the tags using |
Ditto re: the stack [in the stage] itself not getting tagged |
Had the same issue (in combination with CDK-pipelines + stages). |
This is also causing issues for me, as in my case the pipeline cant create change sets that dont have tags for the stacks in the stage due to condition restrictions. when using pipeline.addApplicationStage(x) it fails "not authorized to perform: cloudformation:CreateChangeSet" when deploying the application stage in pipeline. Are there any workarounds? Will it be needed to expose the TemplateConfiguration of the changeset action as described here: |
I have implemented a workaround for now. Added the TemplateConfiguration Json file to the Synth Output like this :
Create the Pipeline then type it to cfnPipeline:
Then addPropertyOverride based on the number of stages at the point where the application Stage is added. // Add ApplicationStage stages
|
Apply stack tags to the stacks deployed using CDK Pipelines. Fixes #9260.
Apply stack tags to the stacks deployed using CDK Pipelines. Taking this opportunity to make tags easier to work with -- move them from metadata into cloud artifact properties. Fixes #9260. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
It does not appear that pipeline applies aspects properly. Ideally, it should apply the aspects to itself and stages. stage appears to apply aspects that are added directly, but do not apply tagging aspects.
Reproduction Steps
See #9256 and #9259 for the initial steps. In that both of these cases showed higher level issues.
First I attempted to solve the PermissionsBoundary issue. I used the App.node.applyAspects(...) and received success for the initial pipeline stack. I.e., all roles created in the pipeline stack had the PermissionsBoundary from the aspect applied.
Problem solved, right? Well, then I continued with the tutorial and when I added a 'stage' the issue re-appeared. In that the stack associated with the Stage did not have the PermissionsBoundary aspect applied. So I did the next level pipeline.node.applyAspects(...) and still no result. So I did the next level stage.node.applyAspects(...) and successfully the PermissionsBoundary aspect was applied to all IAM Roles in the Stage/Stack.
At this point I noticed that the Tags had been lost. I traced that back to the first update after the create of the Pipeline STack. So I started the same adventure, only this time I figured that the PermissionsBoundary aspect was a clue and so I did not apply at each level, but started at the two points that I had found to work. I.e., Tags.add(stage, "key", "value") and sure enough it did not work. So I had to go down the next level to the 'stack' itself that the stage was composed of. And success as the tags were resources. However, the tags are missing on the stack itself.
Ideally, if tags are specified at the App they should be applied at each component. And because Tagging is an aspect this leads to the next issue of consistency.
Ideally, if an aspect is specified at the App it should be applied to all components, including the pipeline/stage/stacks/resources.
Error Log
Observed missing aspects.
Environment
Other
I have a private git repo with the tutorial on it and each commit I made to discover the issues described above. I can provide that if it would be of interest or help.
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: