-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Add support for DBInstanceParameterGroupName in aws_rds_cluster #17357
Comments
HI @rafaljanicki. I've made a PR to add this functionnality. You can use it like this sample to test if it solved your problem. terraform {
required_version = ">= 0.14.0, < 0.15.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = "3.36.0"
}
aws-sglk = {
source = "sogelink/aws"
version = "3.36.0-sglk"
}
}
}
provider "aws" {
region = "eu-west-1"
shared_credentials_file = "~/.aws/credentials"
}
provider "aws-sglk" {
region = "eu-west-1"
shared_credentials_file = "~/.aws/credentials"
}
locals {
name = "test-aurora-custom"
apply_immediately = true
engine = "aurora-postgresql"
engine_version = "12.4"
family = "${local.engine}${split(".", local.engine_version)[0]}"
}
data "aws_rds_orderable_db_instance" "test" {
engine = aws_rds_cluster.test.engine
engine_version = aws_rds_cluster.test.engine_version
preferred_instance_classes = ["db.t3.medium", "db.t3.large"]
}
resource "aws_rds_cluster" "test" {
provider = aws-sglk
allow_major_version_upgrade = true
apply_immediately = local.apply_immediately
cluster_identifier = local.name
engine = local.engine
engine_version = local.engine_version
master_password = "bestpassword4ever"
master_username = "postgres"
db_cluster_parameter_group_name = aws_rds_cluster_parameter_group.cluster_parameters.name
db_instance_parameter_group_name = aws_db_parameter_group.db_parameters.name
skip_final_snapshot = true
}
resource "aws_rds_cluster_instance" "test" {
provider = aws-sglk
cluster_identifier = aws_rds_cluster.test.id
apply_immediately = local.apply_immediately
engine = data.aws_rds_orderable_db_instance.test.engine
engine_version = data.aws_rds_orderable_db_instance.test.engine_version
identifier = local.name
instance_class = data.aws_rds_orderable_db_instance.test.instance_class
db_parameter_group_name = aws_db_parameter_group.db_parameters.name
}
resource "aws_rds_cluster_parameter_group" "cluster_parameters" {
name_prefix = "${local.name}-"
family = local.family
lifecycle {
create_before_destroy = true
}
}
resource "aws_db_parameter_group" "db_parameters" {
name_prefix = "${local.name}-"
family = local.family
lifecycle {
create_before_destroy = true
}
} |
Thank you, you're awesome @gdepuille ! :-) |
If/when the parameter is added, I guess it will need adding to https://github.com/terraform-aws-modules/terraform-aws-rds-aurora too? |
This functionality has been released in v3.63.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
This needs to be added to aurora provider as well. Specifying |
@gdepuille thnx a lot for your TF example 👍 In theory "aws_rds_cluster_parameter_group" is enough as these params applied to all cluster instances too, right? Is "allow_major_version_upgrade = true" required for "aws_rds_cluster_parameter_group" or it's working only together with "aws_db_parameter_group"? |
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. |
Community Note
Description
When upgrading a major version of Aurora RDS Cluster (MySQL in my case), AWS requires DBInstanceParameterGroupName parameter on the SDK call, otherwise it fails with
InvalidParameterCombination: The current DB instance parameter group <xxx> is custom. You must explicitly specify a new DB instance parameter group, either default or custom, for the engine version upgrade.
errorNew or Affected Resource(s)
The text was updated successfully, but these errors were encountered: