Skip to content
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

[Bug]: db_instance replica destroy - delete-precheck status #31109

Closed
AdamTylerLynch opened this issue May 2, 2023 · 3 comments
Closed

[Bug]: db_instance replica destroy - delete-precheck status #31109

AdamTylerLynch opened this issue May 2, 2023 · 3 comments
Labels
bug Addresses a defect in current functionality. service/kms Issues and PRs that pertain to the kms service. service/rds Issues and PRs that pertain to the rds service.

Comments

@AdamTylerLynch
Copy link
Collaborator

Terraform Core Version

1.0

AWS Provider Version

4.60.0

Affected Resource(s)

  • aws_db_instance

Expected Behavior

Clean deletion of replica instances.

Actual Behavior

When deleting/destroying a db_instance which is a replica (RDS Custom for Oracle), there is a new status returned which causes Terraform to error.

Relevant Error/Panic Output Snippet

module.rds_custom_for_oracle.aws_db_instance.replicas[1]: Still destroying... [id=instance-05-replica-1, 1m0s elapsed]
module.rds_custom_for_oracle.aws_db_instance.replicas[0]: Still destroying... [id=instance-05-replica-0, 1m0s elapsed]
╷
│ Error: waiting for RDS DB Instance (instance-05-replica-0) delete: unexpected state 'delete-precheck', wanted target ''. last error: %!s(<nil>)
│ 
│ 
╵
╷
│ Error: waiting for RDS DB Instance (instance-05-replica-1) delete: unexpected state 'delete-precheck', wanted target ''. last error: %!s(<nil>)
│ 
│ 
╵

Terraform Configuration Files

# Lookup the available instance classes for the custom engine for the region being operated in
data "aws_rds_orderable_db_instance" "custom-oracle" {
  engine                     = "custom-oracle-ee" # CEV engine to be used
  engine_version             = "19.c.ee.002" # CEV engine version to be used
  license_model              = "bring-your-own-license"
  storage_type               = "gp3"
  preferred_instance_classes = ["db.r5.24xlarge","db.r5.16xlarge","db.r5.12xlarge"]
}

# The RDS instance resource requires an ARN. Look up the ARN of the KMS key associated with the CEV.
data "aws_kms_key" "by_id" {
  key_id = "example-ef278353ceba4a5a97de6784565b9f78" # KMS key associated with the CEV
}

resource "aws_db_instance" "default" {
  allocated_storage           = 50
  auto_minor_version_upgrade  = false # Custom for Oracle not support minor version upgrades
  custom_iam_instance_profile = "AWSRDSCustomInstanceProfile" # Instance profile is required for Custom for Oracle. See: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/custom-setup-orcl.html#custom-setup-orcl.iam-vpc
  backup_retention_period     = 7
  db_subnet_group_name        = local.db_subnet_group_name
  engine                      = data.aws_rds_orderable_db_instance.custom-oracle.engine
  engine_version              = data.aws_rds_orderable_db_instance.custom-oracle.engine_version
  identifier                  = "ee-instance-demo"
  instance_class              = data.aws_rds_orderable_db_instance.custom-oracle.instance_class
  kms_key_id                  = data.aws_kms_key.by_id.arn
  license_model               = data.aws_rds_orderable_db_instance.custom-oracle.license_model
  multi_az                    = false # Custom for Oracle does not support multi-az
  password                    = "avoid-plaintext-passwords"
  username                    = "test"
  storage_encrypted           = true

  timeouts {
    create = "3h"
    delete = "3h"
    update = "3h"
  }
}

resource "aws_db_instance" "test-replica" {
  replicate_source_db         = aws_db_instance.default.identifier
  replica_mode                = "mounted"
  auto_minor_version_upgrade  = false
  custom_iam_instance_profile = "AWSRDSCustomInstanceProfile" # Instance profile is required for Custom for Oracle. See: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/custom-setup-orcl.html#custom-setup-orcl.iam-vpc
  backup_retention_period     = 7
  identifier                  = "ee-instance-replica"
  instance_class              = data.aws_rds_orderable_db_instance.custom-oracle.instance_class
  kms_key_id                  = data.aws_kms_key.by_id.arn
  multi_az                    = false # Custom for Oracle does not support multi-az
  skip_final_snapshot         = true
  storage_encrypted           = true


  timeouts {
    create = "3h"
    delete = "3h"
    update = "3h"
  }
}

Steps to Reproduce

Create replica. Destroy replica.

Debug Output

No response

Panic Output

No response

Important Factoids

Closed by #31047

References

No response

Would you like to implement a fix?

Yes

@AdamTylerLynch AdamTylerLynch added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. service/rds Issues and PRs that pertain to the rds service. labels May 2, 2023
@github-actions
Copy link

github-actions bot commented May 2, 2023

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/kms Issues and PRs that pertain to the kms service. label May 2, 2023
@AdamTylerLynch
Copy link
Collaborator Author

Closed by #31047

@github-actions github-actions bot removed the needs-triage Waiting for first response or review from a maintainer. label May 2, 2023
@github-actions
Copy link

github-actions bot commented Jun 2, 2023

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/kms Issues and PRs that pertain to the kms service. service/rds Issues and PRs that pertain to the rds service.
Projects
None yet
Development

No branches or pull requests

1 participant