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 #15694

Closed
gao-jian-zz opened this issue Aug 2, 2017 · 2 comments
Closed

vpc_security_group_ids issue for RDS cross region read replica #15694

gao-jian-zz opened this issue Aug 2, 2017 · 2 comments

Comments

@gao-jian-zz
Copy link

gao-jian-zz commented Aug 2, 2017

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

@hashibot
Copy link
Contributor

hashibot commented Aug 3, 2017

This issue has been automatically migrated to hashicorp/terraform-provider-aws#1329 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to this issue and let us know.

@ghost
Copy link

ghost commented Apr 8, 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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants