diff --git a/aws/resource_aws_elasticsearch_domain.go b/aws/resource_aws_elasticsearch_domain.go index 86f1e9c7b45..634c40d02da 100644 --- a/aws/resource_aws_elasticsearch_domain.go +++ b/aws/resource_aws_elasticsearch_domain.go @@ -63,6 +63,10 @@ func resourceAwsElasticSearchDomain() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "kibana_endpoint": { + Type: schema.TypeString, + Computed: true, + }, "ebs_options": { Type: schema.TypeList, Optional: true, @@ -480,12 +484,14 @@ func resourceAwsElasticSearchDomainRead(d *schema.ResourceData, meta interface{} if err != nil { return err } + d.Set("kibana_endpoint", getKibanaEndpoint(d)) if ds.Endpoint != nil { return fmt.Errorf("%q: Elasticsearch domain in VPC expected to have null Endpoint value", d.Id()) } } else { if ds.Endpoint != nil { d.Set("endpoint", *ds.Endpoint) + d.Set("kibana_endpoint", getKibanaEndpoint(d)) } if ds.Endpoints != nil { return fmt.Errorf("%q: Elasticsearch domain not in VPC expected to have null Endpoints value", d.Id()) @@ -676,3 +682,7 @@ func resourceAwsElasticSearchDomainDelete(d *schema.ResourceData, meta interface return err } + +func getKibanaEndpoint(d *schema.ResourceData) string { + return d.Get("endpoint").(string) + "/_plugin/kibana/" +} diff --git a/aws/resource_aws_elasticsearch_domain_test.go b/aws/resource_aws_elasticsearch_domain_test.go index 5640fffb8cd..6c9ed40bc87 100644 --- a/aws/resource_aws_elasticsearch_domain_test.go +++ b/aws/resource_aws_elasticsearch_domain_test.go @@ -28,6 +28,7 @@ func TestAccAWSElasticSearchDomain_basic(t *testing.T) { testAccCheckESDomainExists("aws_elasticsearch_domain.example", &domain), resource.TestCheckResourceAttr( "aws_elasticsearch_domain.example", "elasticsearch_version", "1.5"), + resource.TestMatchResourceAttr("aws_elasticsearch_domain.example", "kibana_endpoint", regexp.MustCompile(".*es.amazonaws.com/_plugin/kibana/")), ), }, }, diff --git a/website/docs/r/elasticsearch_domain.html.markdown b/website/docs/r/elasticsearch_domain.html.markdown index dd825dcfc50..bc86cf60fcf 100644 --- a/website/docs/r/elasticsearch_domain.html.markdown +++ b/website/docs/r/elasticsearch_domain.html.markdown @@ -109,6 +109,7 @@ The following attributes are exported: * `arn` - Amazon Resource Name (ARN) of the domain. * `domain_id` - Unique identifier for the domain. * `endpoint` - Domain-specific endpoint used to submit index, search, and data upload requests. +* `kibana_endpoint` - Domain-specific endpoint for kibana without https scheme. * `vpc_options.0.availability_zones` - If the domain was created inside a VPC, the names of the availability zones the configured `subnet_ids` were created inside. * `vpc_options.0.vpc_id` - If the domain was created inside a VPC, the ID of the VPC.