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: aws_db_instance not respecting parameter_group_name on first run #218

Closed
hashibot opened this issue Jun 13, 2017 · 5 comments · Fixed by #5672
Closed

RDS: aws_db_instance not respecting parameter_group_name on first run #218

hashibot opened this issue Jun 13, 2017 · 5 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

@hashibot
Copy link

This issue was originally opened by @alkema as hashicorp/terraform#8079. It was migrated here as part of the provider split. The original body of the issue is below.


When using aws_db_instance and setting the parameter_group_name it is presented in both plan and apply as being set with the correct value. However, after being applied the value is set to something else. When looking at the RDS instance in the AWS interface it is not set properly, it is set to default.mysql5.6, not mysql-params.

Upon an immediate subsequent terraform plan this diff is evident, then a subsequent terraform apply changes parameter_group_name to the correct value. I then need to do an RDS reboot to apply it too.

Terraform Version

✗ terraform -v
Terraform v0.7.0

Affected Resource(s)

  • aws_db_instance

Terraform Configuration Files

...
variable "parameter_group_name" {
  default = "mysql-params"
}

resource "aws_db_instance" "default" {
  lifecycle {
    create_before_destroy = true
  }
  instance_class = "${var.instance_class}"
  db_subnet_group_name = "${var.db_subnet_group_name}"
  snapshot_identifier = "${var.snapshot_identifier}"
  identifier = "${var.identifier}"
  parameter_group_name = "${var.parameter_group_name}"
  apply_immediately = true
  tags {
    Cluster = "${var.cluster}"
    Environment = "${var.environment}"
    App = "${var.app}"
  }
}
...

Expected Behavior

I expect parameter_group_name to be applied with the value it was set within the config on first apply. I also expect to have to do an AWS RDS reboot as according to docs:

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.DBInstance.Modifying.html

Parameter group name:
The name change is applied immediately. Any parameter value changes are applied to the DB instance after you manually reboot the DB instance.

Actual Behavior

parameter_group_name is set to default.mysql5.6 not mysql-params.

Steps to Reproduce

terraform plan

...
-/+ module.hampton.aws_db_instance.default
...
    parameter_group_name:       "mysql-params" => "mysql-params"

terraform apply

...
  parameter_group_name:       "" => "mysql-params"
...

terraform plan

Note: this is the only change reported.

~ module.hampton.aws_db_instance.default
    parameter_group_name: "default.mysql5.6" => "mysql-params"

terraform apply

Note: this is the only change reported.

module.hampton.aws_db_instance.default: Modifying...
  parameter_group_name: "default.mysql5.6" => "mysql-params"

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

Now a manual RDS reboot needed to apply change and finally get a proper parameter_group_name.

@hashibot hashibot added the bug Addresses a defect in current functionality. label Jun 13, 2017
@radeksimko radeksimko added the service/rds Issues and PRs that pertain to the rds service. label Jan 25, 2018
@sgrimm-sg
Copy link

This happens on PostgreSQL RDS instances too, so it is not MySQL-specific.

@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