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

resource/db_instance: set SourceRegion based on source_db ARN #3795

Closed
wants to merge 1 commit into from

Conversation

omeid
Copy link
Contributor

@omeid omeid commented Mar 15, 2018

As Per AmazonRDS/API/CreateDBInstanceReadReplica docs

	If you create an encrypted Read Replica in a different AWS Region,
	then you must specify a KMS key for the destination AWS Region.
	KMS encryption keys are specific to the AWS Region that they are
	created in, and you can't use encryption keys from one AWS Region
	in another AWS Region.

This commit sets the Read Replica Source Region based on the
replicate_source_db arn.

kms_key_id is managed as usual.
Fixes: #518
Related: #3337, #865

@ghost ghost added the size/XS Managed by automation to categorize the size of a PR. label Mar 15, 2018
@ghost ghost added size/S Managed by automation to categorize the size of a PR. and removed size/XS Managed by automation to categorize the size of a PR. labels Mar 16, 2018
@omeid omeid changed the title db_instance: set SourceRegion based on source_db arn. resource/db_instance: set SourceRegion based on source_db ARN Mar 17, 2018
@omeid
Copy link
Contributor Author

omeid commented Mar 18, 2018

@catsby I believe you have done most of the db_instance read replica, so if you could review this, that would be excellent.

@omeid
Copy link
Contributor Author

omeid commented Mar 27, 2018

Requires aws/aws-sdk-go#1847 to land.

@vancluever vancluever added enhancement Requests to existing resources that expand the functionality or scope. service/rds Issues and PRs that pertain to the rds service. labels Mar 28, 2018
@ghost ghost added the size/S Managed by automation to categorize the size of a PR. label Mar 30, 2018
@jasdel
Copy link
Contributor

jasdel commented May 30, 2019

The AWS SDK for Go's aws/aws-sdk-go#1847 PR has been replaced with aws/aws-sdk-go#2631 adding the outstanding unit tests and will be merged into master once reviewed.

@omeid
Copy link
Contributor Author

omeid commented May 31, 2019

aws/aws-sdk-go#2631 just landed, so this is good to go.

@ghost ghost added size/XS Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. and removed size/S Managed by automation to categorize the size of a PR. labels May 31, 2019
@aeschright aeschright requested a review from a team June 25, 2019 19:23
@omeid
Copy link
Contributor Author

omeid commented Dec 9, 2019

Any chance this could be merged in? maintaining a fork because of pending bug fixes is rather painful.

Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @omeid 👋 Thank you for submitting this. For starters here, the maintainers will likely be looking for:

We will want to ensure that Terraform shows no difference if a replica_source_db ARN is provided and that no regressions are introduced with this change. Please reach out if you have any questions or do not have time to implement the testing.

Comment on lines +538 to +540
if arnParts := strings.Split(v.(string), ":"); len(arnParts) >= 4 {
opts.SourceRegion = aws.String(arnParts[3])
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check would be safer and easier to understand using the AWS Go SDK provided ARN handlers arn.IsARN() and arn.Parse(), e.g.

		if arn.IsARN(v.(string)) {
			replicaSourceDbArn, err := arn.Parse(v.(string))
			if err != nil {
				return fmt.Errorf("error parsing replica_source_db as ARN: %s", err)
			}
			opts.SourceRegion = aws.String(replicaSourceDbArn.Region)
		}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I can make that change. Just shows how long this pr has been sitting here. (;

@bflad bflad added the waiting-response Maintainers are waiting on response from community or contributor. label Dec 9, 2019
@bflad bflad self-assigned this Dec 9, 2019
@bflad
Copy link
Contributor

bflad commented Jan 23, 2020

Hi again 👋 Since we haven't heard back, we are going to close this pull request for now. If anyone is still interested in this change, please submit a new pull request and we will take a fresh look. Thanks.

@bflad bflad closed this Jan 23, 2020
@omeid
Copy link
Contributor Author

omeid commented Jan 24, 2020

I am still interested in fixing this. However, since we have been waiting for this for almost two years before we heard anything from Terrraform, we can't prioritize putting time into this.

Also, I personally find it a bit distasteful that you leave a contributor waiting for an answer for two years but then promptly close the issue once you don't get a reply in a month or so over holiday season.

@ghost ghost removed the waiting-response Maintainers are waiting on response from community or contributor. label Jan 24, 2020
@ghost
Copy link

ghost commented Mar 27, 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 Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/rds Issues and PRs that pertain to the rds service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

provider/aws: db_instance - Encrypted read-replica in a different region
4 participants