Skip to content

Commit

Permalink
data.azurerm_app_service_environment - Expose vip information of an…
Browse files Browse the repository at this point in the history
… app service environment (#8487)
  • Loading branch information
favoretti authored Sep 16, 2020
1 parent 30c11e0 commit 1a1c201
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,24 @@ func dataSourceArmAppServiceEnvironment() *schema.Resource {
Computed: true,
},

"internal_ip_address": {
Type: schema.TypeString,
Computed: true,
},

"service_ip_address": {
Type: schema.TypeString,
Computed: true,
},

"outbound_ip_addresses": {
Type: schema.TypeList,
Elem: &schema.Schema{
Type: schema.TypeString,
},
Computed: true,
},

"pricing_tier": {
Type: schema.TypeString,
Computed: true,
Expand All @@ -62,6 +80,14 @@ func dataSourceArmAppServiceEnvironmentRead(d *schema.ResourceData, meta interfa
return fmt.Errorf("Error retrieving App Service Environment %q (Resource Group %q): %+v", name, resourceGroup, err)
}

vipInfo, err := client.GetVipInfo(ctx, resourceGroup, name)
if err != nil {
if utils.ResponseWasNotFound(vipInfo.Response) {
return fmt.Errorf("Error retrieving VIP info: App Service Environment %q (Resource Group %q) was not found", name, resourceGroup)
}
return fmt.Errorf("Error retrieving VIP info App Service Environment %q (Resource Group %q): %+v", name, resourceGroup, err)
}

d.SetId(*resp.ID)

d.Set("name", name)
Expand All @@ -82,5 +108,9 @@ func dataSourceArmAppServiceEnvironmentRead(d *schema.ResourceData, meta interfa
d.Set("pricing_tier", pricingTier)
}

d.Set("internal_ip_address", vipInfo.InternalIPAddress)
d.Set("service_ip_address", vipInfo.ServiceIPAddress)
d.Set("outbound_ip_addresses", vipInfo.OutboundIPAddresses)

return tags.FlattenAndSet(d, resp.Tags)
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ func TestAccDataSourceAzureRMAppServiceEnvironment_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(data.ResourceName, "front_end_scale_factor"),
resource.TestCheckResourceAttrSet(data.ResourceName, "pricing_tier"),
resource.TestCheckResourceAttrSet(data.ResourceName, "internal_ip_address"),
resource.TestCheckResourceAttrSet(data.ResourceName, "service_ip_address"),
resource.TestCheckResourceAttrSet(data.ResourceName, "outbound_ip_addresses"),
),
},
},
Expand Down
6 changes: 6 additions & 0 deletions website/docs/d/app_service_environment.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ output "app_service_environment_id" {

* `pricing_tier` - The Pricing Tier (Isolated SKU) of the App Service Environment.

* `internal_ip_address` - IP address of internal load balancer of the App Service Environment.

* `service_ip_address` - IP address of service endpoint of the App Service Environment.

* `outbound_ip_addresses` - Outbound IP addresses of the App Service Environment.

* `tags` - A mapping of tags assigned to the resource.

## Timeouts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ In addition to the Arguments listed above - the following Attributes are exporte

The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions:

* `read` - (Defaults to 5 minutes) Used when retrieving the Data Share Data Lake Gen2 Dataset.
* `read` - (Defaults to 5 minutes) Used when retrieving the Data Share Data Lake Gen2 Dataset.
2 changes: 1 addition & 1 deletion website/docs/d/lb_rule.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ In addition to the Arguments listed above - the following Attributes are exporte

The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions:

* `read` - (Defaults to 5 minutes) Used when retrieving the Load Balancer Rule.
* `read` - (Defaults to 5 minutes) Used when retrieving the Load Balancer Rule.
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ In addition to the Arguments listed above - the following Attributes are exporte

The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions:

* `read` - (Defaults to 5 minutes) Used when retrieving the ServiceBus Queue Authorisation Rule.
* `read` - (Defaults to 5 minutes) Used when retrieving the ServiceBus Queue Authorisation Rule.

0 comments on commit 1a1c201

Please sign in to comment.