-
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
issue #4566 add new attribute dns_name in aws_redshift_cluster #4582
Conversation
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.
Thanks for submitting this @saravanan30erd! Please see the below and let us know if you have any questions.
@@ -193,6 +193,12 @@ func resourceAwsRedshiftCluster() *schema.Resource { | |||
Computed: true, | |||
}, | |||
|
|||
"dns_name": { |
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.
Any reason to not call this address
to match the API?
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.
I thought about that, but I checked the other resources to see how they are naming the address attributes(aws_alb, aws_elb) and used the same naming convention.
aws/resource_aws_redshift_cluster.go
Outdated
@@ -193,6 +193,12 @@ func resourceAwsRedshiftCluster() *schema.Resource { | |||
Computed: true, | |||
}, | |||
|
|||
"dns_name": { | |||
Type: schema.TypeString, | |||
Optional: true, |
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.
This attribute is not configurable so Optional: true,
should be removed. https://www.terraform.io/docs/extend/schemas/schema-behaviors.html#optional
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.
Correct, I just used the previous output attribute endpoint
format.
"aws_redshift_cluster.default", "cluster_type", "single-node"), | ||
resource.TestCheckResourceAttr( | ||
"aws_redshift_cluster.default", "publicly_accessible", "true"), | ||
testAccCheckAWSRedshiftClusterDNSName(&v, ri), |
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.
We can verify the value from the state using resource.TestMatchResourceAttr()
(and also making it generic for any region/partition):
resource.TestMatchResourceAttr("aws_redshift_cluster.default", "address", regexp.MustCompile(fmt.Sprintf("^tf-redshift-cluster-%d.*\.redshift\..*", ri)))
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.
thanks, done.
func TestAccAWSRedshiftCluster_dnsName(t *testing.T) { | ||
var v redshift.Cluster | ||
|
||
ri := rand.New(rand.NewSource(time.Now().UnixNano())).Int() |
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.
FYI, we have a helper for this: acctest.RandInt()
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.
👍
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.
I created a bunch of PRs related to replacing all these across the codebase so you won't need to do anything: #4625
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.
oh ok, I ll revert it.
@@ -126,6 +126,32 @@ func TestAccAWSRedshiftCluster_basic(t *testing.T) { | |||
}) | |||
} | |||
|
|||
func TestAccAWSRedshiftCluster_dnsName(t *testing.T) { |
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.
When adding a Computed: true
attribute that is always set, we can just add the singular attribute check (resource.TestMatchResourceAttr
mentioned below) to the _basic
test instead of a whole new acceptance test 👍
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.
👍
@bflad Done. $ make testacc TEST=./aws TESTARGS='-run=TestAccAWSRedshiftCluster_basic' |
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.
Looks good! 🚀
Test failures are unrelated:
=== RUN TestAccAWSRedshiftCluster_importBasic
--- PASS: TestAccAWSRedshiftCluster_importBasic (1133.46s)
=== RUN TestAccAWSRedshiftCluster_basic
--- PASS: TestAccAWSRedshiftCluster_basic (1275.67s)
=== RUN TestAccAWSRedshiftCluster_loggingEnabledDeprecated
--- PASS: TestAccAWSRedshiftCluster_loggingEnabledDeprecated (1326.70s)
=== RUN TestAccAWSRedshiftCluster_tags
--- PASS: TestAccAWSRedshiftCluster_tags (1373.87s)
=== RUN TestAccAWSRedshiftCluster_enhancedVpcRoutingEnabled
--- FAIL: TestAccAWSRedshiftCluster_enhancedVpcRoutingEnabled (1388.58s)
=== RUN TestAccAWSRedshiftCluster_publiclyAccessible
--- PASS: TestAccAWSRedshiftCluster_publiclyAccessible (1413.48s)
=== RUN TestAccAWSRedshiftCluster_loggingEnabled
--- PASS: TestAccAWSRedshiftCluster_loggingEnabled (1447.99s)
=== RUN TestAccAWSRedshiftCluster_withFinalSnapshot
--- PASS: TestAccAWSRedshiftCluster_withFinalSnapshot (1528.41s)
=== RUN TestAccAWSRedshiftCluster_kmsKey
--- PASS: TestAccAWSRedshiftCluster_kmsKey (1576.74s)
=== RUN TestAccAWSRedshiftCluster_snapshotCopy
--- PASS: TestAccAWSRedshiftCluster_snapshotCopy (1608.38s)
=== RUN TestAccAWSRedshiftCluster_iamRoles
--- PASS: TestAccAWSRedshiftCluster_iamRoles (1626.00s)
=== RUN TestAccAWSRedshiftCluster_forceNewUsername
--- PASS: TestAccAWSRedshiftCluster_forceNewUsername (2273.22s)
=== RUN TestAccAWSRedshiftCluster_updateNodeCount
--- PASS: TestAccAWSRedshiftCluster_updateNodeCount (3705.42s)
=== RUN TestAccAWSRedshiftCluster_updateNodeType
--- FAIL: TestAccAWSRedshiftCluster_updateNodeType (3748.18s)
This has been released in version 1.21.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
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 #4566
Output from acceptance testing: