Skip to content

Commit

Permalink
Merge pull request #2247 from guardian/aa/tag-launch-template
Browse files Browse the repository at this point in the history
fix(ec2-app): Apply the `App` tag to the launch template
  • Loading branch information
akash1810 authored Mar 8, 2024
2 parents 1a47c1e + a551119 commit 5b71970
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/breezy-countries-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@guardian/cdk": patch
---

Apply the `App` tag to the launch template created in the EC2 App pattern.
4 changes: 3 additions & 1 deletion src/constructs/autoscaling/asg.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Token } from "aws-cdk-lib";
import { Tags, Token } from "aws-cdk-lib";
import { AutoScalingGroup } from "aws-cdk-lib/aws-autoscaling";
import type { AutoScalingGroupProps, CfnAutoScalingGroup } from "aws-cdk-lib/aws-autoscaling";
import { LaunchTemplate, OperatingSystemType, UserData } from "aws-cdk-lib/aws-ec2";
Expand Down Expand Up @@ -162,5 +162,7 @@ export class GuAutoScalingGroup extends GuAppAwareConstruct(AutoScalingGroup) {
// leaves it to the default value, which is actually false.
// { UpdatePolicy: { autoScalingScheduledAction: { IgnoreUnmodifiedGroupSizeProperties: true }}
cfnAsg.addDeletionOverride("UpdatePolicy");

Tags.of(launchTemplate).add("App", app);
}
}
24 changes: 24 additions & 0 deletions src/patterns/ec2-app/__snapshots__/base.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,10 @@ exports[`the GuEC2App pattern can produce a restricted EC2 app locked to specifi
{
"ResourceType": "instance",
"Tags": [
{
"Key": "App",
"Value": "test-gu-ec2-app",
},
{
"Key": "gu:cdk:version",
"Value": "TEST",
Expand All @@ -924,6 +928,10 @@ exports[`the GuEC2App pattern can produce a restricted EC2 app locked to specifi
{
"ResourceType": "volume",
"Tags": [
{
"Key": "App",
"Value": "test-gu-ec2-app",
},
{
"Key": "gu:cdk:version",
"Value": "TEST",
Expand Down Expand Up @@ -955,6 +963,10 @@ exports[`the GuEC2App pattern can produce a restricted EC2 app locked to specifi
{
"ResourceType": "launch-template",
"Tags": [
{
"Key": "App",
"Value": "test-gu-ec2-app",
},
{
"Key": "gu:cdk:version",
"Value": "TEST",
Expand Down Expand Up @@ -1772,6 +1784,10 @@ exports[`the GuEC2App pattern should produce a functional EC2 app with minimal a
{
"ResourceType": "instance",
"Tags": [
{
"Key": "App",
"Value": "test-gu-ec2-app",
},
{
"Key": "gu:cdk:version",
"Value": "TEST",
Expand All @@ -1797,6 +1813,10 @@ exports[`the GuEC2App pattern should produce a functional EC2 app with minimal a
{
"ResourceType": "volume",
"Tags": [
{
"Key": "App",
"Value": "test-gu-ec2-app",
},
{
"Key": "gu:cdk:version",
"Value": "TEST",
Expand Down Expand Up @@ -1828,6 +1848,10 @@ exports[`the GuEC2App pattern should produce a functional EC2 app with minimal a
{
"ResourceType": "launch-template",
"Tags": [
{
"Key": "App",
"Value": "test-gu-ec2-app",
},
{
"Key": "gu:cdk:version",
"Value": "TEST",
Expand Down

0 comments on commit 5b71970

Please sign in to comment.