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

Tags assigned to first stack apply to un-related stacks #3471

Closed
1 of 5 tasks
sd0408 opened this issue Jul 29, 2019 · 3 comments · Fixed by #3455
Closed
1 of 5 tasks

Tags assigned to first stack apply to un-related stacks #3471

sd0408 opened this issue Jul 29, 2019 · 3 comments · Fixed by #3455
Assignees
Labels
@aws-cdk/core Related to core CDK functionality bug This issue is a bug.

Comments

@sd0408
Copy link

sd0408 commented Jul 29, 2019

Note: for support questions, please first reference our documentation, then use Stackoverflow. This repository's issues are intended for feature requests and bug reports.

  • I'm submitting a ...

    • 🪲 bug report
    • 🚀 feature request
    • 📚 construct library gap
    • ☎️ security issue or vulnerability => Please see policy
    • ❓ support request => Please see note at the top of this template.
  • What is the current behavior?
    If the current behavior is a 🪲bug🪲: Please provide the steps to reproduce

  1. Create a stack setting some tags
  2. Create another stack setting some different tags
  3. cdk deploy MyStack

Then I notice that the tags on the second stack are the same as the tags on the first stack. Thus, the values of the tags on the second stack are being ignored.


class FooStack(core.Stack):

    def __init__(self, scope: core.Construct, id: str, tags, **kwargs) -> None:
        super().__init__(scope, id, tags=tags, **kwargs)

app = core.App()

initial_tags ={"foo": "bar"}
other_tags = {"foo2": "alsobar"}

FooStack(app, "foo", tags=initial_tags)
FooStack(app, "foo2", tags=other_tags)

app.synth()

I have noticed that if I instantiate the first stack with an empty tag set then the second stack does get it's tags as you would expect.

  • What is the expected behavior (or behavior of feature suggested)?
    When I instantiate either a stack object or a child of a stack object the tags supplied to work for that stack instance and only for that stack instance.

  • What is the motivation / use case for changing the behavior or adding this feature?
    Would like to be able to apply different sets of tags to different objects.

  • Please tell us about your environment:

    • CDK CLI Version: 1.2.0
    • Module Version: 1.1.0
    • OS: OSX Mojave
    • Language: I've only used Python
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. associated pull-request, stackoverflow, gitter, etc)

@sd0408 sd0408 added the needs-triage This issue or PR still needs to be triaged. label Jul 29, 2019
@eladb
Copy link
Contributor

eladb commented Jul 29, 2019

See #3455

@sd0408
Copy link
Author

sd0408 commented Jul 29, 2019

Thanks... same issue. I promise I searched

@NGL321
Copy link
Contributor

NGL321 commented Jul 29, 2019

@sd0408 It actually really helps to have this in an issue as well as a PR so it comes up in other people's searches later! 😸

Thanks for making a post! This will close out when the PR merges.

@NGL321 NGL321 added bug This issue is a bug. @aws-cdk/core Related to core CDK functionality and removed needs-triage This issue or PR still needs to be triaged. labels Jul 29, 2019
RomainMuller pushed a commit that referenced this issue Jul 30, 2019
Fixes a bug where stacks being declared with different tags end up with
identical tags when deployed to CloudFormation, due to the first tagged stack's
tags overriding the value of `options.tags`.

This change makes it so that the `options.tags` value is not overridden, and the
actual tag list to be used is determined in the same way for each stack that
will be deployed.

Fixes #3471
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/core Related to core CDK functionality bug This issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants