[Terraform - NaverCloud vm생성] part 2

vm생성  part1에 이어 terraform을 실행해보겠습니다.

https://jhdatabase.tistory.com/87

 

[Terraform - NaverCloud vm생성] part 1

Terraform 이란, 테라폼(Terraform)은 Hashicorp에서 오픈소스로 개발 중인 클라우드 인프라스트럭처 자동화를 지향하는 코드로서의 Infrastructure as Code, IaC 도구입니다. AWS, Azure, GCP 등 여러 cloud 플랫..

jhdatabase.tistory.com

 

 

■ Terraform init 
Terraform provider로 ncloud 등록
[root@terraform ~]# terraform init
 

init 성공시 아래와 같은 로그들 확인 가능

 

 

■ Terraform plan 
선언한 리소스에 대한 변경 내용 확인
[root@terraform ~]# terraform plan
ncloud_access_control_group.web_acg: Refreshing state... [id=51460]
ncloud_network_acl.was_acl: Refreshing state... [id=33022]
ncloud_access_control_group.was_acg: Refreshing state... [id=51459]
ncloud_network_acl.db_acl: Refreshing state... [id=33021]
ncloud_network_acl.web_acl: Refreshing state... [id=33020]
ncloud_access_control_group.db_acg: Refreshing state... [id=51458]
ncloud_access_control_group_rule.db_acg-rule: Refreshing state... [id=51458]
ncloud_subnet.db_subnet: Refreshing state... [id=45628]
ncloud_access_control_group_rule.web_acg-rule: Refreshing state... [id=51460]
ncloud_network_interface.nic_db[0]: Refreshing state... [id=748700]
ncloud_subnet.was_subnet: Refreshing state... [id=45629]
ncloud_subnet.web_subnet: Refreshing state... [id=45627]
ncloud_access_control_group_rule.was_acg-rule: Refreshing state... [id=51459]
ncloud_network_interface.nic_web[0]: Refreshing state... [id=748699]
ncloud_network_interface.nic_was[0]: Refreshing state... [id=748701]

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create
<= read (data resources)

Terraform will perform the following actions:

  # data.ncloud_root_password.db_pwd[0] will be read during apply
  # (config refers to values not yet known)
<= data "ncloud_root_password" "db_pwd"  {
      + id                 = (known after apply)
      + private_key        = (sensitive value)
      + root_password      = (sensitive value)
      + server_instance_no = (known after apply)
    }

  # data.ncloud_root_password.was_pwd[0] will be read during apply
  # (config refers to values not yet known)
<= data "ncloud_root_password" "was_pwd"  {
      + id                 = (known after apply)
      + private_key        = (sensitive value)
      + root_password      = (sensitive value)
      + server_instance_no = (known after apply)
    }

  # data.ncloud_root_password.web_pwd[0] will be read during apply
  # (config refers to values not yet known)
<= data "ncloud_root_password" "web_pwd"  {
      + id                 = (known after apply)
      + private_key        = (sensitive value)
      + root_password      = (sensitive value)
      + server_instance_no = (known after apply)
    }

  # ncloud_login_key.key will be created
  + resource "ncloud_login_key" "key" {
      + fingerprint = (known after apply)
      + id          = (known after apply)
      + key_name    = "jeonghyun"
      + private_key = (sensitive value)
    }

  # ncloud_public_ip.pi[0] will be created
  + resource "ncloud_public_ip" "pi" {
      + description        = "terra-IP"
      + id                 = (known after apply)
      + instance_no        = (known after apply)
      + internet_line_type = (known after apply)
      + kind_type          = (known after apply)
      + public_ip          = (known after apply)
      + public_ip_no       = (known after apply)
      + server_instance_no = (known after apply)
      + zone               = (known after apply)
    }

  # ncloud_server.server_db[0] will be created
  + resource "ncloud_server" "server_db" {
      + base_block_storage_disk_detail_type    = (known after apply)
      + base_block_storage_disk_type           = (known after apply)
      + base_block_storage_size                = (known after apply)
      + cpu_count                              = (known after apply)
      + description                            = "terraform-vm-1 is best tip!!"
      + id                                     = (known after apply)
      + init_script_no                         = (known after apply)
      + instance_no                            = (known after apply)
      + internet_line_type                     = (known after apply)
      + is_encrypted_base_block_storage_volume = (known after apply)
      + is_fee_charging_monitoring             = (known after apply)
      + is_protect_server_termination          = (known after apply)
      + login_key_name                         = "jeonghyun"
      + memory_size                            = (known after apply)
      + name                                   = "ncloud-terraform-db-vm-1"
      + placement_group_no                     = (known after apply)
      + platform_type                          = (known after apply)
      + port_forwarding_external_port          = (known after apply)
      + port_forwarding_internal_port          = (known after apply)
      + port_forwarding_public_ip              = (known after apply)
      + private_ip                             = (known after apply)
      + public_ip                              = (known after apply)
      + region                                 = (known after apply)
      + server_image_name                      = (known after apply)
      + server_image_product_code              = "SW.VSVR.OS.LNX64.CNTOS.0703.B050"
      + server_product_code                    = "SVR.VSVR.HICPU.C002.M004.NET.HDD.B050.G002"
      + subnet_no                              = "45628"
      + vpc_no                                 = (known after apply)
      + zone                                   = (known after apply)

      + network_interface {
          + network_interface_no = "748700"
          + order                = 0
          + private_ip           = (known after apply)
          + subnet_no            = (known after apply)
        }
    }

  # ncloud_server.server_was[0] will be created
  + resource "ncloud_server" "server_was" {
      + base_block_storage_disk_detail_type    = (known after apply)
      + base_block_storage_disk_type           = (known after apply)
      + base_block_storage_size                = (known after apply)
      + cpu_count                              = (known after apply)
      + description                            = "terraform-vm-1 is best tip!!"
      + id                                     = (known after apply)
      + init_script_no                         = (known after apply)
      + instance_no                            = (known after apply)
      + internet_line_type                     = (known after apply)
      + is_encrypted_base_block_storage_volume = (known after apply)
      + is_fee_charging_monitoring             = (known after apply)
      + is_protect_server_termination          = (known after apply)
      + login_key_name                         = "jeonghyun"
      + memory_size                            = (known after apply)
      + name                                   = "ncloud-terraform-was-vm-1"
      + placement_group_no                     = (known after apply)
      + platform_type                          = (known after apply)
      + port_forwarding_external_port          = (known after apply)
      + port_forwarding_internal_port          = (known after apply)
      + port_forwarding_public_ip              = (known after apply)
      + private_ip                             = (known after apply)
      + public_ip                              = (known after apply)
      + region                                 = (known after apply)
      + server_image_name                      = (known after apply)
      + server_image_product_code              = "SW.VSVR.OS.LNX64.CNTOS.0703.B050"
      + server_product_code                    = "SVR.VSVR.HICPU.C002.M004.NET.HDD.B050.G002"
      + subnet_no                              = "45629"
      + vpc_no                                 = (known after apply)
      + zone                                   = (known after apply)

      + network_interface {
          + network_interface_no = "748701"
          + order                = 0
          + private_ip           = (known after apply)
          + subnet_no            = (known after apply)
        }
    }

  # ncloud_server.server_web[0] will be created
  + resource "ncloud_server" "server_web" {
      + base_block_storage_disk_detail_type    = (known after apply)
      + base_block_storage_disk_type           = (known after apply)
      + base_block_storage_size                = (known after apply)
      + cpu_count                              = (known after apply)
      + description                            = "terraform-vm-1 is best tip!!"
      + id                                     = (known after apply)
      + init_script_no                         = (known after apply)
      + instance_no                            = (known after apply)
      + internet_line_type                     = (known after apply)
      + is_encrypted_base_block_storage_volume = (known after apply)
      + is_fee_charging_monitoring             = (known after apply)
      + is_protect_server_termination          = (known after apply)
      + login_key_name                         = "jeonghyun"
      + memory_size                            = (known after apply)
      + name                                   = "ncloud-terraform-web-vm-1"
      + placement_group_no                     = (known after apply)
      + platform_type                          = (known after apply)
      + port_forwarding_external_port          = (known after apply)
      + port_forwarding_internal_port          = (known after apply)
      + port_forwarding_public_ip              = (known after apply)
      + private_ip                             = (known after apply)
      + public_ip                              = (known after apply)
      + region                                 = (known after apply)
      + server_image_name                      = (known after apply)
      + server_image_product_code              = "SW.VSVR.OS.LNX64.CNTOS.0703.B050"
      + server_product_code                    = "SVR.VSVR.HICPU.C002.M004.NET.HDD.B050.G002"
      + subnet_no                              = "45627"
      + vpc_no                                 = (known after apply)
      + zone                                   = (known after apply)

      + network_interface {
          + network_interface_no = "748699"
          + order                = 0
          + private_ip           = (known after apply)
          + subnet_no            = (known after apply)
        }
    }

Plan: 5 to add, 0 to change, 0 to destroy.

------------------------------------------------------------------------

Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.
 
 
■ Terraform apply 
서버 생성 실행
[root@terraform ~]# terraform apply
ncloud_access_control_group.web_acg: Refreshing state... [id=51460]
ncloud_access_control_group.db_acg: Refreshing state... [id=51458]
ncloud_network_acl.was_acl: Refreshing state... [id=33022]
ncloud_network_acl.web_acl: Refreshing state... [id=33020]
ncloud_access_control_group.was_acg: Refreshing state... [id=51459]
ncloud_network_acl.db_acl: Refreshing state... [id=33021]
ncloud_access_control_group_rule.db_acg-rule: Refreshing state... [id=51458]
ncloud_subnet.db_subnet: Refreshing state... [id=45628]
ncloud_subnet.web_subnet: Refreshing state... [id=45627]
ncloud_subnet.was_subnet: Refreshing state... [id=45629]
ncloud_access_control_group_rule.web_acg-rule: Refreshing state... [id=51460]
ncloud_access_control_group_rule.was_acg-rule: Refreshing state... [id=51459]
ncloud_network_interface.nic_was[0]: Refreshing state... [id=748701]
ncloud_network_interface.nic_db[0]: Refreshing state... [id=748700]
ncloud_network_interface.nic_web[0]: Refreshing state... [id=748699]

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create
<= read (data resources)

Terraform will perform the following actions:

  # data.ncloud_root_password.db_pwd[0] will be read during apply
  # (config refers to values not yet known)
<= data "ncloud_root_password" "db_pwd"  {
      + id                 = (known after apply)
      + private_key        = (sensitive value)
      + root_password      = (sensitive value)
      + server_instance_no = (known after apply)
    }

  # data.ncloud_root_password.was_pwd[0] will be read during apply
  # (config refers to values not yet known)
<= data "ncloud_root_password" "was_pwd"  {
      + id                 = (known after apply)
      + private_key        = (sensitive value)
      + root_password      = (sensitive value)
      + server_instance_no = (known after apply)
    }

  # data.ncloud_root_password.web_pwd[0] will be read during apply
  # (config refers to values not yet known)
<= data "ncloud_root_password" "web_pwd"  {
      + id                 = (known after apply)
      + private_key        = (sensitive value)
      + root_password      = (sensitive value)
      + server_instance_no = (known after apply)
    }

  # ncloud_login_key.key will be created
  + resource "ncloud_login_key" "key" {
      + fingerprint = (known after apply)
      + id          = (known after apply)
      + key_name    = "new"
      + private_key = (sensitive value)
    }

  # ncloud_public_ip.pi[0] will be created
  + resource "ncloud_public_ip" "pi" {
      + description        = "terra-IP"
      + id                 = (known after apply)
      + instance_no        = (known after apply)
      + internet_line_type = (known after apply)
      + kind_type          = (known after apply)
      + public_ip          = (known after apply)
      + public_ip_no       = (known after apply)
      + server_instance_no = (known after apply)
      + zone               = (known after apply)
    }

  # ncloud_server.server_db[0] will be created
  + resource "ncloud_server" "server_db" {
      + base_block_storage_disk_detail_type    = (known after apply)
      + base_block_storage_disk_type           = (known after apply)
      + base_block_storage_size                = (known after apply)
      + cpu_count                              = (known after apply)
      + description                            = "terraform-vm-1 is best tip!!"
      + id                                     = (known after apply)
      + init_script_no                         = (known after apply)
      + instance_no                            = (known after apply)
      + internet_line_type                     = (known after apply)
      + is_encrypted_base_block_storage_volume = (known after apply)
      + is_fee_charging_monitoring             = (known after apply)
      + is_protect_server_termination          = (known after apply)
      + login_key_name                         = "new"
      + memory_size                            = (known after apply)
      + name                                   = "ncloud-terraform-db-vm-1"
      + placement_group_no                     = (known after apply)
      + platform_type                          = (known after apply)
      + port_forwarding_external_port          = (known after apply)
      + port_forwarding_internal_port          = (known after apply)
      + port_forwarding_public_ip              = (known after apply)
      + private_ip                             = (known after apply)
      + public_ip                              = (known after apply)
      + region                                 = (known after apply)
      + server_image_name                      = (known after apply)
      + server_image_product_code              = "SW.VSVR.OS.LNX64.CNTOS.0703.B050"
      + server_product_code                    = "SVR.VSVR.HICPU.C002.M004.NET.HDD.B050.G002"
      + subnet_no                              = "45628"
      + vpc_no                                 = (known after apply)
      + zone                                   = (known after apply)

      + network_interface {
          + network_interface_no = "748700"
          + order                = 0
          + private_ip           = (known after apply)
          + subnet_no            = (known after apply)
        }
    }

  # ncloud_server.server_was[0] will be created
  + resource "ncloud_server" "server_was" {
      + base_block_storage_disk_detail_type    = (known after apply)
      + base_block_storage_disk_type           = (known after apply)
      + base_block_storage_size                = (known after apply)
      + cpu_count                              = (known after apply)
      + description                            = "terraform-vm-1 is best tip!!"
      + id                                     = (known after apply)
      + init_script_no                         = (known after apply)
      + instance_no                            = (known after apply)
      + internet_line_type                     = (known after apply)
      + is_encrypted_base_block_storage_volume = (known after apply)
      + is_fee_charging_monitoring             = (known after apply)
      + is_protect_server_termination          = (known after apply)
      + login_key_name                         = "new"
      + memory_size                            = (known after apply)
      + name                                   = "ncloud-terraform-was-vm-1"
      + placement_group_no                     = (known after apply)
      + platform_type                          = (known after apply)
      + port_forwarding_external_port          = (known after apply)
      + port_forwarding_internal_port          = (known after apply)
      + port_forwarding_public_ip              = (known after apply)
      + private_ip                             = (known after apply)
      + public_ip                              = (known after apply)
      + region                                 = (known after apply)
      + server_image_name                      = (known after apply)
      + server_image_product_code              = "SW.VSVR.OS.LNX64.CNTOS.0703.B050"
      + server_product_code                    = "SVR.VSVR.HICPU.C002.M004.NET.HDD.B050.G002"
      + subnet_no                              = "45629"
      + vpc_no                                 = (known after apply)
      + zone                                   = (known after apply)

      + network_interface {
          + network_interface_no = "748701"
          + order                = 0
          + private_ip           = (known after apply)
          + subnet_no            = (known after apply)
        }
    }

  # ncloud_server.server_web[0] will be created
  + resource "ncloud_server" "server_web" {
      + base_block_storage_disk_detail_type    = (known after apply)
      + base_block_storage_disk_type           = (known after apply)
      + base_block_storage_size                = (known after apply)
      + cpu_count                              = (known after apply)
      + description                            = "terraform-vm-1 is best tip!!"
      + id                                     = (known after apply)
      + init_script_no                         = (known after apply)
      + instance_no                            = (known after apply)
      + internet_line_type                     = (known after apply)
      + is_encrypted_base_block_storage_volume = (known after apply)
      + is_fee_charging_monitoring             = (known after apply)
      + is_protect_server_termination          = (known after apply)
      + login_key_name                         = "new"
      + memory_size                            = (known after apply)
      + name                                   = "ncloud-terraform-web-vm-1"
      + placement_group_no                     = (known after apply)
      + platform_type                          = (known after apply)
      + port_forwarding_external_port          = (known after apply)
      + port_forwarding_internal_port          = (known after apply)
      + port_forwarding_public_ip              = (known after apply)
      + private_ip                             = (known after apply)
      + public_ip                              = (known after apply)
      + region                                 = (known after apply)
      + server_image_name                      = (known after apply)
      + server_image_product_code              = "SW.VSVR.OS.LNX64.CNTOS.0703.B050"
      + server_product_code                    = "SVR.VSVR.HICPU.C002.M004.NET.HDD.B050.G002"
      + subnet_no                              = "45627"
      + vpc_no                                 = (known after apply)
      + zone                                   = (known after apply)

      + network_interface {
          + network_interface_no = "748699"
          + order                = 0
          + private_ip           = (known after apply)
          + subnet_no            = (known after apply)
        }
    }

Plan: 5 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

ncloud_login_key.key: Creating...
ncloud_login_key.key: Creation complete after 1s [id=new]
ncloud_server.server_web[0]: Creating...
ncloud_server.server_db[0]: Creating...
ncloud_server.server_was[0]: Creating...
ncloud_server.server_web[0]: Still creating... [10s elapsed]
ncloud_server.server_db[0]: Still creating... [10s elapsed]
ncloud_server.server_was[0]: Still creating... [10s elapsed]
ncloud_server.server_web[0]: Still creating... [20s elapsed]
ncloud_server.server_db[0]: Still creating... [20s elapsed]
ncloud_server.server_was[0]: Still creating... [20s elapsed]
ncloud_server.server_web[0]: Still creating... [30s elapsed]
ncloud_server.server_db[0]: Still creating... [30s elapsed]
ncloud_server.server_was[0]: Still creating... [30s elapsed]
ncloud_server.server_web[0]: Still creating... [40s elapsed]
ncloud_server.server_db[0]: Still creating... [40s elapsed]
ncloud_server.server_was[0]: Still creating... [40s elapsed]
ncloud_server.server_web[0]: Still creating... [50s elapsed]
ncloud_server.server_db[0]: Still creating... [50s elapsed]
ncloud_server.server_was[0]: Still creating... [50s elapsed]
ncloud_server.server_web[0]: Still creating... [1m0s elapsed]
ncloud_server.server_db[0]: Still creating... [1m0s elapsed]
ncloud_server.server_was[0]: Still creating... [1m0s elapsed]
ncloud_server.server_web[0]: Still creating... [1m10s elapsed]
ncloud_server.server_db[0]: Still creating... [1m10s elapsed]
ncloud_server.server_was[0]: Still creating... [1m10s elapsed]
ncloud_server.server_web[0]: Still creating... [1m20s elapsed]
ncloud_server.server_db[0]: Still creating... [1m20s elapsed]
ncloud_server.server_was[0]: Still creating... [1m20s elapsed]
ncloud_server.server_web[0]: Still creating... [1m30s elapsed]
ncloud_server.server_db[0]: Still creating... [1m30s elapsed]
ncloud_server.server_was[0]: Still creating... [1m30s elapsed]
ncloud_server.server_web[0]: Still creating... [1m40s elapsed]
ncloud_server.server_db[0]: Still creating... [1m40s elapsed]
ncloud_server.server_was[0]: Still creating... [1m40s elapsed]
ncloud_server.server_web[0]: Still creating... [1m50s elapsed]
ncloud_server.server_db[0]: Still creating... [1m50s elapsed]
ncloud_server.server_was[0]: Still creating... [1m50s elapsed]
ncloud_server.server_web[0]: Still creating... [2m0s elapsed]
ncloud_server.server_db[0]: Still creating... [2m0s elapsed]
ncloud_server.server_was[0]: Still creating... [2m0s elapsed]
ncloud_server.server_web[0]: Still creating... [2m10s elapsed]
ncloud_server.server_db[0]: Still creating... [2m10s elapsed]
ncloud_server.server_was[0]: Still creating... [2m10s elapsed]
ncloud_server.server_web[0]: Still creating... [2m20s elapsed]
ncloud_server.server_db[0]: Still creating... [2m20s elapsed]
ncloud_server.server_was[0]: Still creating... [2m20s elapsed]
ncloud_server.server_web[0]: Still creating... [2m30s elapsed]
ncloud_server.server_db[0]: Still creating... [2m30s elapsed]
ncloud_server.server_was[0]: Still creating... [2m30s elapsed]
ncloud_server.server_web[0]: Still creating... [2m40s elapsed]
ncloud_server.server_db[0]: Still creating... [2m40s elapsed]
ncloud_server.server_was[0]: Still creating... [2m40s elapsed]
ncloud_server.server_web[0]: Still creating... [2m50s elapsed]
ncloud_server.server_db[0]: Still creating... [2m50s elapsed]
ncloud_server.server_was[0]: Still creating... [2m50s elapsed]
ncloud_server.server_web[0]: Still creating... [3m0s elapsed]
ncloud_server.server_db[0]: Still creating... [3m0s elapsed]
ncloud_server.server_was[0]: Still creating... [3m0s elapsed]
ncloud_server.server_web[0]: Still creating... [3m10s elapsed]
ncloud_server.server_db[0]: Still creating... [3m10s elapsed]
ncloud_server.server_was[0]: Still creating... [3m10s elapsed]
ncloud_server.server_db[0]: Creation complete after 3m16s [id=11289381]
data.ncloud_root_password.db_pwd[0]: Reading...
ncloud_server.server_web[0]: Creation complete after 3m16s [id=11289375]
data.ncloud_root_password.web_pwd[0]: Reading...
ncloud_public_ip.pi[0]: Creating...
data.ncloud_root_password.db_pwd[0]: Read complete after 0s [id=11289381]
data.ncloud_root_password.web_pwd[0]: Read complete after 0s [id=11289375]
ncloud_public_ip.pi[0]: Creation complete after 2s [id=11289402]
ncloud_server.server_was[0]: Still creating... [3m20s elapsed]
ncloud_server.server_was[0]: Creation complete after 3m26s [id=11289378]
data.ncloud_root_password.was_pwd[0]: Reading...
data.ncloud_root_password.was_pwd[0]: Read complete after 0s [id=11289378]

Apply complete! Resources: 5 added, 0 changed, 0 destroyed.
 

 

■ 생성 확인
일반 VM으로 생성하였지만 설정한 리소스와 비교하기 위해 각 서버 설정사항을 확인.
 
 
1.WEB 서버
web서버에만 public ip생성.

 

2. WAS 서버

 
3. DB서버

 

※ Terraform destroy
생성한 서버 삭제
[root@terraform ~]# terraform destroy

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  - destroy

Terraform will perform the following actions:

  # ncloud_access_control_group.db_acg will be destroyed
  - resource "ncloud_access_control_group" "db_acg" {
      - access_control_group_no = "51458" -> null
      - description             = "description" -> null
      - id                      = "51458" -> null
      - is_default              = false -> null
      - name                    = "db-acg" -> null
      - vpc_no                  = "16825" -> null
    }

  # ncloud_access_control_group.was_acg will be destroyed
  - resource "ncloud_access_control_group" "was_acg" {
      - access_control_group_no = "51459" -> null
      - description             = "description" -> null
      - id                      = "51459" -> null
      - is_default              = false -> null
      - name                    = "was-acg" -> null
      - vpc_no                  = "16825" -> null
    }

  # ncloud_access_control_group.web_acg will be destroyed
  - resource "ncloud_access_control_group" "web_acg" {
      - access_control_group_no = "51460" -> null
      - description             = "description" -> null
      - id                      = "51460" -> null
      - is_default              = false -> null
      - name                    = "web-acg" -> null
      - vpc_no                  = "16825" -> null
    }

  # ncloud_access_control_group_rule.db_acg-rule will be destroyed
  - resource "ncloud_access_control_group_rule" "db_acg-rule" {
      - access_control_group_no = "51458" -> null
      - id                      = "51458" -> null
      - inbound                 = [
          - {
              - description                    = "accept 22 port"
              - ip_block                       = "0.0.0.0/0"
              - port_range                     = "22"
              - protocol                       = "TCP"
              - source_access_control_group_no = ""
            },
          - {
              - description                    = "accept 3306 port"
              - ip_block                       = "0.0.0.0/0"
              - port_range                     = "3306"
              - protocol                       = "TCP"
              - source_access_control_group_no = ""
            },
          - {
              - description                    = "accept 8080 port"
              - ip_block                       = "0.0.0.0/0"
              - port_range                     = "8080"
              - protocol                       = "TCP"
              - source_access_control_group_no = ""
            },
        ] -> null
      - outbound                = [
          - {
              - description                    = "accept 1-65535 port"
              - ip_block                       = "0.0.0.0/0"
              - port_range                     = "1-65535"
              - protocol                       = "TCP"
              - source_access_control_group_no = ""
            },
        ] -> null
    }

  # ncloud_access_control_group_rule.was_acg-rule will be destroyed
  - resource "ncloud_access_control_group_rule" "was_acg-rule" {
      - access_control_group_no = "51459" -> null
      - id                      = "51459" -> null
      - inbound                 = [
          - {
              - description                    = "accept 22 port"
              - ip_block                       = "0.0.0.0/0"
              - port_range                     = "22"
              - protocol                       = "TCP"
              - source_access_control_group_no = ""
            },
          - {
              - description                    = "accept 80 port"
              - ip_block                       = "0.0.0.0/0"
              - port_range                     = "80"
              - protocol                       = "TCP"
              - source_access_control_group_no = ""
            },
          - {
              - description                    = "accept 8080 port"
              - ip_block                       = "0.0.0.0/0"
              - port_range                     = "8080"
              - protocol                       = "TCP"
              - source_access_control_group_no = ""
            },
        ] -> null
      - outbound                = [
          - {
              - description                    = "accept 1-65535 port"
              - ip_block                       = "0.0.0.0/0"
              - port_range                     = "1-65535"
              - protocol                       = "TCP"
              - source_access_control_group_no = ""
            },
        ] -> null
    }

  # ncloud_access_control_group_rule.web_acg-rule will be destroyed
  - resource "ncloud_access_control_group_rule" "web_acg-rule" {
      - access_control_group_no = "51460" -> null
      - id                      = "51460" -> null
      - inbound                 = [
          - {
              - description                    = "accept 22 port"
              - ip_block                       = "0.0.0.0/0"
              - port_range                     = "22"
              - protocol                       = "TCP"
              - source_access_control_group_no = ""
            },
          - {
              - description                    = "accept 443 port"
              - ip_block                       = "0.0.0.0/0"
              - port_range                     = "443"
              - protocol                       = "TCP"
              - source_access_control_group_no = ""
            },
          - {
              - description                    = "accept 80 port"
              - ip_block                       = "0.0.0.0/0"
              - port_range                     = "80"
              - protocol                       = "TCP"
              - source_access_control_group_no = ""
            },
        ] -> null
      - outbound                = [
          - {
              - description                    = "accept 1-65535 port"
              - ip_block                       = "0.0.0.0/0"
              - port_range                     = "1-65535"
              - protocol                       = "TCP"
              - source_access_control_group_no = ""
            },
        ] -> null
    }

  # ncloud_login_key.key will be destroyed
  - resource "ncloud_login_key" "key" {
      - fingerprint = "da:d5:c4:53:d3:58:8f:42:2a:0f:27:fc:57:7a:98:31" -> null
      - id          = "new" -> null
      - key_name    = "new" -> null
      - private_key = (sensitive value)
    }

  # ncloud_network_acl.db_acl will be destroyed
  - resource "ncloud_network_acl" "db_acl" {
      - description    = "for test" -> null
      - id             = "33021" -> null
      - is_default     = false -> null
      - name           = "db-acl" -> null
      - network_acl_no = "33021" -> null
      - vpc_no         = "16825" -> null
    }

  # ncloud_network_acl.was_acl will be destroyed
  - resource "ncloud_network_acl" "was_acl" {
      - description    = "for test" -> null
      - id             = "33022" -> null
      - is_default     = false -> null
      - name           = "was-acl" -> null
      - network_acl_no = "33022" -> null
      - vpc_no         = "16825" -> null
    }

  # ncloud_network_acl.web_acl will be destroyed
  - resource "ncloud_network_acl" "web_acl" {
      - description    = "for test" -> null
      - id             = "33020" -> null
      - is_default     = false -> null
      - name           = "web-acl" -> null
      - network_acl_no = "33020" -> null
      - vpc_no         = "16825" -> null
    }

  # ncloud_network_interface.nic_db[0] will be destroyed
  - resource "ncloud_network_interface" "nic_db" {
      - access_control_groups = [
          - "51458",
        ] -> null
      - id                    = "748700" -> null
      - is_default            = false -> null
      - name                  = "terra-db-nic-1" -> null
      - network_interface_no  = "748700" -> null
      - private_ip            = "10.0.40.100" -> null
      - status                = "NOTUSED" -> null
      - subnet_no             = "45628" -> null
    }

  # ncloud_network_interface.nic_was[0] will be destroyed
  - resource "ncloud_network_interface" "nic_was" {
      - access_control_groups = [
          - "51459",
        ] -> null
      - id                    = "748701" -> null
      - is_default            = false -> null
      - name                  = "terra-was-nic-1" -> null
      - network_interface_no  = "748701" -> null
      - private_ip            = "10.0.30.100" -> null
      - status                = "NOTUSED" -> null
      - subnet_no             = "45629" -> null
    }

  # ncloud_network_interface.nic_web[0] will be destroyed
  - resource "ncloud_network_interface" "nic_web" {
      - access_control_groups = [
          - "51460",
        ] -> null
      - id                    = "748699" -> null
      - is_default            = false -> null
      - name                  = "terra-web-nic-1" -> null
      - network_interface_no  = "748699" -> null
      - private_ip            = "10.0.20.100" -> null
      - status                = "NOTUSED" -> null
      - subnet_no             = "45627" -> null
    }

  # ncloud_public_ip.pi[0] will be destroyed
  - resource "ncloud_public_ip" "pi" {
      - description        = "terra-IP" -> null
      - id                 = "11289402" -> null
      - instance_no        = "11289402" -> null
      - public_ip          = "175.45.193.214" -> null
      - public_ip_no       = "11289402" -> null
      - server_instance_no = "11289375" -> null
    }

  # ncloud_server.server_db[0] will be destroyed
  - resource "ncloud_server" "server_db" {
      - base_block_storage_disk_detail_type = "HDD" -> null
      - base_block_storage_disk_type        = "NET" -> null
      - cpu_count                           = 2 -> null
      - description                         = "terraform-vm-1 is best tip!!" -> null
      - id                                  = "11289381" -> null
      - instance_no                         = "11289381" -> null
      - is_protect_server_termination       = false -> null
      - login_key_name                      = "new" -> null
      - memory_size                         = 4294967296 -> null
      - name                                = "ncloud-terraform-db-vm-1" -> null
      - platform_type                       = "LNX64" -> null
      - server_image_product_code           = "SW.VSVR.OS.LNX64.CNTOS.0703.B050" -> null
      - server_product_code                 = "SVR.VSVR.HICPU.C002.M004.NET.HDD.B050.G002" -> null
      - subnet_no                           = "45628" -> null
      - vpc_no                              = "16825" -> null
      - zone                                = "KR-2" -> null

      - network_interface {
          - network_interface_no = "748700" -> null
          - order                = 0 -> null
          - private_ip           = "10.0.40.100" -> null
          - subnet_no            = "45628" -> null
        }
    }

  # ncloud_server.server_was[0] will be destroyed
  - resource "ncloud_server" "server_was" {
      - base_block_storage_disk_detail_type = "HDD" -> null
      - base_block_storage_disk_type        = "NET" -> null
      - cpu_count                           = 2 -> null
      - description                         = "terraform-vm-1 is best tip!!" -> null
      - id                                  = "11289378" -> null
      - instance_no                         = "11289378" -> null
      - is_protect_server_termination       = false -> null
      - login_key_name                      = "new" -> null
      - memory_size                         = 4294967296 -> null
      - name                                = "ncloud-terraform-was-vm-1" -> null
      - platform_type                       = "LNX64" -> null
      - server_image_product_code           = "SW.VSVR.OS.LNX64.CNTOS.0703.B050" -> null
      - server_product_code                 = "SVR.VSVR.HICPU.C002.M004.NET.HDD.B050.G002" -> null
      - subnet_no                           = "45629" -> null
      - vpc_no                              = "16825" -> null
      - zone                                = "KR-2" -> null

      - network_interface {
          - network_interface_no = "748701" -> null
          - order                = 0 -> null
          - private_ip           = "10.0.30.100" -> null
          - subnet_no            = "45629" -> null
        }
    }

  # ncloud_server.server_web[0] will be destroyed
  - resource "ncloud_server" "server_web" {
      - base_block_storage_disk_detail_type = "HDD" -> null
      - base_block_storage_disk_type        = "NET" -> null
      - cpu_count                           = 2 -> null
      - description                         = "terraform-vm-1 is best tip!!" -> null
      - id                                  = "11289375" -> null
      - instance_no                         = "11289375" -> null
      - is_protect_server_termination       = false -> null
      - login_key_name                      = "new" -> null
      - memory_size                         = 4294967296 -> null
      - name                                = "ncloud-terraform-web-vm-1" -> null
      - platform_type                       = "LNX64" -> null
      - server_image_product_code           = "SW.VSVR.OS.LNX64.CNTOS.0703.B050" -> null
      - server_product_code                 = "SVR.VSVR.HICPU.C002.M004.NET.HDD.B050.G002" -> null
      - subnet_no                           = "45627" -> null
      - vpc_no                              = "16825" -> null
      - zone                                = "KR-2" -> null

      - network_interface {
          - network_interface_no = "748699" -> null
          - order                = 0 -> null
          - private_ip           = "10.0.20.100" -> null
          - subnet_no            = "45627" -> null
        }
    }

  # ncloud_subnet.db_subnet will be destroyed
  - resource "ncloud_subnet" "db_subnet" {
      - id             = "45628" -> null
      - name           = "terraform-db" -> null
      - network_acl_no = "33021" -> null
      - subnet         = "10.0.40.0/24" -> null
      - subnet_no      = "45628" -> null
      - subnet_type    = "PRIVATE" -> null
      - usage_type     = "GEN" -> null
      - vpc_no         = "16825" -> null
      - zone           = "KR-2" -> null
    }

  # ncloud_subnet.was_subnet will be destroyed
  - resource "ncloud_subnet" "was_subnet" {
      - id             = "45629" -> null
      - name           = "terraform-was" -> null
      - network_acl_no = "33022" -> null
      - subnet         = "10.0.30.0/24" -> null
      - subnet_no      = "45629" -> null
      - subnet_type    = "PRIVATE" -> null
      - usage_type     = "GEN" -> null
      - vpc_no         = "16825" -> null
      - zone           = "KR-2" -> null
    }

  # ncloud_subnet.web_subnet will be destroyed
  - resource "ncloud_subnet" "web_subnet" {
      - id             = "45627" -> null
      - name           = "terraform-web" -> null
      - network_acl_no = "33020" -> null
      - subnet         = "10.0.20.0/24" -> null
      - subnet_no      = "45627" -> null
      - subnet_type    = "PUBLIC" -> null
      - usage_type     = "GEN" -> null
      - vpc_no         = "16825" -> null
      - zone           = "KR-2" -> null
    }

Plan: 0 to add, 0 to change, 20 to destroy.

Do you really want to destroy all resources?
  Terraform will destroy all your managed infrastructure, as shown above.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes

ncloud_access_control_group_rule.db_acg-rule: Destroying... [id=51458]
ncloud_server.server_db[0]: Destroying... [id=11289381]
ncloud_access_control_group_rule.web_acg-rule: Destroying... [id=51460]
ncloud_server.server_was[0]: Destroying... [id=11289378]
ncloud_access_control_group_rule.was_acg-rule: Destroying... [id=51459]
ncloud_public_ip.pi[0]: Destroying... [id=11289402]
ncloud_public_ip.pi[0]: Destruction complete after 5s
ncloud_server.server_web[0]: Destroying... [id=11289375]
ncloud_access_control_group_rule.db_acg-rule: Still destroying... [id=51458, 10s elapsed]
ncloud_server.server_db[0]: Still destroying... [id=11289381, 10s elapsed]
ncloud_access_control_group_rule.web_acg-rule: Still destroying... [id=51460, 10s elapsed]
ncloud_server.server_was[0]: Still destroying... [id=11289378, 10s elapsed]
ncloud_access_control_group_rule.was_acg-rule: Still destroying... [id=51459, 10s elapsed]
ncloud_server.server_web[0]: Still destroying... [id=11289375, 10s elapsed]
ncloud_access_control_group_rule.db_acg-rule: Still destroying... [id=51458, 20s elapsed]
ncloud_server.server_db[0]: Still destroying... [id=11289381, 20s elapsed]
ncloud_access_control_group_rule.web_acg-rule: Still destroying... [id=51460, 20s elapsed]
ncloud_server.server_was[0]: Still destroying... [id=11289378, 20s elapsed]
ncloud_access_control_group_rule.was_acg-rule: Still destroying... [id=51459, 20s elapsed]
ncloud_access_control_group_rule.was_acg-rule: Destruction complete after 22s
ncloud_access_control_group_rule.web_acg-rule: Destruction complete after 22s
ncloud_access_control_group_rule.db_acg-rule: Destruction complete after 24s
ncloud_server.server_web[0]: Still destroying... [id=11289375, 20s elapsed]
ncloud_server.server_db[0]: Still destroying... [id=11289381, 30s elapsed]
ncloud_server.server_was[0]: Still destroying... [id=11289378, 30s elapsed]
ncloud_server.server_web[0]: Still destroying... [id=11289375, 30s elapsed]
ncloud_server.server_db[0]: Still destroying... [id=11289381, 40s elapsed]
ncloud_server.server_was[0]: Still destroying... [id=11289378, 40s elapsed]
ncloud_server.server_web[0]: Still destroying... [id=11289375, 40s elapsed]
ncloud_server.server_db[0]: Still destroying... [id=11289381, 50s elapsed]
ncloud_server.server_was[0]: Still destroying... [id=11289378, 50s elapsed]
ncloud_server.server_web[0]: Still destroying... [id=11289375, 50s elapsed]
ncloud_server.server_db[0]: Still destroying... [id=11289381, 1m0s elapsed]
ncloud_server.server_was[0]: Still destroying... [id=11289378, 1m0s elapsed]
ncloud_server.server_db[0]: Destruction complete after 1m5s
ncloud_network_interface.nic_db[0]: Destroying... [id=748700]
ncloud_server.server_was[0]: Destruction complete after 1m5s
ncloud_network_interface.nic_was[0]: Destroying... [id=748701]
ncloud_server.server_web[0]: Still destroying... [id=11289375, 1m0s elapsed]
ncloud_network_interface.nic_db[0]: Destruction complete after 2s
ncloud_subnet.db_subnet: Destroying... [id=45628]
ncloud_access_control_group.db_acg: Destroying... [id=51458]
ncloud_network_interface.nic_was[0]: Destruction complete after 2s
ncloud_subnet.was_subnet: Destroying... [id=45629]
ncloud_access_control_group.was_acg: Destroying... [id=51459]
ncloud_access_control_group.db_acg: Destruction complete after 2s
ncloud_access_control_group.was_acg: Destruction complete after 3s
ncloud_server.server_web[0]: Destruction complete after 1m6s
ncloud_network_interface.nic_web[0]: Destroying... [id=748699]
ncloud_login_key.key: Destroying... [id=new]
ncloud_subnet.db_subnet: Destruction complete after 5s
ncloud_network_acl.db_acl: Destroying... [id=33021]
ncloud_subnet.was_subnet: Destruction complete after 6s
ncloud_network_acl.was_acl: Destroying... [id=33022]
ncloud_network_interface.nic_web[0]: Destruction complete after 2s
ncloud_access_control_group.web_acg: Destroying... [id=51460]
ncloud_subnet.web_subnet: Destroying... [id=45627]
ncloud_network_acl.db_acl: Destruction complete after 3s
ncloud_network_acl.was_acl: Destruction complete after 2s
ncloud_login_key.key: Destruction complete after 4s
ncloud_access_control_group.web_acg: Destruction complete after 2s
ncloud_subnet.web_subnet: Destruction complete after 5s
ncloud_network_acl.web_acl: Destroying... [id=33020]
ncloud_network_acl.web_acl: Destruction complete after 2s

Destroy complete! Resources: 20 destroyed.

 

NCP 콘솔에서 vm이 삭제되었는지 확인.