Terraform-provider-aws: RDS instance stays in pending-reboot after `apply`

Created on 24 Aug 2017  ยท  4Comments  ยท  Source: hashicorp/terraform-provider-aws

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.

bug servicrds

Most helpful comment

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.

All 4 comments

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.

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.

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.

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!

Was this page helpful?
0 / 5 - 0 ratings