Skip to content

Instantly share code, notes, and snippets.

@geek182
Created February 2, 2018 13:01
Show Gist options
  • Save geek182/4bd64e9d5f71faa33f36ef759679894f to your computer and use it in GitHub Desktop.
Save geek182/4bd64e9d5f71faa33f36ef759679894f to your computer and use it in GitHub Desktop.
terraform-out-subnet
###
resource "aws_subnet" "public-subnet" {
count = "${length(split(",", lookup(var.azs, var.region)))}"
vpc_id = "${aws_vpc.main.id}"
cidr_block = "${cidrsubnet(var.vpc_cidr, 3,count.index +3 )}"
availability_zone = "${element(split(",", lookup(var.azs, var.region)), count.index)}"
map_public_ip_on_launch = true
tags {
Name = "Public-Subnet"
}
}
###
Terraform will perform the following actions:
+ aws_subnet.public-subnet[0]
id: <computed>
assign_ipv6_address_on_creation: "false"
availability_zone: "sa-east-1a"
cidr_block: "10.76.22.0/23"
ipv6_cidr_block: <computed>
ipv6_cidr_block_association_id: <computed>
map_public_ip_on_launch: "true"
tags.%: "1"
tags.Name: "Public-Subnet"
vpc_id: "vpc-xxxxxx"
+ aws_subnet.public-subnet[1]
id: <computed>
assign_ipv6_address_on_creation: "false"
availability_zone: " sa-east-1c"
cidr_block: "10.76.24.0/23"
ipv6_cidr_block: <computed>
ipv6_cidr_block_association_id: <computed>
map_public_ip_on_launch: "true"
tags.%: "1"
tags.Name: "Public-Subnet"
vpc_id: "vpc-xxxxxxx"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment