Skip to content

Commit

Permalink
Issue aws-quickstart#198 - Add ForcePrivateOnly parameter to disable …
Browse files Browse the repository at this point in the history
…private IP
  • Loading branch information
supergibbs committed May 1, 2023
1 parent 5170d36 commit a3337a4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
12 changes: 11 additions & 1 deletion templates/linux-bastion-entrypoint-existing-vpc.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Metadata:
- PublicSubnet1ID
- PublicSubnet2ID
- RemoteAccessCIDR
- ForcePrivateOnly
- Label:
default: IAM configuration
Parameters:
Expand Down Expand Up @@ -79,6 +80,8 @@ Metadata:
default: X11 forwarding
EnvironmentVariables:
default: Environment variables
ForcePrivateOnly:
default: Use to disable public IP
KeyPairName:
default: Key pair name
NumBastionHosts:
Expand Down Expand Up @@ -254,6 +257,11 @@ Parameters:
AllowedPattern: ^disabled-onlyssmaccess$|^pl-([0-9a-f]{8}|[0-9a-f]{17})$|^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$
ConstraintDescription: CIDR block parameter must be disabled-onlyssmaccess or in the format "x.x.x.x/x".
Default: disabled-onlyssmaccess
ForcePrivateOnly:
Type: String
Description: Choose "true" to disable public IP.
AllowedValues: ['true', 'false']
Default: "false"
VPCID:
Type: AWS::EC2::VPC::Id
Description: ID of the VPC (for example, vpc-0343606e).
Expand Down Expand Up @@ -638,7 +646,9 @@ Conditions:
- !Not [!Equals [!Ref RemoteAccessCIDR, disabled-onlyssmaccess]]
- !Not [!Condition HasPrefixList]
HasPrefixList: !Equals [!Select [0, !Split ['-', !Ref RemoteAccessCIDR]], pl]
NeedsEip: !Or [!Condition HasRemoteCIDR, !Condition HasPrefixList]
NeedsEip: !And
- !Or [!Condition HasRemoteCIDR, !Condition HasPrefixList]
- !Equals [!Ref ForcePrivateOnly, 'false']
UseAlternativeInitialization: !Not [!Equals [!Ref AlternativeInitializationScript, '']]
CreateIAMRole: !Equals [!Ref AlternativeIAMRole, '']
UseOSImageOverride: !Not [!Equals [!Ref OSImageOverride, '']]
Expand Down
12 changes: 11 additions & 1 deletion templates/linux-bastion-entrypoint-new-vpc.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Metadata:
- PublicSubnet2CIDR
- RemoteAccessCIDR
- VPCTenancy
- ForcePrivateOnly
- Label:
default: IAM configuration
Parameters:
Expand Down Expand Up @@ -83,6 +84,8 @@ Metadata:
default: X11 forwarding
EnvironmentVariables:
default: Environment variables
ForcePrivateOnly:
default: Use to disable public IP
KeyPairName:
default: Key pair name
NumBastionHosts:
Expand Down Expand Up @@ -289,6 +292,11 @@ Parameters:
AllowedPattern: ^disabled-onlyssmaccess$|^pl-([0-9a-f]{8}|[0-9a-f]{17})$|^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$
ConstraintDescription: CIDR block parameter must be disabled-onlyssmaccess or in the format "x.x.x.x/x".
Default: disabled-onlyssmaccess
ForcePrivateOnly:
Type: String
Description: Choose "true" to disable public IP.
AllowedValues: ['true', 'false']
Default: "false"
VPCCIDR:
Type: String
Description: CIDR block for the VPC.
Expand Down Expand Up @@ -335,7 +343,9 @@ Parameters:
Description: Will be attached to all created IAM roles to satisfy security requirements.
Default: ''
Conditions:
NeedsEip: !Not [!Equals [!Ref RemoteAccessCIDR, disabled-onlyssmaccess]]
NeedsEip: !And
- !Not [!Equals [!Ref RemoteAccessCIDR, disabled-onlyssmaccess]]
- !Equals [!Ref ForcePrivateOnly, 'false']
UsingDefaultBucket: !Equals [!Ref QSS3BucketName, aws-quickstart]
Resources:
VPCStack:
Expand Down

0 comments on commit a3337a4

Please sign in to comment.