resource "ncloud_route_table" "exem-dsk-rt-private" {
  vpc_no = ncloud_vpc.exem-dsk-vpc.id
  supported_subnet_type = "PRIVATE"
  name = "jh-test-cloud-rt-private"
}

resource "ncloud_route_table" "exem-dsk-rt-public" {
  vpc_no = ncloud_vpc.exem-dsk-vpc.id
  supported_subnet_type = "PUBLIC"
  name = "jh-test-cloud-rt-public"
}

resource "ncloud_route" "exem-dsk-route-gw" {
  route_table_no = ncloud_route_table.exem-dsk-rt-private.id
  destination_cidr_block = "0.0.0.0/0"
  target_type = "NATGW"
  target_name = ncloud_nat_gateway.exem-dsk-netgw.name
  target_no = ncloud_nat_gateway.exem-dsk-netgw.id
}

resource "ncloud_route_table_association" "exem-dsk-route-ass-private" {
  route_table_no = ncloud_route_table.exem-dsk-rt-private.id
  subnet_no = ncloud_subnet.exem-dsk-subnet.id
}

resource "ncloud_route_table_association" "exem-dsk-route-ass-lb" {
  route_table_no = ncloud_route_table.exem-dsk-rt-private.id
  subnet_no = ncloud_subnet.loadbalancer_subnet.id
}

resource "ncloud_route_table_association" "exem-dsk-route-ass-public" {
  route_table_no = ncloud_route_table.exem-dsk-rt-public.id
  subnet_no = ncloud_subnet.exem-dsk-subnet-public.id
}

resource "ncloud_route_table_association" "exem-dsk-route-ass-natgw" {
  route_table_no = ncloud_route_table.exem-dsk-rt-public.id
  subnet_no = ncloud_subnet.natgateway_subnet.id
}