Skip to content

Instantly share code, notes, and snippets.

@afcastano
Last active August 19, 2019 10:55
Show Gist options
  • Save afcastano/a0adcb443666476511c77c45d3e3d2bf to your computer and use it in GitHub Desktop.
Save afcastano/a0adcb443666476511c77c45d3e3d2bf to your computer and use it in GitHub Desktop.
AWS VPC
### AWS VPC ####################################################################
# provision app vpc
resource "aws_vpc" "app_vpc" {
cidr_block = "${var.aws_network_cidr}"
enable_dns_support = true
enable_dns_hostnames = true
tags {
Name = "WP Solution VPC"
}
}
# create igw
resource "aws_internet_gateway" "app_igw" {
vpc_id = "${aws_vpc.app_vpc.id}"
}
# add dhcp options
resource "aws_vpc_dhcp_options" "dns_resolver" {
domain_name_servers = ["AmazonProvidedDNS"]
}
# associate dhcp with vpc
resource "aws_vpc_dhcp_options_association" "dns_resolver" {
vpc_id = "${aws_vpc.app_vpc.id}"
dhcp_options_id = "${aws_vpc_dhcp_options.dns_resolver.id}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment