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

RDS instance stays in pending-reboot after apply #1494

Closed
pioneerit opened this issue Aug 24, 2017 · 4 comments · Fixed by #5672
Closed

RDS instance stays in pending-reboot after apply #1494

pioneerit opened this issue Aug 24, 2017 · 4 comments · Fixed by #5672
Labels
bug Addresses a defect in current functionality. service/rds Issues and PRs that pertain to the rds service.
Milestone

Comments

@pioneerit
Copy link

Provider: AWS, resource: aws_db_instance
In case if RDS instance restored from the snapshot after terraform apply, the instance is in pending-reboot status, because of parameter_group values. It doesn't happen with new instances.

resource "aws_db_parameter_group" "db" {
  name        = "${var.environment}}-db"
  description = "${var.environment}-db parameter group by Terraform"
  family      = "mysql5.6"

  parameter {
# ...
# The are different from the parameters in the snapshot
  }
}

resource "aws_db_instance" "db" {
  identifier = "test"
  snapshot_identifier  = "${var.latest_snapshot}"
  skip_final_snapshot  = true
  parameter_group_name = "${aws_db_parameter_group.db.name}"
  instance_class       = "db.m4.large"
  apply_immediately    = true
}

I manage to do a workaround with:

resource "null_resource" "pending-reboot" {
  triggers {
    db_host = "${aws_db_instance.db.parameter_group_name}"
  }

  provisioner "local-exec" {
    command = "aws rds reboot-db-instance --db-instance-identifier ${aws_db_instance.db.identifier} && aws rds wait db-instance-available --db-instance-identifier ${aws_db_instance.db.identifier}"
  }
}

I believe that it should be a way to adjust the code, to make terraform apply work even in this case. Unfortunately, I'm not using GoLang to do a proper PR.

@Ninir Ninir added the bug Addresses a defect in current functionality. label Sep 7, 2017
@radeksimko radeksimko added the service/rds Issues and PRs that pertain to the rds service. label Jan 28, 2018
@bflad
Copy link
Contributor

bflad commented Aug 22, 2018

In version 1.33.0 of the AWS provider, likely releasing later today, the aws_db_instance will now correctly apply parameter_group_name on resource creation when using snapshot_identifier. Please note though that it will still be in pending-reboot state, which will also be fixed shortly.

@bflad
Copy link
Contributor

bflad commented Aug 30, 2018

The handling to prevent pending-reboot on creation (by issuing RebootDBInstance) has been merged into master and will release with version 1.34.0 of the AWS provider, likely later today.

@bflad
Copy link
Contributor

bflad commented Aug 30, 2018

This has been released in version 1.34.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 3, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 3, 2020
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/rds Issues and PRs that pertain to the rds service.
Projects
None yet
4 participants