terraform-provider-oci: ExaCS: cannot create db_home after migrating to resource model

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

Terraform Version and Provider Version

Terraform v0.13.5

  • provider registry.terraform.io/hashicorp/oci v4.0.0

Affected Resource(s)

oci_database_db_home

Terraform Configuration Files

resource "oci_database_cloud_exadata_infrastructure" "x01" {
  compartment_id      = oci_identity_compartment.db.id
  availability_domain = local.ad_list.AD1

  display_name = "x01"
  shape        = "Exadata.Quarter3.100"
}

resource "oci_database_cloud_vm_cluster" "xclu01" {
  compartment_id                  = oci_identity_compartment.db.id
  cloud_exadata_infrastructure_id = oci_database_cloud_exadata_infrastructure.x01.id

  display_name = "xclu01"
  cluster_name = "xclu01"

  cpu_core_count              = 16
  data_storage_percentage     = 80
  is_local_backup_enabled     = false
  is_sparse_diskgroup_enabled = true
  time_zone                   = "UTC"
  gi_version                  = "19.0.0.0" //19.8.0.0.0
  license_model               = "LICENSE_INCLUDED"

  hostname         = "x01-xxxxx"
  subnet_id        = oci_core_subnet.db1.id
  backup_subnet_id = oci_core_subnet.db2.id

  ssh_public_keys = [chomp(file(local.ssh_key_list.x01))]

  lifecycle {
    ignore_changes = [
      gi_version
    ]
  }
}

resource oci_database_db_home x01_dbhome5 {
  depends_on    = [oci_database_db_home.x01_dbhome4]
  vm_cluster_id = oci_database_cloud_vm_cluster.xclu01.id

  display_name = "ora19dbhome5"
  db_version   = "19.0.0.0"

  database {
    pdb_name = "pdb"
    db_name  = "cdb"

    db_workload    = "OLTP"
    character_set  = "WE8ISO8859P1"
    ncharacter_set = "AL16UTF16"

    admin_password = local.admin_passwords_list.x01.dbhome5

    db_backup_config {
      auto_backup_enabled = "false"
    }
  }

  timeouts {
    create = "2h"
    delete = "2h"
  }
}

Expected Behavior

Creating a new db_home with a new database should work as expected.

Actual Behavior

Terraform fails after exactly 2 minutes with the following error:

oci_database_db_home.x01_dbhome5: Creating...
oci_database_db_home.x01_dbhome5: Still creating... [10s elapsed]
oci_database_db_home.x01_dbhome5: Still creating... [20s elapsed]
oci_database_db_home.x01_dbhome5: Still creating... [30s elapsed]
oci_database_db_home.x01_dbhome5: Still creating... [40s elapsed]
oci_database_db_home.x01_dbhome5: Still creating... [50s elapsed]
oci_database_db_home.x01_dbhome5: Still creating... [1m0s elapsed]
oci_database_db_home.x01_dbhome5: Still creating... [1m10s elapsed]
oci_database_db_home.x01_dbhome5: Still creating... [1m20s elapsed]
oci_database_db_home.x01_dbhome5: Still creating... [1m30s elapsed]
oci_database_db_home.x01_dbhome5: Still creating... [1m40s elapsed]
oci_database_db_home.x01_dbhome5: Still creating... [1m50s elapsed]
oci_database_db_home.x01_dbhome5: Still creating... [2m0s elapsed]

Error: Service error:InternalError. Internal error occurred. http status code: 500. Opc request id: 594a751bfdf40fea86f5cbd720ecf629/5A63D7CEE843AD0B3E61ECEBCE5676EC/2E867A255772D4E593D010D34773B6ED, The service for this resource encountered an error. Please contact support for help with that service

  on exadata.tf line 189, in resource "oci_database_db_home" "x01_dbhome5":
 189: resource oci_database_db_home x01_dbhome5 {

Important Factoids

  • The Exadata environment was created through Terraform as a DB System with 2 db homes containing 1 database each
  • This was subsequently migrated to the new infrastructure resource model. The Terraform oci_database_db_system was then replaced with a pair of oci_database_cloud_exadata_infrastructure and oci_database_cloud_vm_cluster, as shared above (the VM cluster pointing to the old dbsystem OCID).
  • Adding new db homes (e.g. dbhome5 above) fails with the above error.

However, I managed to manually add 2 more db homes (dbhome3 and dbhome4) just fine using the OCI console and OCI CLI respectively, therefore the problem seems to only be with the Terraform OCI provider.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (12 by maintainers)

Most upvoted comments

The way we are addressing this is to remove any polling logic that results in GetVmCluster/GetCloudVmCluster/GetDbSystem calls in the oci_database_db_home resource, because the client has no reliable way of knowing the underlying type of the source OCID (particularly in the case of imports).

You should be able to specify the ExaCS cluster using the vm_cluster_id and source=VM_CLUSTER_NEW. The fix is expected to go out this week in v4.3.0.