Skip to content
This repository was archived by the owner on Oct 12, 2023. It is now read-only.

Commit 9143f66

Browse files
authored
Merge pull request #13 from keithduncan/fix-vpc-template-parameter
Provide a default value for SourceVpcIDs
2 parents f18105a + c674fcc commit 9143f66

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

service/template.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ Parameters:
1818
Description: Comma separated list of AWS AccountIds whose IAM entities should be allowed to access the API Gateway.
1919
SourceVpcIds:
2020
Type: CommaDelimitedList
21-
Description: Comma separated list of AWS VPC IDs whose occupants should be allowed to access the API Gateway, only applicable when EndpointConfiguration is PRIVATE.
21+
Description: Optional - Comma separated list of AWS VPC IDs whose occupants should be allowed to access the API Gateway, only applicable when EndpointConfiguration is PRIVATE.
22+
Default: ''
23+
24+
Conditions:
25+
AccountRestriction: !Not [ !Equals [ !Join [ ',', !Ref AccountIds ] , '' ] ]
26+
VpcRestriction: !Not [ !Equals [ !Join [ ',', !Ref SourceVpcIds ] , '' ] ]
2227

2328
Metadata:
2429
AWS::CloudFormation::Interface:
@@ -60,8 +65,8 @@ Globals:
6065
DefaultAuthorizer: AWS_IAM
6166
InvokeRole: NONE
6267
ResourcePolicy:
63-
AwsAccountWhitelist: !Ref AccountIds
64-
SourceVpcWhitelist: !Ref SourceVpcIds
68+
AwsAccountWhitelist: !If [ AccountRestriction, !Ref AccountIds, !Ref AWS::NoValue ]
69+
SourceVpcWhitelist: !If [ VpcRestriction, !Ref SourceVpcIds, !Ref AWS::NoValue ]
6570
EndpointConfiguration: !Ref EndpointConfiguration
6671

6772
Resources:

0 commit comments

Comments
 (0)