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

azurerm_app_service - Add support for outbound_ip_address_list and possible_outbound_ip_address_list #9871

Merged
merged 3 commits into from
Dec 16, 2020
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
23 changes: 23 additions & 0 deletions azurerm/internal/services/web/app_service_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package web

import (
"fmt"
"strings"
"time"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
Expand Down Expand Up @@ -122,11 +123,27 @@ func dataSourceArmAppService() *schema.Resource {
Computed: true,
},

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

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

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

"source_control": schemaDataSourceAppServiceSiteSourceControl(),
},
}
Expand Down Expand Up @@ -197,7 +214,13 @@ func dataSourceArmAppServiceRead(d *schema.ResourceData, meta interface{}) error
d.Set("client_cert_enabled", props.ClientCertEnabled)
d.Set("default_site_hostname", props.DefaultHostName)
d.Set("outbound_ip_addresses", props.OutboundIPAddresses)
if props.OutboundIPAddresses != nil {
d.Set("outbound_ip_address_list", strings.Split(*props.OutboundIPAddresses, ","))
}
d.Set("possible_outbound_ip_addresses", props.PossibleOutboundIPAddresses)
if props.PossibleOutboundIPAddresses != nil {
d.Set("possible_outbound_ip_address_list", strings.Split(*props.PossibleOutboundIPAddresses, ","))
}
d.Set("custom_domain_verification_id", props.CustomDomainVerificationID)
}

Expand Down
2 changes: 2 additions & 0 deletions azurerm/internal/services/web/app_service_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ func TestAccDataSourceAzureRMAppService_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
check.That(data.ResourceName).Key("app_service_plan_id").Exists(),
check.That(data.ResourceName).Key("outbound_ip_addresses").Exists(),
check.That(data.ResourceName).Key("outbound_ip_address_list.#").Exists(),
check.That(data.ResourceName).Key("possible_outbound_ip_addresses").Exists(),
check.That(data.ResourceName).Key("possible_outbound_ip_address_list.#").Exists(),
check.That(data.ResourceName).Key("custom_domain_verification_id").Exists(),
check.That(data.ResourceName).Key("tags.%").HasValue("0"),
),
Expand Down
23 changes: 23 additions & 0 deletions azurerm/internal/services/web/app_service_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package web
import (
"fmt"
"log"
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/web/mgmt/2020-06-01/web"
Expand Down Expand Up @@ -177,10 +178,26 @@ func resourceArmAppService() *schema.Resource {
Computed: true,
},

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

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

"possible_outbound_ip_address_list": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
},
}
}
Expand Down Expand Up @@ -652,7 +669,13 @@ func resourceArmAppServiceRead(d *schema.ResourceData, meta interface{}) error {
d.Set("client_cert_enabled", props.ClientCertEnabled)
d.Set("default_site_hostname", props.DefaultHostName)
d.Set("outbound_ip_addresses", props.OutboundIPAddresses)
if props.OutboundIPAddresses != nil {
d.Set("outbound_ip_address_list", strings.Split(*props.OutboundIPAddresses, ","))
}
d.Set("possible_outbound_ip_addresses", props.PossibleOutboundIPAddresses)
if props.PossibleOutboundIPAddresses != nil {
d.Set("possible_outbound_ip_address_list", strings.Split(*props.PossibleOutboundIPAddresses, ","))
}
d.Set("custom_domain_verification_id", props.CustomDomainVerificationID)
}

Expand Down
2 changes: 2 additions & 0 deletions azurerm/internal/services/web/app_service_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ func TestAccAzureRMAppService_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("outbound_ip_addresses").Exists(),
check.That(data.ResourceName).Key("outbound_ip_address_list.#").Exists(),
check.That(data.ResourceName).Key("possible_outbound_ip_addresses").Exists(),
check.That(data.ResourceName).Key("possible_outbound_ip_address_list.#").Exists(),
check.That(data.ResourceName).Key("custom_domain_verification_id").Exists(),
),
},
Expand Down
4 changes: 4 additions & 0 deletions website/docs/d/app_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,12 @@ output "app_service_id" {

* `outbound_ip_addresses` - A comma separated list of outbound IP addresses - such as `52.23.25.3,52.143.43.12`

* `outbound_ip_address_list` - A list of outbound IP addresses - such as `["52.23.25.3", "52.143.43.12"]`

* `possible_outbound_ip_addresses` - A comma separated list of outbound IP addresses - such as `52.23.25.3,52.143.43.12,52.143.43.17` - not all of which are necessarily in use. Superset of `outbound_ip_addresses`.

* `possible_outbound_ip_address_list` - A list of outbound IP addresses - such as `["52.23.25.3", "52.143.43.12", "52.143.43.17"]` - not all of which are necessarily in use. Superset of `outbound_ip_address_list`.

* `source_control` - A `source_control` block as defined below.

---
Expand Down
4 changes: 4 additions & 0 deletions website/docs/r/app_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,12 @@ The following attributes are exported:

* `outbound_ip_addresses` - A comma separated list of outbound IP addresses - such as `52.23.25.3,52.143.43.12`

* `outbound_ip_address_list` - A list of outbound IP addresses - such as `["52.23.25.3", "52.143.43.12"]`

* `possible_outbound_ip_addresses` - A comma separated list of outbound IP addresses - such as `52.23.25.3,52.143.43.12,52.143.43.17` - not all of which are necessarily in use. Superset of `outbound_ip_addresses`.

* `possible_outbound_ip_address_list` - A list of outbound IP addresses - such as `["52.23.25.3", "52.143.43.12", "52.143.43.17"]` - not all of which are necessarily in use. Superset of `outbound_ip_address_list`.

* `source_control` - A `source_control` block as defined below, which contains the Source Control information when `scm_type` is set to `LocalGit`.

* `site_credential` - A `site_credential` block as defined below, which contains the site-level credentials used to publish to this App Service.
Expand Down