Skip to content

oci_database_pluggable_database times out when creating multiple pdbs using for_each loop #2345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
luckeyca opened this issue Mar 28, 2025 · 0 comments
Labels

Comments

@luckeyca
Copy link

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 v1.9.3
on linux_amd64

  • provider registry.terraform.io/oracle/oci v6.31.0

Affected Resource(s)

oci_database_pluggable_database

Terraform Configuration Files

....
resource "oci_database_pluggable_database" "extras" {
  for_each = { for pdb in [
    {
      name          = "clpdb02"
      freeform_tags = { "component" : "clpdb02" }
    },
    {
      name          = "clpdb03"
      freeform_tags = { "component" : "clpdb03" }
    },
  ] : pdb.name => pdb }
  container_database_id              = "container db ocid"
  pdb_name                           = lower(each.value.name)
  pdb_admin_password                 = "password"
  tde_wallet_password                = "password"
  should_pdb_admin_account_be_locked = false
  freeform_tags                      = each.value.freeform_tags

  lifecycle {
    ignore_changes = [
      defined_tags["Oracle-Tags.CreatedBy"],
      defined_tags["Oracle-Tags.CreatedOn"],
      # provider couldn't detect password changes outside of terraform
      # also cannot update passwords when random password changes
      pdb_admin_password,
      tde_wallet_password,
    ]
  }
}
...

Debug Output

Panic Output

Expected Behavior

when using for_each loop to create multiple pdbs, all pdbs should be created successfully

Actual Behavior

when creating multiple pdbs using for_each loop, even if only 2 pdbs, terraform apply fails with timeout error. rerun terraform apply shows at least one of the databases is tainted and has to be re-created.

Steps to Reproduce

  1. use the code snippet above and fill in the real value.
  2. in the for_each block, put in at least 2 blocks for 2 pdbs(one single pdb has no issue and only takes 3 minutes to complete successfully).
  3. terraform apply this will timeout with the following error
│ Error: Operation Timeout
│ Provider version: 6.31.0, released on 2025-03-19. This provider is 1 Update(s) behind to current.
│ Service: Database Pluggable
│ Error Message: timeout while waiting for state to become 'SUCCEEDED, FAILED, CANCELED' (timeout: 20m0s)
│ Suggestion: Try increasing the timeout by referring to this document: https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformtroubleshooting.htm#common_issues__timeoutwhilewaiting
│
│
│   with oci_database_pluggable_database.extras["clpdb02"],
│   on main.tf line 102, in resource "oci_database_pluggable_database" "extras":
│  102: resource "oci_database_pluggable_database" "extras" {
│
  1. re-run terraform apply. this will create the 2nd pdb successfully with message indicating one of the pdbs was tainted. If total is more than 2 pdbs, this step will fail too as if the backend only allows one pdb to created at once, but terraform is not properly queuing the requests.
Terraform will perform the following actions:

  # oci_database_pluggable_database.extras["clpdb02"] is tainted, so must be replaced
-/+ resource "oci_database_pluggable_database" "extras" {
      ~ compartment_id                       = "ocid1.compartment.oc1..aaaaaaaaui5npqsoh4mqtvtwaj242sdlwg7gusw3ohdegizqzgjs6pzp75dq" -> (known after apply)
      ~ connection_strings                   = [

Important Factoids

References

@luckeyca luckeyca added the bug label Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant