-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add lab: Looping over collections with Fn::ForEach. * Bump version: 3.0.0 → 3.1.0 * Fix cfn-nag issues * Few nitpicks; grammar cleanup code line numbers correction blank space cleanup * Couple more picked up by IDE --------- Co-authored-by: Franco Rezabek <[email protected]>
- Loading branch information
1 parent
f98f3dd
commit 0c9b4ee
Showing
10 changed files
with
801 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[bumpversion] | ||
current_version = 3.0.0 | ||
current_version = 3.1.0 | ||
commit = True | ||
tag = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
AWSTemplateFormatVersion: "2010-09-09" | ||
|
||
Description: AWS CloudFormation workshop lab for looping over collections (uksb-1q9p31idr) (tag:looping-over-collections). | ||
|
||
Transform: AWS::LanguageExtensions | ||
|
||
Resources: | ||
Fn::ForEach::S3Buckets: | ||
- S3BucketLogicalId | ||
- [S3Bucket1, S3Bucket2, S3Bucket3] | ||
- ${S3BucketLogicalId}: | ||
Type: AWS::S3::Bucket | ||
Properties: | ||
BucketEncryption: | ||
ServerSideEncryptionConfiguration: | ||
- ServerSideEncryptionByDefault: | ||
SSEAlgorithm: aws:kms | ||
LifecycleConfiguration: | ||
Rules: | ||
- Id: Example Glacier Rule | ||
ExpirationInDays: 365 | ||
Status: Enabled | ||
Transitions: | ||
- TransitionInDays: 30 | ||
StorageClass: GLACIER | ||
PublicAccessBlockConfiguration: | ||
BlockPublicAcls: true | ||
BlockPublicPolicy: true | ||
IgnorePublicAcls: true | ||
RestrictPublicBuckets: true | ||
Tags: | ||
- Key: Name | ||
Value: aws-cloudformation-workshop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
AWSTemplateFormatVersion: "2010-09-09" | ||
|
||
Description: AWS CloudFormation workshop lab for looping over collections (uksb-1q9p31idr) (tag:looping-over-collections). | ||
|
||
Mappings: | ||
Vpc: | ||
Configuration: | ||
EnableDnsHostnames: true | ||
EnableDnsSupport: true | ||
Cidr: 172.31.0.0/16 | ||
|
||
SubnetAzIndexes: | ||
Public: | ||
"1": 0 | ||
"2": 1 | ||
Private: | ||
"1": 0 | ||
"2": 1 | ||
|
||
SubnetCidrs: | ||
Public: | ||
"1": 172.31.1.0/24 | ||
"2": 172.31.2.0/24 | ||
Private: | ||
"1": 172.31.11.0/24 | ||
"2": 172.31.12.0/24 | ||
|
||
Transform: AWS::LanguageExtensions | ||
|
||
Resources: | ||
Vpc: | ||
Type: AWS::EC2::VPC | ||
Properties: | ||
CidrBlock: !FindInMap | ||
- Vpc | ||
- Configuration | ||
- Cidr | ||
EnableDnsHostnames: !FindInMap | ||
- Vpc | ||
- Configuration | ||
- EnableDnsHostnames | ||
EnableDnsSupport: !FindInMap | ||
- Vpc | ||
- Configuration | ||
- EnableDnsSupport | ||
Tags: | ||
- Key: Name | ||
Value: aws-cloudformation-workshop | ||
|
||
InternetGateway: | ||
Type: AWS::EC2::InternetGateway | ||
Properties: | ||
Tags: | ||
- Key: Name | ||
Value: aws-cloudformation-workshop | ||
|
||
VpcGatewayAttachment: | ||
Type: AWS::EC2::VPCGatewayAttachment | ||
Properties: | ||
VpcId: !Ref Vpc | ||
InternetGatewayId: !Ref InternetGateway | ||
|
||
Fn::ForEach::SubnetTypes: | ||
- SubnetType | ||
- [Public, Private] | ||
- Fn::ForEach::SubnetNumbers: | ||
- SubnetNumber | ||
- ["1", "2"] | ||
- ${SubnetType}Subnet${SubnetNumber}: | ||
Type: AWS::EC2::Subnet | ||
Properties: | ||
AvailabilityZone: !Select | ||
- !FindInMap | ||
- SubnetAzIndexes | ||
- !Ref SubnetType | ||
- !Ref SubnetNumber | ||
- !GetAZs "" | ||
CidrBlock: !FindInMap | ||
- SubnetCidrs | ||
- !Ref SubnetType | ||
- !Ref SubnetNumber | ||
Tags: | ||
- Key: Name | ||
Value: aws-cloudformation-workshop | ||
VpcId: !Ref Vpc | ||
${SubnetType}RouteTable${SubnetNumber}: | ||
Type: AWS::EC2::RouteTable | ||
Properties: | ||
Tags: | ||
- Key: Name | ||
Value: aws-cloudformation-workshop | ||
VpcId: !Ref Vpc | ||
${SubnetType}SubnetRouteTableAssociation${SubnetNumber}: | ||
Type: AWS::EC2::SubnetRouteTableAssociation | ||
Properties: | ||
RouteTableId: !Ref | ||
Fn::Sub: ${SubnetType}RouteTable${SubnetNumber} | ||
SubnetId: !Ref | ||
Fn::Sub: ${SubnetType}Subnet${SubnetNumber} | ||
|
||
Fn::ForEach::DefaultRoutesForPublicSubnets: | ||
- SubnetNumber | ||
- ["1", "2"] | ||
- DefaultRouteForPublicSubnet${SubnetNumber}: | ||
DependsOn: VpcGatewayAttachment | ||
Type: AWS::EC2::Route | ||
Properties: | ||
RouteTableId: !Ref | ||
Fn::Sub: PublicRouteTable${SubnetNumber} | ||
DestinationCidrBlock: 0.0.0.0/0 | ||
GatewayId: !Ref InternetGateway | ||
|
||
Fn::ForEach::NatGateways: | ||
- SubnetNumber | ||
- ["1", "2"] | ||
- Eip${SubnetNumber}: | ||
DependsOn: VpcGatewayAttachment | ||
Type: AWS::EC2::EIP | ||
Properties: | ||
Domain: vpc | ||
NatGateway${SubnetNumber}: | ||
Type: AWS::EC2::NatGateway | ||
Properties: | ||
AllocationId: !GetAtt | ||
- !Sub Eip${SubnetNumber} | ||
- AllocationId | ||
SubnetId: !Ref | ||
Fn::Sub: PublicSubnet${SubnetNumber} | ||
Tags: | ||
- Key: Name | ||
Value: aws-cloudformation-workshop | ||
DefaultRouteForPrivateSubnet${SubnetNumber}: | ||
Type: AWS::EC2::Route | ||
Properties: | ||
RouteTableId: !Ref | ||
Fn::Sub: PrivateRouteTable${SubnetNumber} | ||
DestinationCidrBlock: 0.0.0.0/0 | ||
NatGatewayId: !Ref | ||
Fn::Sub: NatGateway${SubnetNumber} | ||
|
||
Outputs: | ||
Fn::ForEach::SubnetIdsOutputs: | ||
- SubnetType | ||
- [Public, Private] | ||
- Fn::ForEach::SubnetNumbers: | ||
- SubnetNumber | ||
- ["1", "2"] | ||
- ${SubnetType}Subnet${SubnetNumber}: | ||
Description: !Sub 'The ID of ${SubnetType}Subnet${SubnetNumber}.' | ||
Export: | ||
Name: !Sub ${AWS::AccountId}-${SubnetType}Subnet${SubnetNumber}Id | ||
Value: !Ref | ||
Fn::Sub: ${SubnetType}Subnet${SubnetNumber} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
AWSTemplateFormatVersion: "2010-09-09" | ||
|
||
Description: AWS CloudFormation workshop lab for looping over collections (uksb-1q9p31idr) (tag:looping-over-collections). | ||
|
||
Transform: AWS::LanguageExtensions | ||
|
||
Resources: | ||
# TODO: add resources you wish to describe. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
AWSTemplateFormatVersion: "2010-09-09" | ||
|
||
Description: AWS CloudFormation workshop lab for looping over collections (uksb-1q9p31idr) (tag:looping-over-collections). | ||
|
||
Mappings: | ||
Vpc: | ||
Configuration: | ||
EnableDnsHostnames: true | ||
EnableDnsSupport: true | ||
Cidr: 172.31.0.0/16 | ||
|
||
SubnetAzIndexes: | ||
Public: | ||
"1": 0 | ||
"2": 1 | ||
Private: | ||
"1": 0 | ||
"2": 1 | ||
|
||
SubnetCidrs: | ||
Public: | ||
"1": 172.31.1.0/24 | ||
"2": 172.31.2.0/24 | ||
Private: | ||
"1": 172.31.11.0/24 | ||
"2": 172.31.12.0/24 | ||
|
||
Transform: AWS::LanguageExtensions | ||
|
||
Resources: | ||
Vpc: | ||
Type: AWS::EC2::VPC | ||
Properties: | ||
CidrBlock: !FindInMap | ||
- Vpc | ||
- Configuration | ||
- Cidr | ||
EnableDnsHostnames: !FindInMap | ||
- Vpc | ||
- Configuration | ||
- EnableDnsHostnames | ||
EnableDnsSupport: !FindInMap | ||
- Vpc | ||
- Configuration | ||
- EnableDnsSupport | ||
Tags: | ||
- Key: Name | ||
Value: aws-cloudformation-workshop | ||
|
||
InternetGateway: | ||
Type: AWS::EC2::InternetGateway | ||
Properties: | ||
Tags: | ||
- Key: Name | ||
Value: aws-cloudformation-workshop | ||
|
||
VpcGatewayAttachment: | ||
Type: AWS::EC2::VPCGatewayAttachment | ||
Properties: | ||
VpcId: !Ref Vpc | ||
InternetGatewayId: !Ref InternetGateway | ||
|
||
# TODO: add resources you wish to describe. |
Oops, something went wrong.