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

Add standard tags as part of Cloudformation deployments #934

Merged
merged 1 commit into from
Dec 1, 2022
Merged

Conversation

nicl
Copy link
Contributor

@nicl nicl commented Nov 28, 2022

The standard tags are: App, Stack, Stage.

These tags are required by services.gutools.co.uk to group related stacks (those which belong to the same 'App' and 'Stack' but differ by 'Stage'.

Many stacks already have these tags, but non-CDK ones may not.

Nb. this change will force stack updates for some stacks. This shouldn't be a problem but it may confuse teams without some advance comms. The plan is to do a joint email covering this and also #927 at the same time.

@nicl nicl requested a review from a team as a code owner November 28, 2022 10:59
The standard tags are: App, Stack, Stage (and gu:repo which is
already added). When added, existing values are preferred where
found.

These tags are required by services.gutools.co.uk to group
related stacks (those which belong to the same 'App' and 'Stack'
but differ by 'Stage'.

Many stacks already have these tags, but non-CDK ones may not.

Nb. this change will force stack updates for some stacks. This
shouldn't be a problem but it may confuse teams without some
advance comms.
val defaultTags = Map(
"Stack" -> target.stack.name,
"Stage" -> target.parameters.stage.name,
"App" -> pkg.app.name,
Copy link
Member

@akash1810 akash1810 Dec 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think pkg.app.name is the correct value here, as for the stack cmp-monitoring-CODE in the frontend account, it's App tag has value cmp-monitoring-cdk-eu-west-1, suggesting pkg.app.name is the package name. Maybe we should move to making the app deployment property required (currently optional)?

That is, we go from:

stacks: [cmp-monitoring]
allowedStages:
    - CODE
    - PROD
deployments:
    cmp-monitoring-cdk-eu-west-1: # <-- implicit app
        regions: [eu-west-1]
        type: cloud-formation
        contentDirectory: 'cloud-formation'
        parameters:
            prependStackToCloudFormationStackName: false
            cloudFormationStackName: cmp-monitoring
            templateStagePaths:
                CODE: CmpMonitoringStackEUCode.template.json
                PROD: CmpMonitoringStackEUProd.template.json
            cloudFormationStackByTags: false

To:

stacks: [cmp-monitoring]
allowedStages:
    - CODE
    - PROD
deployments:
    cmp-monitoring-cdk-eu-west-1:
        app: cmp-monitoring # <-- explicit app
        regions: [eu-west-1]
        type: cloud-formation
        contentDirectory: 'cloud-formation'
        parameters:
            prependStackToCloudFormationStackName: false
            cloudFormationStackName: cmp-monitoring
            templateStagePaths:
                CODE: CmpMonitoringStackEUCode.template.json
                PROD: CmpMonitoringStackEUProd.template.json
            cloudFormationStackByTags: false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants