Skip to content
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] removes tags on self-mutating updates #9259

Closed
roskelleycj opened this issue Jul 25, 2020 · 4 comments
Closed

[cli] removes tags on self-mutating updates #9259

roskelleycj opened this issue Jul 25, 2020 · 4 comments
Assignees
Labels
bug This issue is a bug. effort/medium Medium work item – several days of effort p1 package/tools Related to AWS CDK Tools or CLI

Comments

@roskelleycj
Copy link

I've observed that the tags placed initially on the cdk-pipeline are subsequently removed on updates. It appears that the tags are lost because I used the cdk --tags option and that is not preserved in the CodeBuild that is used for the self-mutating aspects.

Reproduction Steps

Using this tutorial I was able to get a cdk-pipeline setup for my cdk app. When the tutorial describes this:

As a one-time operation, deploy the pipeline stack:

npx cdk deploy \
  --profile account1-profile \
  CdkpipelinesDemoPipelineStack

I added added the following:

--tags blueprint=woodstock3368 --tags system=testing 

so that the command looks like this:

npx cdk deploy \
  --profile account1-profile \
  --tags blueprint=woodstock3368 --tags system=testing  \
  CdkpipelinesDemoPipelineStack

The stack was successfully created initially. I checked the resources and they were properly tagged. I then started to move on with the tutorial to add more stages/stacks and eventually noticed the the tags were lost.

Ideally, the tags should be preserved from update to update.

Error Log

Observation of tags being removed from resources that initially had tags.

Environment

  • CLI Version : 1.54.0 (build c01b9b9)
  • Framework Version:
  • Node.js Version: v12.18.3
  • OS : osx 10.15.6
  • Language (Version): all

This is 🐛 Bug Report

@roskelleycj roskelleycj added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 25, 2020
@github-actions github-actions bot added the @aws-cdk/pipelines CDK Pipelines library label Jul 25, 2020
@ericzbeard ericzbeard removed the needs-triage This issue or PR still needs to be triaged. label Jul 27, 2020
@ericzbeard ericzbeard removed their assignment Jul 28, 2020
@njlynch
Copy link
Contributor

njlynch commented Jul 31, 2020

This seems to be [potentially] a general issue with the cli. Tags that are assigned via a change set (like the ones created with cdk deploy --tags ...) are not taken into account on the next deploy. From first glance, it looks like we could easily pass along the existing tags of the stack on the next deploy (quick test shows this would work). However, we'd want to do this in a way that allows users to remove tags and doesn't disrupt any existing workflows with the CLI. Tagging the tools and @shivlaks to weigh in.

@njlynch njlynch added the package/tools Related to AWS CDK Tools or CLI label Jul 31, 2020
@njlynch njlynch assigned shivlaks and unassigned njlynch Aug 3, 2020
@rix0rrr
Copy link
Contributor

rix0rrr commented Aug 4, 2020

Agreed that this is a CLI issue.

UX question: what should the command be if one wants to remove the tags? Not supplying any will not be sufficient anymore then.

@rix0rrr rix0rrr added effort/medium Medium work item – several days of effort p1 labels Aug 4, 2020
@rix0rrr rix0rrr added this to the [CDK Pipelines] Soon milestone Aug 12, 2020
@SomayaB SomayaB removed the @aws-cdk/pipelines CDK Pipelines library label Aug 18, 2020
@SomayaB SomayaB changed the title [cdk-pipelines] removes tags on self-mutating updates [cli] removes tags on self-mutating updates Aug 18, 2020
@rix0rrr
Copy link
Contributor

rix0rrr commented Sep 2, 2020

In hindsight, this is not a bug. cdk deploy --tags should never have been a feature and you shouldn't be using it. Tagging inside the CDK app is the proper way to do tagging.

@rix0rrr rix0rrr closed this as completed Sep 2, 2020
@roskelleycj
Copy link
Author

I disagree with your assessment that it should never have been added as a feature. It is actually quite a useful feature.

Please consider enterprise ORGs that have required tags and some of those tags are provided at time of build/deploy.
If this isn't a feature of the CDK it raises the level of complexity that an ORG must adopt to enforce their tagging specifications.

For example without this feature there is no means without forcing either a new construct (I.e., standard Aspect for Tagging) and then requiring (how????) each CDK App in the ORG to include the specifics. And since there is no re-enforcement in CDK it is difficult to stop a build/deploy. In other words the cdk deploy --tags is actually a very good feature, if it worked! I would ask that you re-consider addressing the issue OR allowing ORGs to easily apply consistent tagging behavior.

PS. BTW, where is the issue to 'remove cdk deploy --tags'? I.e., I would expect a mature community process wherein if you believe that the feature is deprecated and should be removed I would see 'issues' to address that. As it is, I just see that this issue is closed with no reference to the other issues. Leaving me to wonder if cdk deploy --tags will ever be removed. And thus encouraging me to look at other projects that might better meet my needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. effort/medium Medium work item – several days of effort p1 package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

No branches or pull requests

6 participants