oracle / terraform-provider-oci

Terraform Oracle Cloud Infrastructure provider
https://www.terraform.io/docs/providers/oci/
Mozilla Public License 2.0
759 stars 681 forks source link

Disaster Recovery Protection Group not refreshing state after successful switchover #2182

Open bogdan-m-darie opened 2 months ago

bogdan-m-darie commented 2 months ago

Community Note

Terraform Version and Provider Version

$ terraform -v
Terraform v1.9.4
on linux_amd64
+ provider registry.terraform.io/oracle/oci v6.9.0

Affected Resource(s)

affected_resources = oci_disaster_recovery_dr_protection_group

Debug Output

resource "oci_disaster_recovery_dr_protection_group" "this" {
  compartment_id = "ocid1.compartment.oc1..aaaaaaaahaz26fqhyi3fezbueousr53okuox7iayrmqik4hatmq6o3i3f35q"
  defined_tags = {
    "Oracle-Tags.CreatedBy" = "default/bogdan.m.darie@oracle.com"
    "Oracle-Tags.CreatedOn" = "2024-08-28T14:40:05.519Z"
  }
  display_name        = "primary"
  freeform_tags       = {}
  id                  = "ocid1.drprotectiongroup.oc1.eu-frankfurt-1.amaaaaaao7vto7iajwg5yysm4bdy6obkfkhzpc2fcecnschmqc63lfowwhua"
  lifecycle_sub_state = null
  peer_id             = "ocid1.drprotectiongroup.oc1.eu-frankfurt-1.amaaaaaao7vto7iakm2iccqyaxcyxsqarnbh7x53oz4eiwjzqlemukdmjaaa"
  peer_region         = "eu-frankfurt-1"
  role                = "STANDBY"
  state               = "ACTIVE"
  system_tags         = {}
  time_created        = "2024-08-28 14:40:06.502 +0000 UTC"
  time_updated        = "2024-08-28 14:49:26.628 +0000 UTC"

  association {
    peer_id     = "ocid1.drprotectiongroup.oc1.eu-frankfurt-1.amaaaaaao7vto7iakm2iccqyaxcyxsqarnbh7x53oz4eiwjzqlemukdmjaaa"
    peer_region = "eu-frankfurt-1"
    role        = "PRIMARY"
  }

  log_location {
    bucket    = "fra"
    namespace = "frvkqml7frsy"
    object    = null
  }

  timeouts {
    create = "5m"
    delete = "5m"
  }
}

Panic Output

Expected Behavior

The association group should have been deleted from the standby DR protection group and moved to the primary.

Actual Behavior

The standby protection group still has the association block attached to it. As a reference, the oci cli get request displays it correctly, see below:

$ oci disaster-recovery dr-protection-group get --dr-protection-group-id "ocid1.drprotectiongroup.oc1.eu-frankfurt-1.amaaaaaao7vto7iajwg5yysm4bdy6obkfkhzpc2fcecnschmqc63lfowwhua"
{
  "data": {
    "compartment-id": "ocid1.compartment.oc1..aaaaaaaahaz26fqhyi3fezbueousr53okuox7iayrmqik4hatmq6o3i3f35q",
    "defined-tags": {
      "Oracle-Tags": {
        "CreatedBy": "default/bogdan.m.darie@oracle.com",
        "CreatedOn": "2024-08-28T14:40:05.519Z"
      }
    },
    "display-name": "primary",
    "freeform-tags": {},
    "id": "ocid1.drprotectiongroup.oc1.eu-frankfurt-1.amaaaaaao7vto7iajwg5yysm4bdy6obkfkhzpc2fcecnschmqc63lfowwhua",
    "life-cycle-details": null,
    "lifecycle-state": "ACTIVE",
    "lifecycle-sub-state": null,
    "log-location": {
      "bucket": "fra",
      "namespace": "frvkqml7frsy",
      "object": null
    },
    "members": null,
    "peer-id": "ocid1.drprotectiongroup.oc1.eu-frankfurt-1.amaaaaaao7vto7iakm2iccqyaxcyxsqarnbh7x53oz4eiwjzqlemukdmjaaa",
    "peer-region": "eu-frankfurt-1",
    "role": "STANDBY",
    "system-tags": {},
    "time-created": "2024-08-28T14:40:06.502000+00:00",
    "time-updated": "2024-08-28T14:49:26.628000+00:00"
  },
  "etag": "f69fd1e6f0b78bd556ec1b3f23e607e2ed6a4024b466302ea09e5093dbe901d8--gzip"
}

Steps to Reproduce

  1. Perform a successful switchover DR plan.
  2. Check the tfstate for the new standby DR protection group.

Important Factoids

References

tf-oci-pub commented 2 months ago

Thank you for reporting the issue. We observed the affected resources are not provided in the description or it's incorrect. We request you to add it in issue description as mentioned in below format. Example: affected_resources = oci_core_instance , oci_core_instances

If it's not related to any particular resource then mention affected resource as terraform. Example: affected_resources = terraform

As this works through automation, request you to follow exact syntax.