Skip to content

Commit 6cdda1c

Browse files
committed
forward to correct region
1 parent 0a47d7e commit 6cdda1c

File tree

9 files changed

+51
-23
lines changed

9 files changed

+51
-23
lines changed

.github/scripts/fix_cdk_json.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,10 @@ fix_string_key logRetentionInDays "${LOG_RETENTION_IN_DAYS}"
181181
fix_string_key logLevel "${LOG_LEVEL}"
182182
fix_string_key cfnDriftDetectionGroup "${CFN_DRIFT_DETECTION_GROUP}"
183183
fix_boolean_number_key isPullRequest "${IS_PULL_REQUEST}"
184-
fix_string_key csocWafDestination "arn:aws:logs:eu-west-2:693466633220:destination:waf_log_destination" # CSOC WAF log destination - do not change
184+
fix_string_key csocUKWafDestination "arn:aws:logs:eu-west-2:693466633220:destination:waf_log_destination" # CSOC WAF log destination - do not change
185+
fix_string_key csocUSWafDestination "arn:aws:logs:us-east-1:693466633220:destination:waf_log_destination_virginia" # CSOC WAF log destination - do not change
186+
fix_string_key csocApiGatewayDestination "arn:aws:logs:eu-west-2:693466633220:destination:api_gateway_log_destination" # CSOC API Gateway log destination - do not change
187+
fix_boolean_number_key forwardCsocLogs "${FORWARD_CSOC_LOGS}"
185188

186189
if [ "$CDK_APP_NAME" == "StatefulResourcesApp" ]; then
187190
fix_string_key primaryOidcClientId "${PRIMARY_OIDC_CLIENT_ID}"

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
uses: asdf-vm/actions/setup@1902764435ca0dd2f3388eea723a4f92a4eb8302
4141
with:
4242
asdf_branch: v0.14.1
43-
43+
4444
- name: Cache asdf
4545
uses: actions/cache@v4
4646
with:
@@ -133,8 +133,9 @@ jobs:
133133
MARK_JIRA_RELEASED: false
134134
CREATE_INT_RC_RELEASE_NOTES: false
135135
IS_PULL_REQUEST: false
136+
FORWARD_CSOC_LOGS: false
136137
secrets: inherit
137-
138+
138139
release_qa:
139140
needs: [tag_release, release_dev, package_code, get_commit_id]
140141
uses: ./.github/workflows/release_all_stacks.yml
@@ -170,4 +171,5 @@ jobs:
170171
REACT_LOG_LEVEL: "debug"
171172
LOG_RETENTION_IN_DAYS: 30
172173
IS_PULL_REQUEST: false
174+
FORWARD_CSOC_LOGS: false
173175
secrets: inherit

.github/workflows/pull_request.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ jobs:
183183
REACT_LOG_LEVEL: "debug"
184184
LOG_RETENTION_IN_DAYS: 30
185185
IS_PULL_REQUEST: true
186+
FORWARD_CSOC_LOGS: true
186187
secrets: inherit
187188
report_deployed_url:
188189
needs: [release_code, get_issue_number]

.github/workflows/release.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
uses: asdf-vm/actions/setup@1902764435ca0dd2f3388eea723a4f92a4eb8302
4040
with:
4141
asdf_branch: v0.14.1
42-
42+
4343
- name: Cache asdf
4444
uses: actions/cache@v4
4545
with:
@@ -59,7 +59,7 @@ jobs:
5959
- name: Install dependencies
6060
run: |
6161
make install
62-
62+
6363
- name: Set VERSION_TAG to be next tag varsion
6464
id: output_version_tag
6565
run: |
@@ -152,6 +152,7 @@ jobs:
152152
MARK_JIRA_RELEASED: false
153153
CREATE_INT_RC_RELEASE_NOTES: false
154154
IS_PULL_REQUEST: false
155+
FORWARD_CSOC_LOGS: false
155156
secrets: inherit
156157

157158
release_ref:
@@ -189,6 +190,7 @@ jobs:
189190
REACT_LOG_LEVEL: "debug"
190191
LOG_RETENTION_IN_DAYS: 30
191192
IS_PULL_REQUEST: false
193+
FORWARD_CSOC_LOGS: false
192194
secrets: inherit
193195

194196
release_qa:
@@ -226,6 +228,7 @@ jobs:
226228
REACT_LOG_LEVEL: "debug"
227229
LOG_RETENTION_IN_DAYS: 30
228230
IS_PULL_REQUEST: false
231+
FORWARD_CSOC_LOGS: false
229232
secrets: inherit
230233
release_int:
231234
needs: [tag_release, package_code, get_commit_id, release_qa]
@@ -262,6 +265,7 @@ jobs:
262265
MARK_JIRA_RELEASED: false
263266
CREATE_INT_RC_RELEASE_NOTES: true
264267
IS_PULL_REQUEST: false
268+
FORWARD_CSOC_LOGS: false
265269
secrets: inherit
266270
release_prod:
267271
needs: [tag_release, package_code, get_commit_id, release_int]
@@ -298,4 +302,5 @@ jobs:
298302
MARK_JIRA_RELEASED: false
299303
CREATE_INT_RC_RELEASE_NOTES: false
300304
IS_PULL_REQUEST: false
305+
FORWARD_CSOC_LOGS: true
301306
secrets: inherit

.github/workflows/release_all_stacks.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ on:
9090
IS_PULL_REQUEST:
9191
type: boolean
9292
required: true
93+
FORWARD_CSOC_LOGS:
94+
type: boolean
95+
required: true
9396
jobs:
9497
release_all_code:
9598
runs-on: ubuntu-22.04
@@ -245,6 +248,7 @@ jobs:
245248
WAF_ALLOW_GA_RUNNER_CONNECTIVITY: ${{ inputs.WAF_ALLOW_GA_RUNNER_CONNECTIVITY }}
246249
CLOUDFRONT_ORIGIN_CUSTOM_HEADER: ${{secrets.CLOUDFRONT_ORIGIN_CUSTOM_HEADER }}
247250
IS_PULL_REQUEST: ${{inputs.IS_PULL_REQUEST}}
251+
FORWARD_CSOC_LOGS: ${{ inputs.FORWARD_CSOC_LOGS }}
248252

249253
- name: Show diff for stateful stack
250254
run: |
@@ -383,6 +387,7 @@ jobs:
383387
WAF_ALLOW_GA_RUNNER_CONNECTIVITY: ${{ inputs.WAF_ALLOW_GA_RUNNER_CONNECTIVITY }}
384388
CLOUDFRONT_ORIGIN_CUSTOM_HEADER: ${{secrets.CLOUDFRONT_ORIGIN_CUSTOM_HEADER }}
385389
IS_PULL_REQUEST: ${{inputs.IS_PULL_REQUEST}}
390+
FORWARD_CSOC_LOGS: ${{ inputs.FORWARD_CSOC_LOGS }}
386391

387392
- name: Show diff for stateless stack
388393
run: |
@@ -510,6 +515,7 @@ jobs:
510515
WAF_ALLOW_GA_RUNNER_CONNECTIVITY: ${{ inputs.WAF_ALLOW_GA_RUNNER_CONNECTIVITY }}
511516
CLOUDFRONT_ORIGIN_CUSTOM_HEADER: ${{secrets.CLOUDFRONT_ORIGIN_CUSTOM_HEADER }}
512517
IS_PULL_REQUEST: ${{inputs.IS_PULL_REQUEST}}
518+
FORWARD_CSOC_LOGS: ${{ inputs.FORWARD_CSOC_LOGS }}
513519

514520
- name: Show diff for stateful stack redeployment
515521
if: ${{ steps.check_redeploy_stateful_stack.outputs.REDEPLOY_STATEFUL_STACK == 'true' }}

packages/cdk/resources/ukRegionLogGroups.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export interface ukRegionLogGroupsProps {
1212
readonly splunkSubscriptionFilterRole: IRole
1313
readonly wafLogGroupName: string
1414
readonly stackName: string
15-
readonly csocWafDestination: string
15+
readonly csocUKWafDestination: string
16+
readonly forwardCsocLogs: boolean
1617
}
1718

1819
export class ukRegionLogGroups extends Construct {
@@ -44,12 +45,14 @@ export class ukRegionLogGroups extends Construct {
4445
roleArn: props.splunkSubscriptionFilterRole.roleArn
4546
})
4647

47-
new CfnSubscriptionFilter(this, "CsocWafSplunkSubscriptionFilter", {
48-
destinationArn: props.csocWafDestination,
49-
filterPattern: "",
50-
logGroupName: wafLogGroup.logGroupName,
51-
roleArn: props.splunkSubscriptionFilterRole.roleArn
52-
})
48+
if (props.forwardCsocLogs) {
49+
new CfnSubscriptionFilter(this, "CsocWafSplunkSubscriptionFilter", {
50+
destinationArn: props.csocUKWafDestination,
51+
filterPattern: "",
52+
logGroupName: wafLogGroup.logGroupName,
53+
roleArn: props.splunkSubscriptionFilterRole.roleArn
54+
})
55+
}
5356

5457
this.wafLogGroup = wafLogGroup
5558
}

packages/cdk/resources/usRegionLogGroups.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ export interface usRegionLogGroupsProps {
2626
readonly splunkDeliveryStream: string
2727
readonly splunkSubscriptionFilterRole: string
2828
readonly isPullRequest: boolean
29-
readonly csocWafDestination: string
29+
readonly csocUSWafDestination: string
30+
readonly forwardCsocLogs: boolean
3031
}
3132

3233
export class usRegionLogGroups extends Construct {
@@ -127,12 +128,14 @@ export class usRegionLogGroups extends Construct {
127128
removalPolicy: RemovalPolicy.DESTROY
128129
})
129130

130-
new CfnSubscriptionFilter(this, "CsocWafSplunkSubscriptionFilter", {
131-
destinationArn: props.csocWafDestination,
132-
filterPattern: "",
133-
logGroupName: wafLogGroup.logGroupName,
134-
roleArn: props.splunkSubscriptionFilterRole
135-
})
131+
if (props.forwardCsocLogs) {
132+
new CfnSubscriptionFilter(this, "CsocWafSplunkSubscriptionFilter", {
133+
destinationArn: props.csocUSWafDestination,
134+
filterPattern: "",
135+
logGroupName: wafLogGroup.logGroupName,
136+
roleArn: props.splunkSubscriptionFilterRole
137+
})
138+
}
136139

137140
const cfnWafLogGroup = wafLogGroup.node.defaultChild as CfnLogGroup
138141
cfnWafLogGroup.cfnOptions.metadata = {

packages/cdk/stacks/StatelessResourcesStack.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ export class StatelessResourcesStack extends Stack {
9797
const githubAllowListIpv4 = this.node.tryGetContext("githubAllowListIpv4")
9898
const githubAllowListIpv6 = this.node.tryGetContext("githubAllowListIpv6")
9999
const cloudfrontOriginCustomHeader = this.node.tryGetContext("cloudfrontOriginCustomHeader")
100-
const csocWafDestination: string = this.node.tryGetContext("csocWafDestination")
100+
const csocUKWafDestination: string = this.node.tryGetContext("csocUKWafDestination")
101+
// const csocApiGatewayDestination: string = this.node.tryGetContext("csocApiGatewayDestination")
102+
const forwardCsocLogs: boolean = this.node.tryGetContext("forwardCsocLogs")
101103

102104
// Imports
103105
const baseImportPath = `${props.serviceName}-stateful-resources`
@@ -318,7 +320,8 @@ export class StatelessResourcesStack extends Stack {
318320
// waf log groups must start with aws-waf-logs-
319321
wafLogGroupName: `aws-waf-logs-${props.serviceName}-apigw`,
320322
stackName: this.stackName,
321-
csocWafDestination: csocWafDestination
323+
csocUKWafDestination: csocUKWafDestination,
324+
forwardCsocLogs: forwardCsocLogs
322325
})
323326

324327
// API Gateway WAF Web ACL

packages/cdk/stacks/UsCertsStack.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ export class UsCertsStack extends Stack {
5151
const cloudfrontDistributionArn: string = this.node.tryGetContext("cloudfrontDistributionArn")
5252
const logRetentionInDays: number = Number(this.node.tryGetContext("logRetentionInDays"))
5353
const isPullRequest: boolean = this.node.tryGetContext("isPullRequest")
54-
const csocWafDestination: string = this.node.tryGetContext("csocWafDestination")
54+
const csocUSWafDestination: string = this.node.tryGetContext("csocUSWafDestination")
55+
const forwardCsocLogs: boolean = this.node.tryGetContext("forwardCsocLogs")
5556

5657
// Coerce context and imports to relevant types
5758
const hostedZone = HostedZone.fromHostedZoneAttributes(this, "hostedZone", {
@@ -109,7 +110,8 @@ export class UsCertsStack extends Stack {
109110
splunkDeliveryStream: splunkDeliveryStream,
110111
splunkSubscriptionFilterRole: splunkSubscriptionFilterRole,
111112
isPullRequest: isPullRequest,
112-
csocWafDestination: csocWafDestination
113+
csocUSWafDestination: csocUSWafDestination,
114+
forwardCsocLogs: forwardCsocLogs
113115
})
114116

115117
// WAF Web ACL

0 commit comments

Comments
 (0)