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

Add support for getting EndpointURL directly from ElasticBeanstalk Environment resource #10015

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

Choose a reason for hiding this comment

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

Can you please also add documentation for this in the attributes reference for the resource? Thanks! website/docs/r/elastic_beanstalk_environment.html.markdown

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

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