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

issue #4566 add new attribute dns_name in aws_redshift_cluster #4582

Merged
merged 6 commits into from
May 23, 2018

Conversation

saravanan30erd
Copy link
Contributor

Fixes #4566

Output from acceptance testing:

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSRedshiftCluster_dnsName'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSRedshiftCluster_dnsName -timeout 120m
=== RUN   TestAccAWSRedshiftCluster_dnsName
--- PASS: TestAccAWSRedshiftCluster_dnsName (1258.35s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	1258.385s

@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label May 18, 2018
@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. service/redshift Issues and PRs that pertain to the redshift service. labels May 18, 2018
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.

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": {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@@ -193,6 +193,12 @@ func resourceAwsRedshiftCluster() *schema.Resource {
Computed: true,
},

"dns_name": {
Type: schema.TypeString,
Optional: true,
Copy link
Contributor

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

Copy link
Contributor Author

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),
Copy link
Contributor

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)))

Copy link
Contributor Author

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()
Copy link
Contributor

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()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

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

Copy link
Contributor Author

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) {
Copy link
Contributor

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 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@bflad bflad added the waiting-response Maintainers are waiting on response from community or contributor. label May 23, 2018
@ghost ghost added size/XS Managed by automation to categorize the size of a PR. and removed size/M Managed by automation to categorize the size of a PR. labels May 23, 2018
@bflad bflad removed the waiting-response Maintainers are waiting on response from community or contributor. label May 23, 2018
@ghost ghost added the size/XS Managed by automation to categorize the size of a PR. label May 23, 2018
@saravanan30erd
Copy link
Contributor Author

@bflad Done.

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSRedshiftCluster_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSRedshiftCluster_basic -timeout 120m
=== RUN TestAccAWSRedshiftCluster_basic
--- PASS: TestAccAWSRedshiftCluster_basic (1075.99s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 1076.028s

@bflad bflad added this to the v1.21.0 milestone May 23, 2018
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.

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)

@bflad bflad merged commit c7df9c9 into hashicorp:master May 23, 2018
bflad added a commit that referenced this pull request May 23, 2018
@bflad
Copy link
Contributor

bflad commented May 31, 2018

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.

@ghost
Copy link

ghost commented Apr 5, 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 Apr 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/redshift Issues and PRs that pertain to the redshift 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.

Requesting: aws_redshift_cluster.hostname
2 participants