Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Issue #198 - Add ForcePrivateOnly parameter to disable private IP #200

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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