terraform-provider-oci icon indicating copy to clipboard operation
terraform-provider-oci copied to clipboard

oci_core_subnet doesn't detect subnet type change

Open luckeyca opened this issue 2 years ago • 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 "me too" comments, 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

Problem Description

oci_core_sbunet resource can NOT detect subnet type change between availability domain specific and regional subnets. As per documentation, to create regional subnet, simple omit the "availability_domain = var.subnet_availability_domain" setting. However, on an existing availability domain specific subnet, if omit the setting or even specifically set availability_domain = null, oci_core_subnet resource can NOT detect subnet change.

Terraform Version and Provider Version

Terraform v1.1.7 Provider version: 4.69.0

Affected Resource(s)

oci_core_subnet

Terraform Configuration Files

resource "oci_core_subnet" "test_subnet" {
    #Required
    cidr_block = var.subnet_cidr_block
    compartment_id = var.compartment_id
    vcn_id = oci_core_vcn.test_vcn.id

    #Optional
    availability_domain = var.subnet_availability_domain 
}

Expected Behavior

On an existing availability domain specific subnet, if the availability_domain setting is omitted or set to null, oci_core_subnet resource should detect the change and terraform plan should advise actions accordingly(either update the subnet or destroy/re-deploy).

Actual Behavior

When running terraform plan and/or apply, oci_core_subnet can NOT detect the change and says the infrastructure is up-to-date. So to change the availability domain specific subnet to regional subnet, the original subnet has to be destroy manually before the terraform can create a new subnet as regional type.

Steps to Reproduce

  1. create an availability domain specific subnet with availability_domain = var.subnet_availability_domain set
  2. remove the availability_domain = var.subnet_availability_domain line or set availability_domain = null
  3. terraform plan

luckeyca avatar Apr 18 '22 18:04 luckeyca