diff --git a/azurerm/internal/services/web/app_service_environment_resource.go b/azurerm/internal/services/web/app_service_environment_resource.go index 0fe1cdcc0cf1..f94fed4d1f55 100644 --- a/azurerm/internal/services/web/app_service_environment_resource.go +++ b/azurerm/internal/services/web/app_service_environment_resource.go @@ -145,6 +145,26 @@ func resourceAppServiceEnvironment() *pluginsdk.Resource { "tags": tags.ForceNewSchema(), // Computed + + // VipInfo + "internal_ip_address": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "service_ip_address": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "outbound_ip_addresses": { + Type: pluginsdk.TypeList, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + Computed: true, + }, + "location": { Type: pluginsdk.TypeString, Computed: true, @@ -386,6 +406,19 @@ func resourceAppServiceEnvironmentRead(d *pluginsdk.ResourceData, meta interface d.Set("cluster_setting", flattenClusterSettings(props.ClusterSettings)) } + // Get IP attributes for ASE. + vipInfo, err := client.GetVipInfo(ctx, id.ResourceGroup, id.HostingEnvironmentName) + 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", id.HostingEnvironmentName, id.ResourceGroup) + } + return fmt.Errorf("Error retrieving VIP info App Service Environment %q (Resource Group %q): %+v", id.HostingEnvironmentName, id.ResourceGroup, err) + } + + 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, existing.Tags) } diff --git a/website/docs/r/app_service_environment.html.markdown b/website/docs/r/app_service_environment.html.markdown index 66c6d2a74b5f..a53dad76ad2e 100644 --- a/website/docs/r/app_service_environment.html.markdown +++ b/website/docs/r/app_service_environment.html.markdown @@ -92,8 +92,14 @@ A `cluster_setting` block supports the following: * `id` - The ID of the App Service Environment. +* `internal_ip_address` - IP address of internal load balancer of the App Service Environment. + * `location` - The location where the App Service Environment exists. +* `outbound_ip_addresses` - List of outbound IP addresses of the App Service Environment. + +* `service_ip_address` - IP address of service endpoint of the App Service Environment. + ## Timeouts The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: