resource "ncloud_vpc" "exem-dsk-vpc" { //VPC 생성
  ipv4_cidr_block = "10.40.0.0/16"
  name = "jh-test-cidr"
}

resource "ncloud_subnet" "exem-dsk-subnet" { // node용 프라이빗 서브넷 생성
  vpc_no = ncloud_vpc.exem-dsk-vpc.id
  subnet = "10.40.10.0/24"
  zone = "KR-2"
  subnet_type = "PRIVATE"
  name = "private-subnet"
  usage_type = "GEN"
  network_acl_no = ncloud_network_acl.exem-dsk-acl.id
}

resource "ncloud_subnet" "exem-dsk-subnet-public" { // node용 퍼블릭 서브넷 생성
  vpc_no = ncloud_vpc.exem-dsk-vpc.id
  subnet = "10.40.20.0/24"
  zone = "KR-2"
  subnet_type = "PUBLIC"
  name = "public-subnet"
  usage_type = "GEN"
  network_acl_no = ncloud_network_acl.exem-dsk-acl.id
}

resource "ncloud_subnet" "natgateway_subnet" { // NATGW용 퍼블릭 서브넷 생성
  vpc_no = ncloud_vpc.exem-dsk-vpc.id
  subnet = "10.40.30.0/24"
  zone = "KR-2"
  subnet_type = "PUBLIC"
  name = "natgateway-subnet"
  usage_type = "NATGW"
  network_acl_no = ncloud_network_acl.exem-dsk-acl.id
}

resource "ncloud_subnet" "loadbalancer_subnet" { // LoadBalancer용 퍼블릭 서브넷
  vpc_no = ncloud_vpc.exem-dsk-vpc.id
  subnet = "10.40.40.0/24"
  zone = "KR-2"
  subnet_type = "PRIVATE"
  name = "loadbalancer-subnet"
  usage_type = "LOADB"
  network_acl_no = ncloud_network_acl.exem-dsk-acl.id
}

resource "ncloud_nat_gateway" "exem-dsk-netgw" { //NATGW 생성
  vpc_no = ncloud_vpc.exem-dsk-vpc.id
  subnet_no = ncloud_subnet.natgateway_subnet.id
  zone = "KR-2"
  name = "exem-dsk-netgw"
}