Skip to content

Instantly share code, notes, and snippets.

@calvin-puram
Created August 17, 2022 06:47
Show Gist options
  • Select an option

  • Save calvin-puram/50cac519501284be592328850fce23d7 to your computer and use it in GitHub Desktop.

Select an option

Save calvin-puram/50cac519501284be592328850fce23d7 to your computer and use it in GitHub Desktop.
...
resource "aws_vpc" "main-{{ name }}" {
cidr_block = "172.26.0.0/16"
enable_dns_hostnames = true
enable_dns_support = true
tags = {
Name = "{{ name }}"
}
}
resource "aws_subnet" "main-{{ name }}" {
cidr_block = "${cidrsubnet(aws_vpc.main-{{ name }}.cidr_block, 3, 1)}"
vpc_id = "${aws_vpc.main-{{ name }}.id}"
availability_zone = var.zone
map_public_ip_on_launch = true
}
resource "aws_internet_gateway" "main-{{ name }}" {
vpc_id = "${aws_vpc.main-{{ name }}.id}"
tags = {
Name = "{{ name }}"
}
}
resource "aws_route_table" "main-{{ name }}" {
vpc_id = "${aws_vpc.main-{{ name }}.id}"
route {
cidr_block = "0.0.0.0/0"
gateway_id = "${aws_internet_gateway.main-{{ name }}.id}"
}
tags = {
Name = "{{ name }}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment