Created
February 21, 2018 00:12
-
-
Save alexjurkiewicz/c62791efcbf103911c67ab98f765bd01 to your computer and use it in GitHub Desktop.
Cloudformation vs Terraform
This file contains hidden or 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
resources: | |
app_subnet_1: | |
Type: "AWS::EC2::Subnet" | |
Properties: | |
AvailabilityZone: !Select: [ 0, !Ref subnet_azs ] | |
CidrBlock: !Select: [ 0, !Ref subnet_cidrs ] | |
Tags: | |
- Key: environment | |
Value: !Ref workspace | |
- Key: division | |
Value: tech | |
- Key: Name | |
Value: !Sub | |
- AppSubnetAZ1-${workspace} | |
- { workspace: !Ref workspace } | |
VpcId: !Ref vpc_id | |
app_subnet_2: | |
Type: "AWS::EC2::Subnet" | |
Properties: | |
AvailabilityZone: !Select: [ 1, !Ref subnet_azs ] | |
CidrBlock: !Select: [ 1, !Ref subnet_cidrs ] | |
Tags: | |
- Key: environment | |
Value: !Ref workspace | |
- Key: division | |
Value: tech | |
- Key: Name | |
Value: !Sub | |
- AppSubnetAZ2-${workspace} | |
- { workspace: !Ref workspace } | |
VpcId: !Ref vpc_id | |
This file contains hidden or 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
resource "aws_subnet" "app" { | |
count = "${length(var.subnet_cidrs)}" | |
vpc_id = "${var.vpc_id}" | |
cidr_block = "${var.subnet_cidrs[count.index]}" | |
availability_zone = "${var.subnet_azs[count.index]}" | |
tags { | |
environment = "${terraform.workspace}" | |
division = "tech" | |
Name = "AppSubnetAZ${count.index+1}-${terraform.workspace}" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment