NaverCloudPlatform/terraform-provider-ncloud

try to modify 'product_code' instead of recreating

teacherSsamko opened this issue ยท 0 comments

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform Ncloud Provider Version

Terraform version : v1.5.5 on darwin_arm64
Ncloud Provider version : v2.3.18

Affected Resource(s)

  • ncloud_server

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp
...

resource "ncloud_server" "server" {
  subnet_no                 = ncloud_subnet.test.id
  name                      = "my-tf-server"
  server_image_product_code = "SW.VSVR.OS.LNX64.UBNTU.SVR2004.B050"
  server_product_code = data.ncloud_server_products.spec.server_products[0].product_code
  login_key_name            = ncloud_login_key.loginkey.key_name
  init_script_no = ncloud_init_script.init.init_script_no
}

data "ncloud_server_products" "spec" {
  server_image_product_code = "SW.VSVR.OS.LNX64.UBNTU.SVR2004.B050"

  filter {
    name   = "product_code"
    values = ["SSD"]
    regex  = true
  }

  filter {
    name   = "cpu_count"
    values = ["2"]
  }

  filter {
    name   = "memory_size"
    values = ["4GB"]
  }

  filter {
    name   = "base_block_storage_size"
    values = ["50GB"]
  }

  filter {
    name   = "product_type"
    values = ["HICPU"]
  }

  output_file = "product.json"
}

Debug Output

Terraform used the selected providers to generate the following execution plan. Resource
actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # ncloud_server.server will be updated in-place
  ~ resource "ncloud_server" "server" {
        id                                  = "19086360"
        name                                = "my-tf-server"
      ~ server_product_code                 = "SVR.VSVR.STAND.C002.M008.NET.SSD.B050.G002" -> "SVR.VSVR.HICPU.C002.M004.NET.SSD.B050.G002"
        # (13 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

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

Panic Output

Expected Behavior

when 'product_code' has changed, it should destroy old server and create new one with new 'product_code'.

Actual Behavior

But, it try to modify 'product_code' and it goes fail

Steps to Reproduce

  1. Change 'product_code'
  2. terraform apply

Important Factoids

References

  • #0000