diff --git a/aws/resource_aws_redshift_cluster.go b/aws/resource_aws_redshift_cluster.go index 1a28ca15a10..6cde16cef90 100644 --- a/aws/resource_aws_redshift_cluster.go +++ b/aws/resource_aws_redshift_cluster.go @@ -193,6 +193,11 @@ func resourceAwsRedshiftCluster() *schema.Resource { Computed: true, }, + "dns_name": { + Type: schema.TypeString, + Computed: true, + }, + "cluster_public_key": { Type: schema.TypeString, Optional: true, @@ -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) } diff --git a/aws/resource_aws_redshift_cluster_test.go b/aws/resource_aws_redshift_cluster_test.go index f7db0b5c4d1..fea151fa276 100644 --- a/aws/resource_aws_redshift_cluster_test.go +++ b/aws/resource_aws_redshift_cluster_test.go @@ -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))), ), }, }, diff --git a/website/docs/r/redshift_cluster.html.markdown b/website/docs/r/redshift_cluster.html.markdown index 71c9da2879c..026c1675fde 100644 --- a/website/docs/r/redshift_cluster.html.markdown +++ b/website/docs/r/redshift_cluster.html.markdown @@ -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