Skip to content

Instantly share code, notes, and snippets.

@NYARAS
Created November 18, 2021 21:22
Show Gist options
  • Save NYARAS/44c2ebc313dd06a67f2ad960d3dc6161 to your computer and use it in GitHub Desktop.
Save NYARAS/44c2ebc313dd06a67f2ad960d3dc6161 to your computer and use it in GitHub Desktop.
resource "aws_subnet" "public_1" {
# The VPC ID to create in.
vpc_id = aws_vpc.main.id
# The CIDR block for the subnet.
cidr_block = "192.168.0.0/18"
# The AZ for the subnet.
availability_zone = "us-east-1a"
# Required for EKS. Instances launched into the subnet should be assigned a public IP address
map_public_ip_on_launch = true
# A map of tags to assign to the resource
tags = {
"Name" = "public-us-east-1a"
"kubernetes.io/cluster/eks" = "shared"
"kubernetes.io/role/elb" = 1
}
}
resource "aws_subnet" "public_2" {
# The VPC ID to create in.
vpc_id = aws_vpc.main.id
# The CIDR block for the subnet.
cidr_block = "192.168.64.0/18"
# The AZ for the subnet.
availability_zone = "us-east-1b"
# Required for EKS. Instances launched into the subnet should be assigned a public IP address
map_public_ip_on_launch = true
# A map of tags to assign to the resource
tags = {
"Name" = "public-us-east-1b"
"kubernetes.io/cluster/eks" = "shared"
"kubernetes.io/role/elb" = 1
}
}
resource "aws_subnet" "private_1" {
# The VPC ID to create in.
vpc_id = aws_vpc.main.id
# The CIDR block for the subnet.
cidr_block = "192.168.128.0/18"
# The AZ for the subnet.
availability_zone = "us-east-1a"
# A map of tags to assign to the resource
tags = {
"Name" = "private-us-east-1a"
"kubernetes.io/cluster/eks" = "shared"
"kubernetes.io/role/elb" = 1
}
}
resource "aws_subnet" "private_2" {
# The VPC ID to create in.
vpc_id = aws_vpc.main.id
# The CIDR block for the subnet.
cidr_block = "192.168.192.0/18"
# The AZ for the subnet.
availability_zone = "us-east-1b"
# A map of tags to assign to the resource
tags = {
"Name" = "private-us-east-1b"
"kubernetes.io/cluster/eks" = "shared"
"kubernetes.io/role/elb" = 1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment