diff --git a/internal/services/appservice/linux_function_app_resource.go b/internal/services/appservice/linux_function_app_resource.go index 906a1f449f0c..5105b27ef4dd 100644 --- a/internal/services/appservice/linux_function_app_resource.go +++ b/internal/services/appservice/linux_function_app_resource.go @@ -72,7 +72,7 @@ type LinuxFunctionAppModel struct { PublishingFTPBasicAuthEnabled bool `tfschema:"ftp_publish_basic_authentication_enabled"` Identity []identity.ModelSystemAssignedUserAssigned `tfschema:"identity"` VnetImagePullEnabled bool `tfschema:"vnet_image_pull_enabled,addedInNextMajorVersion"` - VnetContentShareEnabled bool `tfschema:"website_content_over_vnet"` + VnetContentShareEnabled bool `tfschema:"website_content_share_over_vnet_enabled"` // Computed CustomDomainVerificationId string `tfschema:"custom_domain_verification_id"` @@ -308,11 +308,11 @@ func (r LinuxFunctionAppResource) Arguments() map[string]*pluginsdk.Schema { Description: "The local path and filename of the Zip packaged application to deploy to this Linux Function App. **Note:** Using this value requires either `WEBSITE_RUN_FROM_PACKAGE=1` or `SCM_DO_BUILD_DURING_DEPLOYMENT=true` to be set on the App in `app_settings`.", }, - "website_content_over_vnet": { + "website_content_share_over_vnet_enabled": { Type: pluginsdk.TypeBool, Optional: true, Default: false, - Description: "Should the app scale enabled when storage account restricted to a virtual network? Defaults to `false`.", + Description: "Should the traffic between the function app and the storage account be routed through the virtual network when Apps running in a Premium plan use a file share to store content? Defaults to `false`.", }, } if features.FourPointOhBeta() { @@ -507,15 +507,15 @@ func (r LinuxFunctionAppResource) Create() sdk.ResourceFunc { if !functionApp.StorageUsesMSI { suffix := uuid.New().String()[0:4] _, contentOverVnetEnabled := functionApp.AppSettings["WEBSITE_CONTENTOVERVNET"] - contentOverVnetEnabledSiteSetting := functionApp.VnetContentShareEnabled + contentShareOverVnetEnabledSiteSetting := functionApp.VnetContentShareEnabled _, contentSharePresent := functionApp.AppSettings["WEBSITE_CONTENTSHARE"] if _, contentShareConnectionStringPresent := functionApp.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"]; !contentShareConnectionStringPresent { functionApp.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"] = storageString } if !contentSharePresent { - if contentOverVnetEnabled || contentOverVnetEnabledSiteSetting { - return fmt.Errorf("the app_setting WEBSITE_CONTENTSHARE must be specified and set to a valid share when WEBSITE_CONTENTOVERVNET is specified") + if contentOverVnetEnabled || contentShareOverVnetEnabledSiteSetting { + return fmt.Errorf("the name of the content share that's set by the `WEBSITE_CONTENTSHARE` must be specified and set to a valid file share when premium function app use a file share to store content which enabled by setting the `website_content_share_over_vnet_enabled` to true") } functionApp.AppSettings["WEBSITE_CONTENTSHARE"] = fmt.Sprintf("%s-%s", strings.ToLower(functionApp.Name), suffix) } @@ -1081,7 +1081,7 @@ func (r LinuxFunctionAppResource) Update() sdk.ResourceFunc { model.Properties.SiteConfig.PublicNetworkAccess = model.Properties.PublicNetworkAccess } - if metadata.ResourceData.HasChange("website_content_over_vnet") { + if metadata.ResourceData.HasChange("website_content_share_over_vnet_enabled") { model.Properties.VnetContentShareEnabled = pointer.To(state.VnetContentShareEnabled) } diff --git a/internal/services/appservice/linux_function_app_resource_test.go b/internal/services/appservice/linux_function_app_resource_test.go index bb3d7b4e07fb..a8394bea23a3 100644 --- a/internal/services/appservice/linux_function_app_resource_test.go +++ b/internal/services/appservice/linux_function_app_resource_test.go @@ -198,28 +198,28 @@ func TestAccLinuxFunctionApp_websiteContentOverVnetUpdate(t *testing.T) { data.ResourceTest(t, r, []acceptance.TestStep{ { - Config: r.websiteContentOverVnet(data, SkuElasticPremiumPlan, "1", false), + Config: r.websiteContentOverVnet(data, SkuElasticPremiumPlan, false), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("app_settings.WEBSITE_CONTENTSHARE", "app_settings.%", "site_credential.0.password"), { - Config: r.websiteContentOverVnet(data, SkuElasticPremiumPlan, "1", true), + Config: r.websiteContentOverVnet(data, SkuElasticPremiumPlan, true), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("app_settings.WEBSITE_CONTENTSHARE", "app_settings.%", "site_credential.0.password"), { - Config: r.websiteContentOverVnet(data, SkuElasticPremiumPlan, "0", true), + Config: r.websiteContentOverVnet(data, SkuElasticPremiumPlan, true), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("app_settings.WEBSITE_CONTENTSHARE", "app_settings.%", "site_credential.0.password"), { - Config: r.websiteContentOverVnet(data, SkuElasticPremiumPlan, "0", false), + Config: r.websiteContentOverVnet(data, SkuElasticPremiumPlan, false), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), @@ -1957,7 +1957,7 @@ resource "azurerm_linux_function_app" "test" { } // nolint: unparam -func (r LinuxFunctionAppResource) websiteContentOverVnet(data acceptance.TestData, planSku string, websiteContentAppSetting string, websiteContentSiteConfig bool) string { +func (r LinuxFunctionAppResource) websiteContentOverVnet(data acceptance.TestData, planSku string, websiteContentSiteConfig bool) string { return fmt.Sprintf(` provider "azurerm" { features {} @@ -1981,18 +1981,17 @@ resource "azurerm_linux_function_app" "test" { storage_account_access_key = azurerm_storage_account.test.primary_access_key app_settings = { - WEBSITE_CONTENTOVERVNET = "%s" - WEBSITE_CONTENTSHARE = "shareforfa" + WEBSITE_CONTENTSHARE = "shareforfa" } site_config {} - website_content_over_vnet = %t + website_content_share_over_vnet_enabled = %t lifecycle { ignore_changes = [webdeploy_publish_basic_authentication_enabled, ftp_publish_basic_authentication_enabled] } } -`, r.template(data, planSku), data.RandomInteger, websiteContentAppSetting, websiteContentSiteConfig) +`, r.template(data, planSku), data.RandomInteger, websiteContentSiteConfig) } func (r LinuxFunctionAppResource) withCors(data acceptance.TestData, planSku string) string { diff --git a/internal/services/appservice/windows_function_app_resource.go b/internal/services/appservice/windows_function_app_resource.go index 5a453dd20e6c..21a791dfb6b5 100644 --- a/internal/services/appservice/windows_function_app_resource.go +++ b/internal/services/appservice/windows_function_app_resource.go @@ -70,7 +70,7 @@ type WindowsFunctionAppModel struct { PublishingDeployBasicAuthEnabled bool `tfschema:"webdeploy_publish_basic_authentication_enabled"` PublishingFTPBasicAuthEnabled bool `tfschema:"ftp_publish_basic_authentication_enabled"` VnetImagePullEnabled bool `tfschema:"vnet_image_pull_enabled,addedInNextMajorVersion"` - VnetContentShareEnabled bool `tfschema:"website_content_over_vnet"` + VnetContentShareEnabled bool `tfschema:"website_content_share_over_vnet_enabled"` // Computed CustomDomainVerificationId string `tfschema:"custom_domain_verification_id"` @@ -306,11 +306,11 @@ func (r WindowsFunctionAppResource) Arguments() map[string]*pluginsdk.Schema { Description: "The local path and filename of the Zip packaged application to deploy to this Windows Function App. **Note:** Using this value requires `WEBSITE_RUN_FROM_PACKAGE=1` to be set on the App in `app_settings`.", }, - "website_content_over_vnet": { + "website_content_share_over_vnet_enabled": { Type: pluginsdk.TypeBool, Optional: true, Default: false, - Description: "Should the app scale enabled when storage account restricted to a virtual network? Defaults to `false`.", + Description: "Should the traffic between the function app and the storage account be routed through the virtual network when Apps running in a Premium plan use a file share to store content? Defaults to `false`.", }, } if features.FourPointOhBeta() { @@ -508,15 +508,15 @@ func (r WindowsFunctionAppResource) Create() sdk.ResourceFunc { if !functionApp.StorageUsesMSI { suffix := uuid.New().String()[0:4] _, contentOverVnetEnabled := functionApp.AppSettings["WEBSITE_CONTENTOVERVNET"] - contentOverVnetEnabledSiteSetting := functionApp.VnetContentShareEnabled + contentShareOverVnetEnabledSiteSetting := functionApp.VnetContentShareEnabled _, contentSharePresent := functionApp.AppSettings["WEBSITE_CONTENTSHARE"] if _, contentShareConnectionStringPresent := functionApp.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"]; !contentShareConnectionStringPresent { functionApp.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"] = storageString } if !contentSharePresent { - if contentOverVnetEnabled || contentOverVnetEnabledSiteSetting { - return fmt.Errorf("the app_setting WEBSITE_CONTENTSHARE must be specified and set to a valid share when WEBSITE_CONTENTOVERVNET is specified") + if contentOverVnetEnabled || contentShareOverVnetEnabledSiteSetting { + return fmt.Errorf("the name of the content share that's set by the `WEBSITE_CONTENTSHARE` must be specified and set to a valid file share when premium function app use a file share to store content which enabled by setting the `website_content_share_over_vnet_enabled` to true") } functionApp.AppSettings["WEBSITE_CONTENTSHARE"] = fmt.Sprintf("%s-%s", strings.ToLower(functionApp.Name), suffix) } @@ -1042,15 +1042,15 @@ func (r WindowsFunctionAppResource) Update() sdk.ResourceFunc { if !state.StorageUsesMSI { suffix := uuid.New().String()[0:4] _, contentOverVnetEnabled := state.AppSettings["WEBSITE_CONTENTOVERVNET"] - contentOverVnetEnabledSiteSetting := state.VnetContentShareEnabled + contentShareOverVnetEnabledSiteSetting := state.VnetContentShareEnabled _, contentSharePresent := state.AppSettings["WEBSITE_CONTENTSHARE"] if _, contentShareConnectionStringPresent := state.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"]; !contentShareConnectionStringPresent { state.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"] = storageString } if !contentSharePresent { - if contentOverVnetEnabled || contentOverVnetEnabledSiteSetting { - return fmt.Errorf("the value of WEBSITE_CONTENTSHARE must be set to a predefined share when the storage account is restricted to a virtual network") + if contentOverVnetEnabled || contentShareOverVnetEnabledSiteSetting { + return fmt.Errorf("the name of the content share that's set by the `WEBSITE_CONTENTSHARE` must be specified and set to a valid file share when premium function app use a file share to store content which enabled by setting the `website_content_share_over_vnet_enabled` to true") } state.AppSettings["WEBSITE_CONTENTSHARE"] = fmt.Sprintf("%s-%s", strings.ToLower(state.Name), suffix) } @@ -1096,7 +1096,7 @@ func (r WindowsFunctionAppResource) Update() sdk.ResourceFunc { model.Properties.SiteConfig.PublicNetworkAccess = model.Properties.PublicNetworkAccess } - if metadata.ResourceData.HasChange("website_content_over_vnet") { + if metadata.ResourceData.HasChange("website_content_share_over_vnet_enabled") { model.Properties.VnetContentShareEnabled = pointer.To(state.VnetContentShareEnabled) } diff --git a/website/docs/d/linux_function_app.html.markdown b/website/docs/d/linux_function_app.html.markdown index fcf75d4537b0..5612b4b1363c 100644 --- a/website/docs/d/linux_function_app.html.markdown +++ b/website/docs/d/linux_function_app.html.markdown @@ -115,9 +115,7 @@ In addition to the Arguments listed above - the following Attributes are exporte * `webdeploy_publish_basic_authentication_enabled` - Are the default WebDeploy Basic Authentication publishing credentials enabled. -* `website_content_over_vnet` - Is function app scale enabled when the linked storage account is restricted to a virtual network? Defaults to `false`. - -!> **Note:** This property will replace the `WEBSITE_CONTENTOVERVNET` in `app_setting`. `website_content_over_vnet` is the recommended one despite both settings work currently. +* `website_content_share_over_vnet_enabled` - Is the traffic between the function app and the storage account be routed through the virtual network when Apps running in a Premium plan use a file share to store content. --- diff --git a/website/docs/d/windows_function_app.html.markdown b/website/docs/d/windows_function_app.html.markdown index aed4d8516cc5..3807d220590a 100644 --- a/website/docs/d/windows_function_app.html.markdown +++ b/website/docs/d/windows_function_app.html.markdown @@ -111,9 +111,7 @@ In addition to the Arguments listed above - the following Attributes are exporte * `webdeploy_publish_basic_authentication_enabled` - Are the default WebDeploy Basic Authentication publishing credentials enabled. -* `website_content_over_vnet` - Is function app scale enabled when the linked storage account is restricted to a virtual network? Defaults to `false`. - -!> **Note:** This property will replace the `WEBSITE_CONTENTOVERVNET` in `app_setting`. `website_content_over_vnet` is the recommended one despite both settings work currently. +* `website_content_share_over_vnet_enabled` - Is the traffic between the function app and the storage account be routed through the virtual network when Apps running in a Premium plan use a file share to store content. --- diff --git a/website/docs/r/linux_function_app.html.markdown b/website/docs/r/linux_function_app.html.markdown index a9b4dffd49ec..41dfe6aeb75d 100644 --- a/website/docs/r/linux_function_app.html.markdown +++ b/website/docs/r/linux_function_app.html.markdown @@ -148,6 +148,10 @@ The following arguments are supported: ~> **NOTE:** Setting this value to true will disable the ability to use `zip_deploy_file` which currently relies on the default publishing profile. +* `website_content_share_over_vnet_enabled` - (Optional) Should the traffic between the function app and the storage account be routed through the virtual network when Apps running in a Premium plan use a file share to store content? Defaults to `false`. + +!> **Note:** This property will replace the `WEBSITE_CONTENTOVERVNET` in `app_setting`. `website_content_share_over_vnet_enabled` is the recommended one despite both settings work currently. + * `zip_deploy_file` - (Optional) The local path and filename of the Zip packaged application to deploy to this Linux Function App. ~> **Note:** Using this value requires either `WEBSITE_RUN_FROM_PACKAGE=1` or `SCM_DO_BUILD_DURING_DEPLOYMENT=true` to be set on the App in `app_settings`. Refer to the [Azure docs](https://learn.microsoft.com/en-us/azure/azure-functions/functions-deployment-technologies) for further details. diff --git a/website/docs/r/windows_function_app.html.markdown b/website/docs/r/windows_function_app.html.markdown index 06118d18ff2f..8b4ecf4e01ad 100644 --- a/website/docs/r/windows_function_app.html.markdown +++ b/website/docs/r/windows_function_app.html.markdown @@ -148,6 +148,10 @@ The following arguments are supported: ~> **NOTE:** Setting this value to true will disable the ability to use `zip_deploy_file` which currently relies on the default publishing profile. +* `website_content_share_over_vnet_enabled` - (Optional) Should the traffic between the function app and the storage account be routed through the virtual network when Apps running in a Premium plan use a file share to store content? Defaults to `false`. + +!> **Note:** This property will replace the `WEBSITE_CONTENTOVERVNET` in `app_setting`. `website_content_share_over_vnet_enabled` is the recommended one despite both settings work currently. + * `zip_deploy_file` - (Optional) The local path and filename of the Zip packaged application to deploy to this Windows Function App. ~> **Note:** Using this value requires `WEBSITE_RUN_FROM_PACKAGE=1` to be set on the App in `app_settings`. Refer to the [Azure docs](https://learn.microsoft.com/en-us/azure/azure-functions/functions-deployment-technologies) for further details.