oci-landing-zones / terraform-oci-multicloud-azure

Terraform Modules for OCI Multicloud with Azure
https://docs.oracle.com/en/learn/dbazure-terraform/
Universal Permissive License v1.0
9 stars 3 forks source link

Destroy issue with Exadata Infrastructure and Cluster #34

Open terrymandin opened 2 weeks ago

terrymandin commented 2 weeks ago

I used AzAPI to deploy Oracle Infrastructure and Cluster resources. When I did a terraform destroy I received the following error:

│     "code": "EXA_INFRA_DELETE_FAILED",
│     "message": "Error returned by DeleteCloudExadataInfrastructure operation in Database service.(409, IncorrectState, false) Cannot delete Exadata infrastructure ocid1.cloudexadatainfrastructure.oc1.iad.anuwcljrs56liuaaj6be4qvqvggua2edufw7p2nbsxgp66ql3kqau3viip4q for tenant ocid1.tenancy.oc1..aaaaaaaarvyhjcn7wkkxxx5g3o7lgqks23bmsjtsticz3gtg5xs5qyrwkftq. All associated VM clusters must be deleted before you delete the Exadata infrastructure. (opc-request-id: oci-F4056AF7D18E42C-202408201302/3E066C80DEDEB3C520750A1B97BB4D03/0BF304656ECBBFF7957B27B42A660D3D)\nTimestamp: 2024-08-20T13:02:44.827Z\n"

To duplicate:

  1. Clone this repository: https://github.com/Azure/terraform-azurerm-avm-ptn-odaa-lz/tree/main
  2. Run terraform apply on this example: https://github.com/Azure/terraform-azurerm-avm-ptn-odaa-lz/tree/main/examples/default
  3. Run terraform destroy
terrymandin commented 2 weeks ago

@chanstev , we have received an exemption for the AVM approval process. We will document this know issue in our readme and proceed with deployment. It would still be good to get it resolved at some point.

eelhomsi commented 1 week ago

@terrymandin, This error occurs because VMClusters must be deleted first before the ExaData infrastructure they are associated with can be deleted. Is there a different sort of behaviour you think we should have here to improve the experience?

terrymandin commented 1 week ago

@eelhomsi, the Terraform should wait for the cluster to be fully deleted before attempting to delete the infrastructure. It seems that the cluster still exists in the background, even when Terraform says it has been succuessfully delete.

At a high level, these are the steps we are following in our Terraform:

Terraform apply:

  1. Create Infra
  2. Create Cluster

Terraform destroy

  1. Delete Cluster
  2. Delete Infra

Step 1 of the destroy says the cluster is deleted, even though it seems to still be there. It causes the infra destroy to fail.

eelhomsi commented 6 days ago

Thanks @terrymandin I tried the test myself but deletion seemed to go through ok: Screenshot 2024-09-05 at 23 38 37 Maybe we can discuss with @chanstev in sync tomorrow to understand issue further.