-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Fixing global rds by allowing for optional parameters on cluster #7213
Conversation
322fc8d
to
116a681
Compare
39872e7
to
8fe010b
Compare
I'd really like to see this merged as I'm facing the issues outlined in #7212 Edit: Fixed typo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @bculberson 👋 Thank you so much for fixing this. I left a few notes below, but we'll definitely do the merge for the resource and documentation updates as they are good to go with the very minor adjustment to prevent a Terraform crash. 🚀
return fmt.Errorf(`provider.aws: aws_rds_cluster: %s: "master_username": required field is not set`, d.Get("database_name").(string)) | ||
if _, ok := d.GetOk("global_cluster_identifier"); !ok { | ||
if _, ok := d.GetOk("master_password"); !ok { | ||
return fmt.Errorf(`provider.aws: aws_db_instance: %s: "master_password": required field is not set`, d.Get("name").(string)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name
is not an attribute in this resource's schema, so can cause a panic as found by the acceptance testing:
=== CONT TestAccAWSRDSCluster_missingUserNameCausesError
------- Stderr: -------
panic: interface conversion: interface {} is nil, not string
goroutine 137 [running]:
github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsRDSClusterCreate(0xc000349260, 0x3c28320, 0xc0001adc00, 0xc000349260, 0x0)
/opt/teamcity-agent/work/2e10e023da0c7520/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_rds_cluster.go:718 +0x6d9d
Will fix this on merge.
%s | ||
|
||
resource "aws_rds_cluster" "test" { | ||
depends_on = ["aws_db_subnet_group.dbsubnet"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using depends_on
here, a direct reference can be used below instead:
db_subnet_group_name = "${aws_db_subnet_group.dbsubnet.name}"
resource "aws_rds_global_cluster" "test" { | ||
global_cluster_identifier = %q | ||
} | ||
|
||
resource "aws_rds_cluster" "test" { | ||
depends_on = ["aws_db_subnet_group.dbsubnet"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
depends_on
is extraneous here as there is already a direct reference below.
resource "aws_vpc" "vpc" { | ||
cidr_block = "10.0.0.0/16" | ||
tags = { | ||
Name = "terraform-acctest-rds-cluster-global-cross-region" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting up cross-region acceptance testing is a pretty complicated undertaking (see also: TestAccAWSRDSCluster_EncryptedCrossRegionReplication
). 😅 Since the implementation in 9b7a9b0 is only halfway there and has a few other little issues, opting to merge this pull request, but revert that commit until we can get a full, new test setup, preferably separate from the existing ones.
…or master_username Reference: #7213 (comment) Previous output from acceptance testing: ``` === CONT TestAccAWSRDSCluster_missingUserNameCausesError ------- Stderr: ------- panic: interface conversion: interface {} is nil, not string goroutine 137 [running]: github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsRDSClusterCreate(0xc000349260, 0x3c28320, 0xc0001adc00, 0xc000349260, 0x0) /opt/teamcity-agent/work/2e10e023da0c7520/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_rds_cluster.go:718 +0x6d9d ``` Output from acceptance testing: ``` --- PASS: TestAccAWSRDSCluster_missingUserNameCausesError (3.24s) ```
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. |
Unfortunately, it looks like this change hadn't actually fixed the problem. I had no luck at all trying to create a global RDS cluster via Terraform. There is a new related issue with all the details - #10188 |
Unfortunately this is still an issue. 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 |
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! |
Fixes #7212 and #7020
TBD: Add global acc test
Changes proposed in this pull request:
Allow username and password to be optional when using a global cluster identifier
Allow source region and global cluster identifier to be set for secondary region to come online
Output from acceptance testing: