[root@s22222 scenario01]# cd 4 [root@s22222 4]# clear [root@s22222 4]# ls *.tf main.tf variables.tf versions.tf [root@s22222 4]# [root@s22222 4]# [root@s22222 4]# more *.tf :::::::::::::: main.tf :::::::::::::: # VPC > User scenario > Scenario 1. Single Public Subnet # https://docs.ncloud.com/ko/networking/vpc/vpc_userscenario1.html provider "ncloud" { support_vpc = true region = "KR" access_key = var.access_key secret_key = var.secret_key } resource "ncloud_login_key" "key_vpc" { key_name = var.name_vpc } resource "ncloud_vpc" "vpc_vpc" { name = var.name_vpc ipv4_cidr_block = "10.0.0.0/21" } resource "ncloud_subnet" "subnet_pri1" { name = var.name_pri1 vpc_no = ncloud_vpc.vpc_vpc.id subnet = cidrsubnet(ncloud_vpc.vpc_vpc.ipv4_cidr_block,2 ,0 ) zone = "KR-1" network_acl_no = ncloud_vpc.vpc_vpc.default_network_acl_no subnet_type = "PRIVATE" // PUBLIC(Public) | PRIVATE(Private) } resource "ncloud_subnet" "subnet_pub1" { name = var.name_pub1 vpc_no = ncloud_vpc.vpc_vpc.id subnet = cidrsubnet(ncloud_vpc.vpc_vpc.ipv4_cidr_block,3 , 2) zone = "KR-1" network_acl_no = ncloud_vpc.vpc_vpc.default_network_acl_no subnet_type = "PUBLIC" // PUBLIC(Public) | PRIVATE(Private) } resource "ncloud_subnet" "subnet_pri-db1" { name = var.name_pri-db1 vpc_no = ncloud_vpc.vpc_vpc.id subnet = cidrsubnet(ncloud_vpc.vpc_vpc.ipv4_cidr_block,3 , 3) zone = "KR-1" network_acl_no = ncloud_vpc.vpc_vpc.default_network_acl_no subnet_type = "PRIVATE" // PUBLIC(Public) | PRIVATE(Private) } resource "ncloud_subnet" "subnet_pub-nat1" { name = var.name_pub-nat1 vpc_no = ncloud_vpc.vpc_vpc.id subnet = cidrsubnet(ncloud_vpc.vpc_vpc.ipv4_cidr_block,3 , 4) zone = "KR-1" network_acl_no = ncloud_vpc.vpc_vpc.default_network_acl_no subnet_type = "PUBLIC" usage_type = "NATGW" // PUBLIC(Public) | PRIVATE(Private) } resource "ncloud_subnet" "subnet_pub-lb1" { name = var.name_pub-lb1 vpc_no = ncloud_vpc.vpc_vpc.id subnet = cidrsubnet(ncloud_vpc.vpc_vpc.ipv4_cidr_block,3 , 5) zone = "KR-1" network_acl_no = ncloud_vpc.vpc_vpc.default_network_acl_no subnet_type = "PUBLIC" usage_type = "LOADB" // PUBLIC(Public) | PRIVATE(Private) } resource "ncloud_subnet" "subnet_pri-lb1" { name = var.name_pri-lb1 vpc_no = ncloud_vpc.vpc_vpc.id subnet = cidrsubnet(ncloud_vpc.vpc_vpc.ipv4_cidr_block,3 , 6) zone = "KR-1" network_acl_no = ncloud_vpc.vpc_vpc.default_network_acl_no subnet_type = "PRIVATE" // PUBLIC(Public) | PRIVATE(Private) usage_type = "LOADB" } :::::::::::::: variables.tf :::::::::::::: variable name_vpc { default = "agame-dev-vpc" } variable name_pri1 { default = "agame-dev-pri1" } variable name_pub1 { default = "agame-dev-pub1" } variable name_pri-db1 { default = "agame-dev-pri-db1" } variable name_pub-nat1 { default = "agame-dev-pub-nat1" } variable name_pub-lb1 { default = "agame-dev-pub-lb1" } variable name_pri-lb1 { default = "agame-dev-pri-lb1" } variable client_ip { default = "3.3.3.3" } variable access_key { default = "ncp_iam_BPAMKR5XsAr52VzPluqr" } variable secret_key { default = "ncp_iam_BPKMKR1DwyNq8NImKqZpe759MRZ3F6aeKD" } :::::::::::::: versions.tf :::::::::::::: terraform { required_providers { ncloud = { source = "navercloudplatform/ncloud" } } required_version = ">= 0.13" } [root@s22222 4]#