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

vpc_security_group_ids issue for RDS cross region read replica #1329

Closed
hashibot opened this issue Aug 3, 2017 · 3 comments · Fixed by #5672
Closed

vpc_security_group_ids issue for RDS cross region read replica #1329

hashibot opened this issue Aug 3, 2017 · 3 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

hashibot commented Aug 3, 2017

This issue was originally opened by @gao-jian as hashicorp/terraform#15694. It was migrated here as a result of the provider split. The original body of the issue is below.


Terraform Version

0.9.11

Terraform Configuration Files

provider "aws" {
  region = "${var.region}"
}

resource "aws_db_subnet_group" "aws_rds_subnet_group" {
  name        = "${var.env}-${var.region}-${var.service}-rds-subnet-group"
  description = "RDS Subnet Group for ${var.env} ${var.region} ${var.service}"
  subnet_ids  = ["${split(",", var.private_subnets)}"]

  tags {
    Name    = "${var.env}-${var.region}-${var.service}-rds-subnet-group"
    service = "${var.service}"
    env     = "${var.env}"
    role    = "${var.role}"
  }
}

resource "aws_db_parameter_group" "aws_rds_parameter_group" {
  count       = "${var.pg_count}"
  #depends_on  = ["aws_security_group.aws_rds_security_group"]
  name        = "${var.env}-${var.region}-${var.service}-rds-parameter-group"
  family      = "${var.family}"
  description = "RDS Parameter Group for ${var.env} ${var.region} ${var.service}"
}

resource "aws_security_group" "aws_rds_security_group" {
  vpc_id = "${var.vpc_id}"
  name      = "${var.env}-${var.region}-${var.service}-rds-security-group"

  tags {
    Name    = "${var.env}-${var.region}-${var.service}-rds-security-group"
    service = "${var.service}"
    role    = "${var.role}"
    env     = "${var.env}"
  }

  ingress {
    from_port   = 5432
    to_port     = 5432
    protocol    = "tcp"
    cidr_blocks = ["${var.vpc_cidr}"]
  }

  egress {
    from_port   = 0
    to_port     = 0
    protocol    = "-1"
    cidr_blocks = ["0.0.0.0/0"]
  }
}

resource "aws_db_instance" "aws_rds_read_replica" {
  count                          = "${var.rds_replica_count}"
  depends_on                     = ["aws_db_parameter_group.aws_rds_parameter_group", "aws_security_group.aws_rds_security_group"]
  identifier                     = "${var.instance_identifier}-slave-${count.index + 1}"
  vpc_security_group_ids         = ["${aws_security_group.aws_rds_security_group.id}"]
  db_subnet_group_name           = "${aws_db_subnet_group.aws_rds_subnet_group.id}"
  parameter_group_name           = "${var.pg_count < "1" ? "nonprod-${var.region}-${var.service}-rds-parameter-group" : "${var.env}-${var.region}-${var.service}-rds-parameter-group"}"
  port                           = "${var.port}"
  storage_type                   =  "${var.storage_type}"
  iops                           = "${var.iops}"
  instance_class                 = "${var.instance_class}"
  replicate_source_db            = "${var.replicate_source_db}"
  skip_final_snapshot            = "${var.skip_final_snapshot}"

  tags {
    Name    = "${var.env}-${var.region}-${var.service}-slave-${count.index + 1}"
    service = "${var.service}"
    role    = "${var.role}"
    env     = "${var.env}"
  }
}

Debug Output

n/a

Panic Output

n/a

Expected Behavior

The cross-region RDS read replicas should use the parameter_group_name and vpc_secuirty_group_ids created in the same script.

Actual Behavior

they still got default values.

Steps to Reproduce

  1. Create one master PostgreSQL RDS instance and two read replicas in west.
  2. Create two read-replicas in east, using the master in the west, and using the specified parameter_group_name and vpc_security_group_ids which get created in the same script.

Important Factoids

no

References

no

@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
2 participants