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

add Aurora create cross region read replica cluster function #11428

Merged
merged 1 commit into from
Jan 31, 2017

Conversation

arcadiatea
Copy link
Contributor

@arcadiatea arcadiatea commented Jan 26, 2017

Add feature for Aurora cross region read replica cluster function. replication_source_identifier be added and tested with ticketmaster test code.
I cannot provide test code updated for this feature in ../builtin/providers/aws/resource_aws_rds_cluster_test.go.
Couple reasons
a. aws_rds_cluster not return cluster arn, neither aws rds create-db-cluster. replication_source_identifier field requires cluster arn.
b. replication_source_identifier requires remote region. the function is not available for single region
c. a read replica cluster cannot be destroy, it needs to be promoted to independent cluster because destroy. The promote command probably not in terraform scope.

Create a read replica cluster took 90 minutes, because so the timeout of rds cluster be modified from 40 minutes to 120 minutes

@radeksimko radeksimko changed the title add Aurora create corss region read replica cluster function add Aurora create cross region read replica cluster function Jan 26, 2017
@arcadiatea
Copy link
Contributor Author

Any words on this one? We need this for our production DR solution.

@arcadiatea
Copy link
Contributor Author

This is fix for #11401.

@stack72
Copy link
Contributor

stack72 commented Jan 29, 2017

Hi @arcadiatea

Thanks for this work - this is looking great. Please can you tell me how I can test this to make sure it works as expected?

Thanks

Paul

@arcadiatea
Copy link
Contributor Author

Hi. Paul, I can paste the test code here.
The test step is,
a. I build an aruroa cluster on us-east-1 region under ticketmaster's account
b. I update the terraform test code to for testing this feature
c. observation: the test code will build read replicate successfully but when error out during destroy part because AWS not allow destroy a read replica aurora

~/builtin/providers/aws/resource_aws_rds_cluster_test.go

func TestAccAWSCluster_replication(t *testing.T) {
var v rds.DBCluster

resource.Test(t, resource.TestCase{
	PreCheck:     func() { testAccPreCheck(t) },
	Providers:    testAccProviders,
	CheckDestroy: testAccCheckAWSClusterDestroy,
	Steps: []resource.TestStep{
		{
			Config: testAccAWSCluster_replication(acctest.RandInt()),
			Check: resource.ComposeTestCheckFunc(
				testAccCheckAWSClusterExists("aws_rds_cluster.default", &v),
			),
		},
	},
})

}

func testAccAWSCluster_replication(n int) string {
return fmt.Sprintf(`

resource "aws_rds_cluster" "default" {
cluster_identifier = "tf-aurora-readcluster-%d"
availability_zones = ["us-west-2a","us-west-2b","us-west-2c"]
db_cluster_parameter_group_name = "default.aurora5.6"
replication_source_identifier = "arn:aws:rds:us-east-1:<account_number>:cluster: "
db_subnet_group_name = "db.sandbox"
tags {
Environment = "production"
}
}

resource "aws_rds_cluster_instance" "replica_instances" {
identifier = "tf-cluster-instance-r-%d"
cluster_identifier = "${aws_rds_cluster.default.id}"
instance_class = "db.t2.medium"
db_parameter_group_name = "default.aurora5.6"
}
`, n, n)
}

@stack72
Copy link
Contributor

stack72 commented Jan 31, 2017

Hi @arcadiatea

I am satisfied that this can't be tested in an automated fashion. I have checked the functionality that it doesn't break the existing path so this is GTG :)

Thanks for the work here

Paul

@stack72 stack72 merged commit 2639ffc into hashicorp:master Jan 31, 2017
arcadiatea added a commit to ticketmaster/terraform that referenced this pull request Feb 5, 2017
arcadiatea added a commit to ticketmaster/terraform that referenced this pull request Feb 5, 2017
arcadiatea added a commit to ticketmaster/terraform that referenced this pull request Feb 5, 2017
@brijeshsp
Copy link

brijeshsp commented Feb 20, 2017

Hi @stack72

Unable to deploy RDS cross-region read replica:
$ terraform version
Terraform v0.8.7

Error in terraform plan:

  • aws_rds_cluster.default: : invalid or unknown key: replication_source_identifier

But I see that in the changelog of 0.8.6, https://github.com/hashicorp/terraform/blob/master/CHANGELOG.md#086-07-february-2017
the change is available whereas the terraform binary doesn't show up the same.

Terraform code:

provider "aws" {
region = "us-west-2"
}

resource "aws_rds_cluster" "default" {
cluster_identifier = "tf-aurora-readcluster-1"
availability_zones = ["us-west-2a","us-west-2b","us-west-2c"]
db_cluster_parameter_group_name = "default.aurora5.6"
replication_source_identifier = "arn:aws:rds:us-east-1:<account_id>4:cluster:-cluster"
db_subnet_group_name = "default"
}

resource "aws_rds_cluster_instance" "replica_instances" {
identifier = "tf-cluster-instance-r-1"
cluster_identifier = "${aws_rds_cluster.default.id}"
instance_class = "db.t2.medium"
db_parameter_group_name = "default.aurora5.6"
}

@arcadiatea
Copy link
Contributor Author

arcadiatea commented Mar 5, 2017

I saw the code in master branch but not in 0.8.6, 0.8.7 or 0.8.8

@solled
Copy link

solled commented Mar 17, 2017

@stack72 Is there a plan for this to be available in the next version, and when that will be? We need it for our DR plan. Thank you.

@arcadiatea
Copy link
Contributor Author

@stack72 which version will include this feature? I saw the code is in master branch.

@jgruhl
Copy link

jgruhl commented Apr 13, 2017

@stack72 any update here?

@ghost
Copy link

ghost commented Apr 6, 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 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants