Skip to content

Instantly share code, notes, and snippets.

@koorukuroo
Created November 13, 2025 22:52
Show Gist options
  • Select an option

  • Save koorukuroo/2446a67cec6aa506a1349ac6a4d6950f to your computer and use it in GitHub Desktop.

Select an option

Save koorukuroo/2446a67cec6aa506a1349ac6a4d6950f to your computer and use it in GitHub Desktop.
# terraform/vpc.tf
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "~> 5.0"
name = "${var.cluster_name}-vpc"
cidr = "10.0.0.0/16"
# 사용할 AZ 2개 선택
azs = slice(data.aws_availability_zones.available.names, 0, 2)
# 프라이빗 / 퍼블릭 서브넷 CIDR
private_subnets = [
"10.0.1.0/24",
"10.0.2.0/24",
]
public_subnets = [
"10.0.101.0/24",
"10.0.102.0/24",
]
# NAT Gateway 및 DNS 설정
enable_nat_gateway = true
single_nat_gateway = true
enable_dns_hostnames = true
enable_dns_support = true
# 퍼블릭 서브넷 태그: 외부 로드밸런서용(ELB)
public_subnet_tags = {
"kubernetes.io/role/elb" = "1"
}
# 프라이빗 서브넷 태그: 내부 로드밸런서용(Internal ELB)
private_subnet_tags = {
"kubernetes.io/role/internal-elb" = "1"
}
# 공통 태그
tags = {
Name = "${var.cluster_name}-vpc"
Environment = "lab"
Terraform = "true"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment