brunch

You can make anything
by writing

C.S.Lewis

by Master Seo Jan 07. 2024

네이버 17탄-3.테라폼-네트워크(참고)

<1> Private LB서브넷 추가하기




<1> Private LB서브넷 추가하기


cd /root/terraform-provider-ncloud-main/examples/nks


[root@sssssss nks]# ls

1  main.tf  variables.tf  versions.tf





[root@sssssss scenario02]# more subnet.tf

# Subnet

resource "ncloud_subnet" "subnet_scn_02_public" {

  name           = "${var.name_scn02}-public1"

  vpc_no         = ncloud_vpc.vpc_scn_02.id

  subnet         = cidrsubnet(ncloud_vpc.vpc_scn_02.ipv4_cidr_block, 8, 0)

  // "10.0.0.0/24"

  zone           = "KR-2"

  network_acl_no = ncloud_network_acl.network_acl_02_public.id

  subnet_type    = "PUBLIC"

  // PUBLIC(Public)

}

resource "ncloud_subnet" "subnet_scn_02_private" {

  name           = "${var.name_scn02}-private1"

  vpc_no         = ncloud_vpc.vpc_scn_02.id

  subnet         = cidrsubnet(ncloud_vpc.vpc_scn_02.ipv4_cidr_block, 8, 1)

  // "10.0.1.0/24"

  zone           = "KR-2"

  network_acl_no = ncloud_network_acl.network_acl_02_private.id

  subnet_type    = "PRIVATE"

  // PRIVATE(Private)

}

resource "ncloud_subnet" "subnet_scn_02_lb1" {

  name           = "${var.name_scn02}-lb1"

  vpc_no         = ncloud_vpc.vpc_scn_02.id

  subnet         = cidrsubnet(ncloud_vpc.vpc_scn_02.ipv4_cidr_block, 8, 3)

  // "10.0.3.0/24"

  zone           = "KR-2"

  network_acl_no = ncloud_network_acl.network_acl_02_private.id

  subnet_type    = "PRIVATE"

  usage_type    = "LOADB"

  // PRIVATE(Private)

}

resource "ncloud_subnet" "subnet_scn_02_public_natgw" {

  name           = "${var.name_scn02}-nat1"

  vpc_no         = ncloud_vpc.vpc_scn_02.id

  subnet         = cidrsubnet(ncloud_vpc.vpc_scn_02.ipv4_cidr_block, 8, 2)

  // "10.0.2.0/24"

  zone           = "KR-2"

  network_acl_no = ncloud_network_acl.network_acl_02_public.id

  subnet_type    = "PUBLIC"

  usage_type     = "NATGW"

}

[root@sssssss scenario02]#



terraform init

terraform plan

terraform apply -auto-approve







삭제

terraform destroy --auto-approve




참고 자료

https://registry.terraform.io/providers/NaverCloudPlatform/ncloud/latest/docs


감사합니다.

매거진의 이전글 네이버 17탄-2.테라폼-네트워크2
브런치는 최신 브라우저에 최적화 되어있습니다. IE chrome safari