diff --git a/packages/cdk/lib/__snapshots__/cloudquery.test.ts.snap b/packages/cdk/lib/__snapshots__/cloudquery.test.ts.snap index c713ed72c..5276be916 100644 --- a/packages/cdk/lib/__snapshots__/cloudquery.test.ts.snap +++ b/packages/cdk/lib/__snapshots__/cloudquery.test.ts.snap @@ -736,6 +736,13 @@ exports[`The CloudQuery stack matches the snapshot 1`] = ` "PropagateAtLaunch": true, "Value": "guardian/service-catalogue", }, + { + "Key": "LogKinesisStreamName", + "PropagateAtLaunch": true, + "Value": { + "Ref": "LoggingStreamName", + }, + }, { "Key": "Name", "PropagateAtLaunch": true, @@ -751,6 +758,11 @@ exports[`The CloudQuery stack matches the snapshot 1`] = ` "PropagateAtLaunch": true, "Value": "TEST", }, + { + "Key": "SystemdUnit", + "PropagateAtLaunch": true, + "Value": "cloudquery.service", + }, ], "VPCZoneIdentifier": { "Ref": "cloudqueryPrivateSubnets", diff --git a/packages/cdk/lib/cloudquery.ts b/packages/cdk/lib/cloudquery.ts index c2e02dae1..afdba86c4 100644 --- a/packages/cdk/lib/cloudquery.ts +++ b/packages/cdk/lib/cloudquery.ts @@ -1,8 +1,10 @@ +import { MetadataKeys } from '@guardian/cdk/lib/constants'; import type { GuAutoScalingGroupProps } from '@guardian/cdk/lib/constructs/autoscaling'; import { GuAutoScalingGroup } from '@guardian/cdk/lib/constructs/autoscaling'; import type { GuStackProps } from '@guardian/cdk/lib/constructs/core'; import { GuDistributionBucketParameter, + GuLoggingStreamNameParameter, GuStack, } from '@guardian/cdk/lib/constructs/core'; import { @@ -11,7 +13,7 @@ import { SubnetType, } from '@guardian/cdk/lib/constructs/ec2'; import type { App } from 'aws-cdk-lib'; -import { CfnParameter } from 'aws-cdk-lib'; +import { CfnParameter, Tags } from 'aws-cdk-lib'; import { InstanceClass, InstanceSize, @@ -163,6 +165,18 @@ export class CloudQuery extends GuStack { const asg = new GuAutoScalingGroup(this, 'asg', asgProps); + /* + Manually add tags required by devx-logs to build fluentbit configuration, + as GuCDK does not currently support this. + + See https://github.com/guardian/cdk/issues/1800. + */ + Tags.of(asg).add( + MetadataKeys.LOG_KINESIS_STREAM_NAME, + GuLoggingStreamNameParameter.getInstance(this).valueAsString, + ); + Tags.of(asg).add(MetadataKeys.SYSTEMD_UNIT, `${app}.service`); + asg.role.addManagedPolicy( ManagedPolicy.fromManagedPolicyArn( this,