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]: create: unexpected state 'deleting', wanted target 'available, storage-optimization'. last error: %!s(<nil>) #37344

Open
byog7804 opened this issue May 8, 2024 · 1 comment
Labels
bug Addresses a defect in current functionality. service/rds Issues and PRs that pertain to the rds service.

Comments

@byog7804
Copy link

byog7804 commented May 8, 2024

Terraform Core Version

1.7.4

AWS Provider Version

5.48.0

Affected Resource(s)

AWS RDS

Expected Behavior

I'm trying to import an existing RDS to Terraform state file and renaming it. When executing the plan RDS instance has been destroyed and should be created with the changes.

Actual Behavior

When executing the plan RDS instance has been destroyed and while trying to create the instance again with new information it returns the error

waiting for RDS DB Instance, create: unexpected state 'deleting', wanted target 'available, storage-optimization'. last error: %!s(<nil>)

Relevant Error/Panic Output Snippet

Error: waiting for RDS DB Instance (terraform-test-20240508) create: unexpected state 'deleting', wanted target 'available, storage-optimization'. last error: %!s(<nil>)

Terraform Configuration Files

Define provider and other configurations here

terraform {
  required_version = ">= 0.13"
}

provider "aws" {
  region = "us-east-1"
}

variable "existing_rds" {
  description = "Existing RDS DB identifier"
}

variable "new_rds_name" {
  description = "new_rds_name RDS DB identifier"
}

variable "vpc_security_group_ids" {
  description = "vpc_security_group_ids"
}

variable "db_subnet_group_name" {
  description = "db_subnet_group_name"
}

data "aws_db_instance" "existing_rds" {
  db_instance_identifier = var.existing_rds
}

# Your other resources and configurations go here

resource "aws_db_instance" "imported_rds" {
  identifier  = var.new_rds_name
  #subnet_group_name = data.aws_db_instance.existing_rds.db_subnet_group
  allocated_storage     = 1000  # Storage allocated in GB
  engine                = "sqlserver-ee"
  instance_class        = "db.m5.xlarge"
  engine_version        = "13.00.6300.2.v1"
  #db_name                  = "master"  # Name of the database
  username              = "admin"  # Master username
  password              = "admin123"  # Master password
  backup_retention_period = 7  # Backup retention period in days
  skip_final_snapshot   = true  # Whether to create a final DB snapshot when the instance is deleted

  # Network Configuration
  vpc_security_group_ids = var.vpc_security_group_ids
  
  db_subnet_group_name      = var.db_subnet_group_name
  #vpc_id                 = data.aws_db_instance.existing_rds.vpc_id

  # Other Attributes
  publicly_accessible   = false
  license_model          = "license-included"
  multi_az               = false
}

Steps to Reproduce

Terraform Init
Import the RDS and Terraform Apply

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@byog7804 byog7804 added the bug Addresses a defect in current functionality. label May 8, 2024
Copy link

github-actions bot commented May 8, 2024

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/rds Issues and PRs that pertain to the rds service. label May 8, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label May 8, 2024
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/rds Issues and PRs that pertain to the rds service.
Projects
None yet
Development

No branches or pull requests

2 participants