Skip to content

Commit 7dc4e4a

Browse files
committed
refactor(cdk): Adjust logging stream parameter within adjustCloudformationParameters
Updates the logic added in #1594 to also adjust the logging stream parameter.
1 parent ce14eb9 commit 7dc4e4a

2 files changed

Lines changed: 21 additions & 8 deletions

File tree

cdk/lib/mobile-n10n-compatibility.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,32 @@ function adjustArtifactBucketParameter(stack: GuStack) {
5555
);
5656
}
5757

58+
/**
59+
* In the Mobile account there are separate Kinesis streams for CODE and PROD, so we can't always use the account-wide default
60+
*/
61+
function adjustLoggingStreamParameter(stack: GuStack) {
62+
if (stack.stage !== 'PROD') {
63+
adjustParameter(
64+
stack,
65+
'/account/services/logging.stream.name',
66+
'/account/services/logging.stream.name.code',
67+
);
68+
} else {
69+
// Keep the same value, but explicitly set `allowedValues`
70+
adjustParameter(
71+
stack,
72+
'/account/services/logging.stream.name',
73+
'/account/services/logging.stream.name',
74+
);
75+
}
76+
}
77+
5878
/**
5979
* Applications within the `mobile-n10n` stack do not use account (/GuCDK) defaults.
6080
* This adjusts CloudFormation parameters with values suitable for the `mobile-n10n` stack.
6181
*/
6282
export function adjustCloudformationParameters(stack: GuStack) {
6383
adjustVpcParameters(stack);
6484
adjustArtifactBucketParameter(stack);
85+
adjustLoggingStreamParameter(stack);
6586
}

cdk/lib/report.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { GuPlayApp } from '@guardian/cdk';
22
import { AccessScope } from '@guardian/cdk/lib/constants';
33
import type { GuStackProps } from '@guardian/cdk/lib/constructs/core';
44
import { GuVpcParameter } from '@guardian/cdk/lib/constructs/core';
5-
import { GuLoggingStreamNameParameter } from '@guardian/cdk/lib/constructs/core';
65
import { GuStack } from '@guardian/cdk/lib/constructs/core';
76
import { GuCname } from '@guardian/cdk/lib/constructs/dns';
87
import { GuAllowPolicy } from '@guardian/cdk/lib/constructs/iam';
@@ -96,13 +95,6 @@ export class Report extends GuStack {
9695

9796
adjustCloudformationParameters(this);
9897

99-
// In the Mobile account there are separate Kinesis streams for CODE and PROD, so we can't use the account-wide
100-
// default
101-
const loggingStreamParameter =
102-
GuLoggingStreamNameParameter.getInstance(this);
103-
loggingStreamParameter.allowedValues = [props.loggingStreamParameterName];
104-
loggingStreamParameter.default = props.loggingStreamParameterName;
105-
10698
new GuCname(this, 'DnsRecordForReport', {
10799
app,
108100
domainName: props.domainName,

0 commit comments

Comments
 (0)