Skip to content

Commit

Permalink
Merge pull request #10015 from xsalazar/resource_aws_elastic_beanstal…
Browse files Browse the repository at this point in the history
…k_environment/endpoint_url

Add support for getting EndpointURL directly from ElasticBeanstalk Environment resource
  • Loading branch information
bflad authored Sep 24, 2019
2 parents 119c1c7 + e649f1d commit ddf4698
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
7 changes: 7 additions & 0 deletions aws/resource_aws_elastic_beanstalk_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ func resourceAwsElasticBeanstalkEnvironment() *schema.Resource {
Optional: true,
ForceNew: true,
},
"endpoint_url": {
Type: schema.TypeString,
Computed: true,
},
"tier": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -649,6 +653,9 @@ func resourceAwsElasticBeanstalkEnvironmentRead(d *schema.ResourceData, meta int
if err := d.Set("triggers", flattenBeanstalkTrigger(resources.EnvironmentResources.Triggers)); err != nil {
return err
}
if err := d.Set("endpoint_url", env.EndpointURL); err != nil {
return err
}

tags, err := conn.ListTagsForResource(&elasticbeanstalk.ListTagsForResourceInput{
ResourceArn: aws.String(d.Get("arn").(string)),
Expand Down
3 changes: 3 additions & 0 deletions aws/resource_aws_elastic_beanstalk_environment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ func TestAccAWSBeanstalkEnv_outputs(t *testing.T) {
beanstalkElbNameRegexp := regexp.MustCompile("awseb.+?EBLoa[^,]+")
beanstalkInstancesNameRegexp := regexp.MustCompile("i-([0-9a-fA-F]{8}|[0-9a-fA-F]{17})")
beanstalkLcNameRegexp := regexp.MustCompile("awseb.+?AutoScalingLaunch[^,]+")
beanstalkEndpointUrl := regexp.MustCompile("awseb.+?EBLoa[^,].+?elb.amazonaws.com")

rString := acctest.RandString(8)
appName := fmt.Sprintf("tf_acc_app_env_outputs_%s", rString)
Expand All @@ -215,6 +216,8 @@ func TestAccAWSBeanstalkEnv_outputs(t *testing.T) {
"aws_elastic_beanstalk_environment.tfenvtest", "instances.0", beanstalkInstancesNameRegexp),
resource.TestMatchResourceAttr(
"aws_elastic_beanstalk_environment.tfenvtest", "launch_configurations.0", beanstalkLcNameRegexp),
resource.TestMatchResourceAttr(
"aws_elastic_beanstalk_environment.tfenvtest", "endpoint_url", beanstalkEndpointUrl),
),
},
},
Expand Down
17 changes: 9 additions & 8 deletions website/docs/r/elastic_beanstalk_environment.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,17 @@ In addition to all arguments above, the following attributes are exported:
* `tier` - The environment tier specified.
* `application` – The Elastic Beanstalk Application specified for this environment.
* `setting` – Settings specifically set for this Environment.
* `all_settings` – List of all option settings configured in the Environment. These
* `all_settings` – List of all option settings configured in this Environment. These
are a combination of default settings and their overrides from `setting` in
the configuration.
* `cname` - Fully qualified DNS name for the Environment.
* `autoscaling_groups` - The autoscaling groups used by this environment.
* `instances` - Instances used by this environment.
* `launch_configurations` - Launch configurations in use by this environment.
* `load_balancers` - Elastic load balancers in use by this environment.
* `queues` - SQS queues in use by this environment.
* `triggers` - Autoscaling triggers in use by this environment.
* `cname` - Fully qualified DNS name for this Environment.
* `autoscaling_groups` - The autoscaling groups used by this Environment.
* `instances` - Instances used by this Environment.
* `launch_configurations` - Launch configurations in use by this Environment.
* `load_balancers` - Elastic load balancers in use by this Environment.
* `queues` - SQS queues in use by this Environment.
* `triggers` - Autoscaling triggers in use by this Environment.
* `endpoint_url` - The URL to the Load Balancer for this Environment



Expand Down

0 comments on commit ddf4698

Please sign in to comment.