Skip to content

No AWS Tagging Support on Stacks themselves #932

@lestephane

Description

@lestephane

When I saw in another issue that tag propagation was added, my first instinct
was to try to set tags on the software.amazon.awscdk.App (not possible,
does not implement ITaggable, at least in java), then i tried to set tags on the
software.amazon.awscdk.Stack (same problem).

My use case is to (1) add tags on the App level with propagation, that (2) will be
set in all the AWS::CloudFormation::Stack resources created by cdk deploy, and
in turn (3) will be set on all the resources created within said stacks.

I tried implementing ITaggable on my App subclass and my Stack subclass.
The tags get passed and set all the way to the resources all right, so that's (1) and (3) covered.
But what about (2)? If I understand the design correctly, you're completely reliant
on changesets, and the tags for the Stacks cannot be passed in the stack template.
They would have to be passed in the api call to createChangeSet:

deploy-stack.ts

  const changeSet = await cfn.createChangeSet({
    StackName: deployName,
    ChangeSetName: changeSetName,
    ChangeSetType: update ? 'UPDATE' : 'CREATE',
    Description: `CDK Changeset for execution ${executionId}`,
    TemplateBody: bodyParameter.TemplateBody,
    TemplateURL: bodyParameter.TemplateURL,
    Parameters: params,
    Capabilities: [ 'CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM' ]
    # ADD TAGS SOMEWHERE HERE?
  }).promise();

Makes sense?

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestA feature should be added or improved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions