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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions aws/resource_aws_redshift_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ 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.

Type: schema.TypeString,
Computed: true,
},

"cluster_public_key": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -567,6 +572,7 @@ func resourceAwsRedshiftClusterRead(d *schema.ResourceData, meta interface{}) er
if rsc.Endpoint.Port != nil {
endpoint = fmt.Sprintf("%s:%d", endpoint, *rsc.Endpoint.Port)
}
d.Set("dns_name", rsc.Endpoint.Address)
d.Set("port", rsc.Endpoint.Port)
d.Set("endpoint", endpoint)
}
Expand Down
1 change: 1 addition & 0 deletions aws/resource_aws_redshift_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ func TestAccAWSRedshiftCluster_basic(t *testing.T) {
"aws_redshift_cluster.default", "cluster_type", "single-node"),
resource.TestCheckResourceAttr(
"aws_redshift_cluster.default", "publicly_accessible", "true"),
resource.TestMatchResourceAttr("aws_redshift_cluster.default", "dns_name", regexp.MustCompile(fmt.Sprintf("^tf-redshift-cluster-%d.*\\.redshift\\..*", ri))),
),
},
},
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/redshift_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ The following attributes are exported:
* `encrypted` - Whether the data in the cluster is encrypted
* `cluster_security_groups` - The security groups associated with the cluster
* `vpc_security_group_ids` - The VPC security group Ids associated with the cluster
* `dns_name` - The DNS name of the cluster
* `port` - The Port the cluster responds on
* `cluster_version` - The version of Redshift engine software
* `cluster_parameter_group_name` - The name of the parameter group to be associated with this cluster
Expand Down