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

Unable to create rds global database in aws using Terraform #7020

Closed
ghost opened this issue Jan 3, 2019 · 10 comments
Closed

Unable to create rds global database in aws using Terraform #7020

ghost opened this issue Jan 3, 2019 · 10 comments
Labels
bug Addresses a defect in current functionality. service/rds Issues and PRs that pertain to the rds service.
Milestone

Comments

@ghost
Copy link

ghost commented Jan 3, 2019

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


Terraform Version

Terraform v0.11.11

Terraform Configuration Files

resource "aws_rds_global_cluster" "rdsglobal" {
  provider                  = "aws.primary"

  global_cluster_identifier = "${var.global_database_id}"
  storage_encrypted         = "${var.storage_encrypted}"
}

resource "aws_rds_cluster_instance" "primary" {
  provider                  = "aws.primary"
  count                     = "${var.instance_count}"
  identifier                = "${var.db_name}-${count.index+1}"
  cluster_identifier        = "${aws_rds_cluster.primary.id}"
  instance_class            = "${var.instance_class}"
  engine                    = "${var.engine}"
  engine_version            = "${var.engine_version}"
  publicly_accessible       = "${var.publicly_accessible}"

}

resource "aws_rds_cluster" "primary" {
  provider                  = "aws.primary"
  cluster_identifier        = "${var.primary_cluster_id}"
  database_name             = "${var.db_name}"
  port                      = "${var.port}"
  engine                    = "${var.engine}"
  engine_version            = "${var.engine_version}"
  master_username           = "${var.master_username}"
  master_password           = "${random_string.password.result}"
  vpc_security_group_ids    = ["${var.security_group_ids}"] 
  db_subnet_group_name      = "${var.db_subnet_group_name}" 
  storage_encrypted         = "${var.storage_encrypted}"
  backup_retention_period   = "${var.backup_retention_period}"
  skip_final_snapshot       = "${var.skip_final_snapshot}"
  engine_mode               = "${var.engine_mode}"
  global_cluster_identifier = "${aws_rds_global_cluster.rdsglobal.id}"

}


resource "aws_rds_cluster_instance" "secondary" {
  provider                  = "aws.secondary"
  count                     = "${var.instance_count}"
  identifier                = "${var.db_name}-${count.index+1}"
  cluster_identifier        = "${aws_rds_cluster.secondary.id}"
  instance_class            = "${var.instance_class}"
  engine                    = "${var.engine}"
  engine_version            = "${var.engine_version}"
  publicly_accessible       = "${var.publicly_accessible}"

}

resource "aws_rds_cluster" "secondary" {
  depends_on                = ["aws_rds_cluster_instance.primary"]
  provider                  = "aws.secondary"
  cluster_identifier        = "${var.secondary_cluster_id}"
  port                      = "${var.port}"
  engine                    = "${var.engine}"
  engine_version            = "${var.engine_version}"
  master_username           = "${var.master_username}"
  master_password           = "${random_string.password.result}"
  vpc_security_group_ids    = ["${var.secondary_security_group_ids}"] 
  db_subnet_group_name      = "${var.db_subnet_group_name}" 
  engine_mode               = "${var.engine_mode}"
  global_cluster_identifier = "${aws_rds_global_cluster.rdsglobal.id}"

}

Debug Output

Crash Output

Expected Behavior

A global database should be created with a primary cluster in one region and a secondary cluster in another region.

Actual Behavior

The primary cluster gets created but the secondary cluster fails with the following error-

* aws_rds_cluster.secondary: error creating RDS cluster: 
InvalidParameterCombination: Cannot specify user name for cross 
region replication cluster
status code: 400, request id: 10b82a78-898c-49e6-b28f- 
0a318fdc226f

I tried by removing master_username but I got the below error-

* aws_rds_cluster.secondary: provider.aws: aws_rds_cluster: : 
"master_username": required field is not set

I followed the steps from https://www.terraform.io/docs/providers/aws/r/rds_global_cluster.html

Steps to Reproduce

Additional Context

I was able to create the rds global database using aws cli as described in the link- https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-global-database.html#aurora-global-database-detaching

We are using terraform for all our provisioning. That's why I am trying to create a terraform module.

References

@araddas
Copy link

araddas commented Jan 4, 2019

I am seeing this same issue as well.

@bflad bflad added the service/rds Issues and PRs that pertain to the rds service. label Jan 5, 2019
@pratibhavijay
Copy link

pratibhavijay commented Jan 7, 2019

We are also facing the same issue.

@bflad
Copy link
Contributor

bflad commented Jan 7, 2019

Hi folks 👋 sorry for the hassle. This likely requires some aws_rds_cluster resource changes to be fully supported like the new aws_global_rds_cluster resource documentation suggests. Please feel free to use 👍 upvote reactions on the original issue above to help prioritize this change.

@bculberson
Copy link
Contributor

I fixed this in #7213

@araddas
Copy link

araddas commented Jan 23, 2019

@bculberson Awesome!

@bflad bflad added the bug Addresses a defect in current functionality. label Feb 22, 2019
@bflad bflad added this to the v1.60.0 milestone Feb 22, 2019
@bflad
Copy link
Contributor

bflad commented Feb 22, 2019

The fix for this has been merged and will release with version 1.60.0 of the Terraform AWS Provider, very shortly.

@bflad bflad closed this as completed Feb 22, 2019
@bflad
Copy link
Contributor

bflad commented Feb 22, 2019

This has been released in version 1.60.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@typez
Copy link

typez commented Oct 3, 2019

I wonder if anybody got it ever working and how it had been tested before merge? I'm facing pretty same issue with the recent AWS provider version. Details are exactly the same as in issue linked.

@diprochatterjee
Copy link

I have the same issue with creating a rds global cluster. The rds global cluster gets created but when I try to create an rds cluster as the primary cluster for the global cluster, it fails with error - * aws_rds_cluster.primary: error creating RDS cluster: InvalidParameterValue: The engine mode global you requested is currently unavailable. I am using Terraform version 0.11.11

@ghost
Copy link
Author

ghost commented Nov 1, 2019

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 Nov 1, 2019
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
Development

No branches or pull requests

6 participants