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 replica creation requires double apply #2909

Closed
bethge opened this issue Jan 9, 2018 · 4 comments · Fixed by #5672
Closed

RDS replica creation requires double apply #2909

bethge opened this issue Jan 9, 2018 · 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

@bethge
Copy link

bethge commented Jan 9, 2018

Terraform Version

Terraform v0.11.1
+ provider.aws v1.6.0

Affected Resource(s)

  • aws_db_instance

Terraform Configuration Files

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

resource "aws_vpc" "main" {
  cidr_block = "10.0.0.0/16"
}

resource "aws_subnet" "main-a" {
  vpc_id            = "${aws_vpc.main.id}"
  availability_zone = "us-east-1a"
  cidr_block        = "10.0.1.0/24"
}

resource "aws_subnet" "main-b" {
  vpc_id            = "${aws_vpc.main.id}"
  availability_zone = "us-east-1b"
  cidr_block        = "10.0.2.0/24"
}

resource "aws_db_subnet_group" "main" {
  subnet_ids = ["${aws_subnet.main-a.id}", "${aws_subnet.main-b.id}"]
}

resource "aws_db_instance" "master" {
  allocated_storage       = 10
  engine                  = "mysql"
  instance_class          = "db.t2.micro"
  username                = "foo"
  password                = "barbar12"
  backup_retention_period = 1
  apply_immediately       = true
  db_subnet_group_name    = "${aws_db_subnet_group.main.name}"
}

resource "aws_db_instance" "replica" {
  replicate_source_db = "${aws_db_instance.master.identifier}"
  allocated_storage   = 15
  instance_class      = "db.t2.micro"
}

Expected Behavior

There are no changes to be applied after an execution of terraform apply.

Actual Behavior

There are changes to be applied:

  ~ aws_db_instance.replica
      allocated_storage: "10" => "15"

Steps to Reproduce

  1. terraform apply
  2. terraform plan

Important Factoids

Iiuc the limitations of the CreateDBInstanceReadReplica AWS API call is the issue. Certain parameters can not be configured during DB creation but must be changed after creation. Is there some way for terraform to circumvent the limitations of the AWS API in this situation? E.g. by creating and then updating the db_instance in one apply execution.

I would be more than willing to work on a PR to resolve this issue, assuming it is within the realm of fixability.

@radeksimko radeksimko added bug Addresses a defect in current functionality. service/rds Issues and PRs that pertain to the rds service. labels Jan 17, 2018
@Bryji
Copy link

Bryji commented Apr 5, 2018

I'm having a similar issue (as linked above in the terraform-aws-rds repo), read replicas in a multi-region MySQL set up have multi-az set to false. It looks like it remains false after re-applying config also (but on one occasion the change did take after a re-apply).

@bflad
Copy link
Contributor

bflad commented Aug 30, 2018

The fix for this 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