Skip to content

Commit

Permalink
feat(aws-wafwebacl-agigateway): enable govcloud (#900)
Browse files Browse the repository at this point in the history
* Remove hardcoded partition

* Use partition where mistakenly pasted Region

* Use same pattern for region

* Update integration tests
  • Loading branch information
biffgaut committed Feb 14, 2023
1 parent 8a6cc12 commit dd19d93
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import * as api from 'aws-cdk-lib/aws-apigateway';
import * as waf from 'aws-cdk-lib/aws-wafv2';
import * as defaults from '@aws-solutions-constructs/core';
// Note: To ensure CDKv2 compatibility, keep the import statement for Construct separate
import { Stack } from 'aws-cdk-lib';
import { Aws } from 'aws-cdk-lib';

/**
* @summary The properties for the WafwebaclToApiGateway class.
Expand Down Expand Up @@ -62,7 +62,7 @@ export class WafwebaclToApiGateway extends Construct {
webaclProps: props.webaclProps,
});

const resourceArn = `arn:aws:apigateway:${Stack.of(scope).region}::/restapis/${props.existingApiGatewayInterface.restApiId}/stages/${props.existingApiGatewayInterface.deploymentStage.stageName}`;
const resourceArn = `arn:${Aws.PARTITION}:apigateway:${Aws.REGION}::/restapis/${props.existingApiGatewayInterface.restApiId}/stages/${props.existingApiGatewayInterface.deploymentStage.stageName}`;

// Setup the Web ACL Association
new waf.CfnWebACLAssociation(scope, `${id}-WebACLAssociation`, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,11 @@
"Fn::Join": [
"",
[
"arn:aws:apigateway:",
"arn:",
{
"Ref": "AWS::Partition"
},
":apigateway:",
{
"Ref": "AWS::Region"
},
Expand Down Expand Up @@ -1085,7 +1089,11 @@
"Fn::Join": [
"",
[
"arn:aws:apigateway:",
"arn:",
{
"Ref": "AWS::Partition"
},
":apigateway:",
{
"Ref": "AWS::Region"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,11 @@
"Fn::Join": [
"",
[
"arn:aws:apigateway:",
"arn:",
{
"Ref": "AWS::Partition"
},
":apigateway:",
{
"Ref": "AWS::Region"
},
Expand Down

0 comments on commit dd19d93

Please sign in to comment.