diff --git a/internal/services/appservice/helpers/function_app_schema.go b/internal/services/appservice/helpers/function_app_schema.go index 292e88c2e62a..274d46371eed 100644 --- a/internal/services/appservice/helpers/function_app_schema.go +++ b/internal/services/appservice/helpers/function_app_schema.go @@ -984,21 +984,23 @@ func SiteConfigSchemaWindowsFunctionAppComputed() *pluginsdk.Schema { type ApplicationStackLinuxFunctionApp struct { // Note - Function Apps differ to Web Apps here. They do not use the named properties in the SiteConfig block and exclusively use the app_settings map - DotNetVersion string `tfschema:"dotnet_version"` // Supported values `3.1`. Version 6 is in preview on Windows Only - NodeVersion string `tfschema:"node_version"` // Supported values `12LTS`, `14LTS` - PythonVersion string `tfschema:"python_version"` // Supported values `3.9`, `3.8`, `3.7` - PowerShellCoreVersion string `tfschema:"powershell_core_version"` // Supported values are `7.0` - JavaVersion string `tfschema:"java_version"` // Supported values `8`, `11` - CustomHandler bool `tfschema:"use_custom_runtime"` // Supported values `true` - Docker []ApplicationStackDocker `tfschema:"docker"` // Needs ElasticPremium or Basic (B1) Standard (S 1-3) or Premium(PxV2 or PxV3) LINUX Service Plan + DotNetVersion string `tfschema:"dotnet_version"` // Supported values `3.1`, `6`. + DotNetIsolated bool `tfschema:"use_dotnet_isolated_runtime"` // Supported values `true` for `dotnet-isolated`, `false` otherwise + NodeVersion string `tfschema:"node_version"` // Supported values `12LTS`, `14LTS` + PythonVersion string `tfschema:"python_version"` // Supported values `3.9`, `3.8`, `3.7` + PowerShellCoreVersion string `tfschema:"powershell_core_version"` // Supported values are `7.0` + JavaVersion string `tfschema:"java_version"` // Supported values `8`, `11` + CustomHandler bool `tfschema:"use_custom_runtime"` // Supported values `true` + Docker []ApplicationStackDocker `tfschema:"docker"` // Needs ElasticPremium or Basic (B1) Standard (S 1-3) or Premium(PxV2 or PxV3) LINUX Service Plan } type ApplicationStackWindowsFunctionApp struct { - DotNetVersion string `tfschema:"dotnet_version"` // Supported values `3.1`. Version 6 is in preview on Windows Only - NodeVersion string `tfschema:"node_version"` // Supported values `12LTS`, `14LTS` - JavaVersion string `tfschema:"java_version"` // Supported values `8`, `11` - PowerShellCoreVersion string `tfschema:"powershell_core_version"` // Supported values are `7.0` - CustomHandler bool `tfschema:"use_custom_runtime"` // Supported values `true` + DotNetVersion string `tfschema:"dotnet_version"` // Supported values `3.1`. Version 6 is in preview on Windows Only + DotNetIsolated bool `tfschema:"use_dotnet_isolated_runtime"` // Supported values `true` for `dotnet-isolated`, `false` otherwise + NodeVersion string `tfschema:"node_version"` // Supported values `12LTS`, `14LTS` + JavaVersion string `tfschema:"java_version"` // Supported values `8`, `11` + PowerShellCoreVersion string `tfschema:"powershell_core_version"` // Supported values are `7.0` + CustomHandler bool `tfschema:"use_custom_runtime"` // Supported values `true` } type ApplicationStackDocker struct { @@ -1021,7 +1023,7 @@ func linuxFunctionAppStackSchema() *pluginsdk.Schema { Optional: true, ValidateFunc: validation.StringInSlice([]string{ "3.1", - "6", + "6.0", }, false), ExactlyOneOf: []string{ "site_config.0.application_stack.0.dotnet_version", @@ -1032,7 +1034,22 @@ func linuxFunctionAppStackSchema() *pluginsdk.Schema { "site_config.0.application_stack.0.docker", "site_config.0.application_stack.0.use_custom_runtime", }, - Description: "The version of .Net. Possible values are `3.1` and `6`", + Description: "The version of .Net. Possible values are `3.1` and `6.0`", + }, + + "use_dotnet_isolated_runtime": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + ConflictsWith: []string{ + "site_config.0.application_stack.0.python_version", + "site_config.0.application_stack.0.java_version", + "site_config.0.application_stack.0.node_version", + "site_config.0.application_stack.0.powershell_core_version", + "site_config.0.application_stack.0.docker", + "site_config.0.application_stack.0.use_custom_runtime", + }, + Description: "Should the DotNet process use an isolated runtime. Defaults to `false`.", }, "python_version": { @@ -1195,6 +1212,11 @@ func linuxFunctionAppStackSchemaComputed() *pluginsdk.Schema { Computed: true, }, + "use_dotnet_isolated_runtime": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "python_version": { Type: pluginsdk.TypeString, Computed: true, @@ -1281,6 +1303,19 @@ func windowsFunctionAppStackSchema() *pluginsdk.Schema { Description: "The version of .Net. Possible values are `3.1` and `6`", }, + "use_dotnet_isolated_runtime": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + ConflictsWith: []string{ + "site_config.0.application_stack.0.java_version", + "site_config.0.application_stack.0.node_version", + "site_config.0.application_stack.0.powershell_core_version", + "site_config.0.application_stack.0.use_custom_runtime", + }, + Description: "Should the DotNet process use an isolated runtime. Defaults to `false`.", + }, + "node_version": { Type: pluginsdk.TypeString, Optional: true, @@ -1360,6 +1395,11 @@ func windowsFunctionAppStackSchemaComputed() *pluginsdk.Schema { Computed: true, }, + "use_dotnet_isolated_runtime": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "node_version": { Type: pluginsdk.TypeString, Computed: true, @@ -1515,11 +1555,19 @@ func ExpandSiteConfigLinuxFunctionApp(siteConfig []SiteConfigLinuxFunctionApp, e if len(linuxSiteConfig.ApplicationStack) > 0 { linuxAppStack := linuxSiteConfig.ApplicationStack[0] if linuxAppStack.DotNetVersion != "" { - appSettings = append(appSettings, web.NameValuePair{ - Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), - Value: utils.String("dotnet"), - }) - linuxSiteConfig.LinuxFxVersion = fmt.Sprintf("DOTNET|%s", linuxAppStack.DotNetVersion) + if linuxAppStack.DotNetIsolated { + appSettings = append(appSettings, web.NameValuePair{ + Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), + Value: utils.String("dotnet-isolated"), + }) + linuxSiteConfig.LinuxFxVersion = fmt.Sprintf("DOTNET-ISOLATED|%s", linuxAppStack.DotNetVersion) + } else { + appSettings = append(appSettings, web.NameValuePair{ + Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), + Value: utils.String("dotnet"), + }) + linuxSiteConfig.LinuxFxVersion = fmt.Sprintf("DOTNET|%s", linuxAppStack.DotNetVersion) + } } if linuxAppStack.NodeVersion != "" { @@ -1773,44 +1821,53 @@ func ExpandSiteConfigWindowsFunctionApp(siteConfig []SiteConfigWindowsFunctionAp if metadata.ResourceData.HasChange("site_config.0.application_stack") && len(windowsSiteConfig.ApplicationStack) > 0 { if len(windowsSiteConfig.ApplicationStack) > 0 { - linuxAppStack := windowsSiteConfig.ApplicationStack[0] - if linuxAppStack.DotNetVersion != "" { - appSettings = append(appSettings, web.NameValuePair{ - Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), - Value: utils.String("dotnet"), - }) - windowsSiteConfig.WindowsFxVersion = fmt.Sprintf("DOTNET|%s", linuxAppStack.DotNetVersion) + windowsAppStack := windowsSiteConfig.ApplicationStack[0] + if windowsAppStack.DotNetVersion != "" { + if windowsAppStack.DotNetIsolated { + appSettings = append(appSettings, web.NameValuePair{ + Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), + Value: utils.String("dotnet-isolated"), + }) + windowsSiteConfig.WindowsFxVersion = fmt.Sprintf("DOTNET-ISOLATED|%s", windowsAppStack.DotNetVersion) + + } else { + appSettings = append(appSettings, web.NameValuePair{ + Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), + Value: utils.String("dotnet"), + }) + windowsSiteConfig.WindowsFxVersion = fmt.Sprintf("DOTNET|%s", windowsAppStack.DotNetVersion) + } } - if linuxAppStack.NodeVersion != "" { + if windowsAppStack.NodeVersion != "" { appSettings = append(appSettings, web.NameValuePair{ Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), Value: utils.String("node"), }) appSettings = append(appSettings, web.NameValuePair{ Name: utils.String("WEBSITE_NODE_DEFAULT_VERSION"), - Value: utils.String(linuxAppStack.NodeVersion), + Value: utils.String(windowsAppStack.NodeVersion), }) - windowsSiteConfig.WindowsFxVersion = fmt.Sprintf("Node|%s", linuxAppStack.NodeVersion) + windowsSiteConfig.WindowsFxVersion = fmt.Sprintf("Node|%s", windowsAppStack.NodeVersion) } - if linuxAppStack.JavaVersion != "" { + if windowsAppStack.JavaVersion != "" { appSettings = append(appSettings, web.NameValuePair{ Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), Value: utils.String("java"), }) - windowsSiteConfig.WindowsFxVersion = fmt.Sprintf("Java|%s", linuxAppStack.JavaVersion) + windowsSiteConfig.WindowsFxVersion = fmt.Sprintf("Java|%s", windowsAppStack.JavaVersion) } - if linuxAppStack.PowerShellCoreVersion != "" { + if windowsAppStack.PowerShellCoreVersion != "" { appSettings = append(appSettings, web.NameValuePair{ Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), Value: utils.String("powershell"), }) - windowsSiteConfig.WindowsFxVersion = fmt.Sprintf("PowerShell|%s", linuxAppStack.PowerShellCoreVersion) + windowsSiteConfig.WindowsFxVersion = fmt.Sprintf("PowerShell|%s", windowsAppStack.PowerShellCoreVersion) } - if linuxAppStack.CustomHandler { + if windowsAppStack.CustomHandler { appSettings = append(appSettings, web.NameValuePair{ Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), Value: utils.String("custom"), diff --git a/internal/services/appservice/helpers/function_app_slot_schema.go b/internal/services/appservice/helpers/function_app_slot_schema.go index b2497263fdd5..dd213469737a 100644 --- a/internal/services/appservice/helpers/function_app_slot_schema.go +++ b/internal/services/appservice/helpers/function_app_slot_schema.go @@ -727,44 +727,53 @@ func ExpandSiteConfigWindowsFunctionAppSlot(siteConfig []SiteConfigWindowsFuncti if metadata.ResourceData.HasChange("site_config.0.application_stack") && len(windowsSlotSiteConfig.ApplicationStack) > 0 { if len(windowsSlotSiteConfig.ApplicationStack) > 0 { - linuxAppStack := windowsSlotSiteConfig.ApplicationStack[0] - if linuxAppStack.DotNetVersion != "" { - appSettings = append(appSettings, web.NameValuePair{ - Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), - Value: utils.String("dotnet"), - }) - windowsSlotSiteConfig.WindowsFxVersion = fmt.Sprintf("DOTNET|%s", linuxAppStack.DotNetVersion) + windowsAppStack := windowsSlotSiteConfig.ApplicationStack[0] + if windowsAppStack.DotNetVersion != "" { + if windowsAppStack.DotNetIsolated { + appSettings = append(appSettings, web.NameValuePair{ + Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), + Value: utils.String("dotnet-isolated"), + }) + windowsSlotSiteConfig.WindowsFxVersion = fmt.Sprintf("DOTNET-ISOLATED|%s", windowsAppStack.DotNetVersion) + + } else { + appSettings = append(appSettings, web.NameValuePair{ + Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), + Value: utils.String("dotnet"), + }) + windowsSlotSiteConfig.WindowsFxVersion = fmt.Sprintf("DOTNET|%s", windowsAppStack.DotNetVersion) + } } - if linuxAppStack.NodeVersion != "" { + if windowsAppStack.NodeVersion != "" { appSettings = append(appSettings, web.NameValuePair{ Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), Value: utils.String("node"), }) appSettings = append(appSettings, web.NameValuePair{ Name: utils.String("WEBSITE_NODE_DEFAULT_VERSION"), - Value: utils.String(linuxAppStack.NodeVersion), + Value: utils.String(windowsAppStack.NodeVersion), }) - windowsSlotSiteConfig.WindowsFxVersion = fmt.Sprintf("Node|%s", linuxAppStack.NodeVersion) + windowsSlotSiteConfig.WindowsFxVersion = fmt.Sprintf("Node|%s", windowsAppStack.NodeVersion) } - if linuxAppStack.JavaVersion != "" { + if windowsAppStack.JavaVersion != "" { appSettings = append(appSettings, web.NameValuePair{ Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), Value: utils.String("java"), }) - windowsSlotSiteConfig.WindowsFxVersion = fmt.Sprintf("Java|%s", linuxAppStack.JavaVersion) + windowsSlotSiteConfig.WindowsFxVersion = fmt.Sprintf("Java|%s", windowsAppStack.JavaVersion) } - if linuxAppStack.PowerShellCoreVersion != "" { + if windowsAppStack.PowerShellCoreVersion != "" { appSettings = append(appSettings, web.NameValuePair{ Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), Value: utils.String("powershell"), }) - windowsSlotSiteConfig.WindowsFxVersion = fmt.Sprintf("PowerShell|%s", linuxAppStack.PowerShellCoreVersion) + windowsSlotSiteConfig.WindowsFxVersion = fmt.Sprintf("PowerShell|%s", windowsAppStack.PowerShellCoreVersion) } - if linuxAppStack.CustomHandler { + if windowsAppStack.CustomHandler { appSettings = append(appSettings, web.NameValuePair{ Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), Value: utils.String("custom"), @@ -1024,11 +1033,19 @@ func ExpandSiteConfigLinuxFunctionAppSlot(siteConfig []SiteConfigLinuxFunctionAp if len(linuxSlotSiteConfig.ApplicationStack) > 0 { linuxAppStack := linuxSlotSiteConfig.ApplicationStack[0] if linuxAppStack.DotNetVersion != "" { - appSettings = append(appSettings, web.NameValuePair{ - Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), - Value: utils.String("dotnet"), - }) - linuxSlotSiteConfig.LinuxFxVersion = fmt.Sprintf("DOTNET|%s", linuxAppStack.DotNetVersion) + if linuxAppStack.DotNetIsolated { + appSettings = append(appSettings, web.NameValuePair{ + Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), + Value: utils.String("dotnet-isolated"), + }) + linuxSlotSiteConfig.LinuxFxVersion = fmt.Sprintf("DOTNET-ISOLATED|%s", linuxAppStack.DotNetVersion) + } else { + appSettings = append(appSettings, web.NameValuePair{ + Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), + Value: utils.String("dotnet"), + }) + linuxSlotSiteConfig.LinuxFxVersion = fmt.Sprintf("DOTNET|%s", linuxAppStack.DotNetVersion) + } } if linuxAppStack.NodeVersion != "" { diff --git a/internal/services/appservice/helpers/fx_strings.go b/internal/services/appservice/helpers/fx_strings.go index e1412b3fa0bf..58e9868d0e96 100644 --- a/internal/services/appservice/helpers/fx_strings.go +++ b/internal/services/appservice/helpers/fx_strings.go @@ -61,22 +61,31 @@ func EncodeFunctionAppLinuxFxVersion(input []ApplicationStackLinuxFunctionApp) * var appType, appString string switch { case appStack.NodeVersion != "": - appType = "Node" + appType = "NODE" appString = appStack.NodeVersion + case appStack.DotNetVersion != "": - appType = "DotNet" + if appStack.DotNetIsolated { + appType = "DOTNET-ISOLATED" + } else { + appType = "DOTNET" + } appString = appStack.DotNetVersion + case appStack.PythonVersion != "": - appType = "Python" + appType = "PYTHON" appString = appStack.PythonVersion + case appStack.JavaVersion != "": - appType = "Java" + appType = "JAVA" appString = appStack.JavaVersion + case appStack.PowerShellCoreVersion != "": - appType = "PowerShell" + appType = "POWERSHELL" appString = appStack.PowerShellCoreVersion + case len(appStack.Docker) > 0 && appStack.Docker[0].ImageName != "": - appType = "Docker" + appType = "DOCKER" dockerCfg := appStack.Docker[0] if dockerCfg.RegistryURL != "" { appString = fmt.Sprintf("%s/%s:%s", strings.Trim(dockerCfg.RegistryURL, "/"), dockerCfg.ImageName, dockerCfg.ImageTag) @@ -106,6 +115,10 @@ func DecodeFunctionAppLinuxFxVersion(input string) ([]ApplicationStackLinuxFunct appStack := ApplicationStackLinuxFunctionApp{DotNetVersion: parts[1]} result = append(result, appStack) + case "dotnet-isolated": + appStack := ApplicationStackLinuxFunctionApp{DotNetVersion: parts[1], DotNetIsolated: true} + result = append(result, appStack) + case "node": appStack := ApplicationStackLinuxFunctionApp{NodeVersion: parts[1]} result = append(result, appStack) @@ -166,12 +179,19 @@ func EncodeFunctionAppWindowsFxVersion(input []ApplicationStackWindowsFunctionAp case appStack.NodeVersion != "": appType = "Node" appString = appStack.NodeVersion + case appStack.DotNetVersion != "": - appType = "DotNet" + if appStack.DotNetIsolated { + appType = "DotNet-Isolated" + } else { + appType = "DotNet" + } appString = appStack.DotNetVersion + case appStack.JavaVersion != "": appType = "Java" appString = appStack.JavaVersion + case appStack.PowerShellCoreVersion != "": appType = "PowerShell" appString = appStack.PowerShellCoreVersion @@ -198,6 +218,10 @@ func DecodeFunctionAppWindowsFxVersion(input string) ([]ApplicationStackWindowsF appStack := ApplicationStackWindowsFunctionApp{DotNetVersion: parts[1]} result = append(result, appStack) + case "dotnet-isolated": + appStack := ApplicationStackWindowsFunctionApp{DotNetVersion: parts[1], DotNetIsolated: true} + result = append(result, appStack) + case "node": appStack := ApplicationStackWindowsFunctionApp{NodeVersion: parts[1]} result = append(result, appStack) diff --git a/internal/services/appservice/helpers/web_app_schema.go b/internal/services/appservice/helpers/web_app_schema.go index 4db95cd5c422..918a0f0d5e77 100644 --- a/internal/services/appservice/helpers/web_app_schema.go +++ b/internal/services/appservice/helpers/web_app_schema.go @@ -1085,6 +1085,7 @@ func linuxApplicationStackSchema() *pluginsdk.Schema { "2.1", "3.1", "5.0", + "6.0", }, false), ConflictsWith: []string{ "site_config.0.application_stack.0.php_version", diff --git a/internal/services/appservice/linux_function_app_resource_test.go b/internal/services/appservice/linux_function_app_resource_test.go index 8259d247337f..cdaadac49c9c 100644 --- a/internal/services/appservice/linux_function_app_resource_test.go +++ b/internal/services/appservice/linux_function_app_resource_test.go @@ -641,7 +641,7 @@ func TestAccLinuxFunctionApp_appStackDotNet6(t *testing.T) { data.ResourceTest(t, r, []acceptance.TestStep{ { - Config: r.appStackDotNet(data, SkuBasicPlan, "6"), + Config: r.appStackDotNet(data, SkuBasicPlan, "6.0"), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("kind").HasValue("functionapp,linux"), @@ -651,6 +651,23 @@ func TestAccLinuxFunctionApp_appStackDotNet6(t *testing.T) { }) } +func TestAccLinuxFunctionApp_appStackDotNet6Isolated(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_linux_function_app", "test") + r := LinuxFunctionAppResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.appStackDotNetIsolated(data, SkuBasicPlan, "6.0"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("kind").HasValue("functionapp,linux"), + check.That(data.ResourceName).Key("site_config.0.linux_fx_version").HasValue("DOTNET-ISOLATED|6.0"), + ), + }, + data.ImportStep(), + }) +} + func TestAccLinuxFunctionApp_appStackPython(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_linux_function_app", "test") r := LinuxFunctionAppResource{} @@ -1436,6 +1453,35 @@ resource "azurerm_linux_function_app" "test" { `, r.template(data, planSku), data.RandomInteger, version) } +func (r LinuxFunctionAppResource) appStackDotNetIsolated(data acceptance.TestData, planSku string, version string) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%s + +resource "azurerm_linux_function_app" "test" { + name = "acctest-LFA-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + service_plan_id = azurerm_service_plan.test.id + + storage_account_name = azurerm_storage_account.test.name + storage_account_access_key = azurerm_storage_account.test.primary_access_key + + site_config { + always_on = true + + application_stack { + dotnet_version = "%s" + use_dotnet_isolated_runtime = true + } + } +} +`, r.template(data, planSku), data.RandomInteger, version) +} + func (r LinuxFunctionAppResource) appStackPython(data acceptance.TestData, planSku string, pythonVersion string) string { return fmt.Sprintf(` provider "azurerm" { diff --git a/internal/services/appservice/linux_function_app_slot_resource_test.go b/internal/services/appservice/linux_function_app_slot_resource_test.go index 1c8ad8e76dde..6e40cefc2737 100644 --- a/internal/services/appservice/linux_function_app_slot_resource_test.go +++ b/internal/services/appservice/linux_function_app_slot_resource_test.go @@ -592,7 +592,23 @@ func TestAccLinuxFunctionAppSlot_appStackDotNet6(t *testing.T) { data.ResourceTest(t, r, []acceptance.TestStep{ { - Config: r.appStackDotNet(data, SkuStandardPlan, "6"), + Config: r.appStackDotNet(data, SkuStandardPlan, "6.0"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("kind").HasValue("functionapp,linux"), + ), + }, + data.ImportStep(), + }) +} + +func TestAccLinuxFunctionAppSlot_appStackDotNet6Isolated(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_linux_function_app_slot", "test") + r := LinuxFunctionAppSlotResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.appStackDotNetIsolated(data, SkuStandardPlan, "6.0"), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("kind").HasValue("functionapp,linux"), @@ -1260,6 +1276,30 @@ resource "azurerm_linux_function_app_slot" "test" { `, r.template(data, planSku), data.RandomInteger, version) } +func (r LinuxFunctionAppSlotResource) appStackDotNetIsolated(data acceptance.TestData, planSku string, version string) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%s + +resource "azurerm_linux_function_app_slot" "test" { + name = "acctest-LFAS-%d" + function_app_id = azurerm_linux_function_app.test.id + storage_account_name = azurerm_storage_account.test.name + storage_account_access_key = azurerm_storage_account.test.primary_access_key + + site_config { + application_stack { + dotnet_version = "%s" + use_dotnet_isolated_runtime = true + } + } +} +`, r.template(data, planSku), data.RandomInteger, version) +} + func (r LinuxFunctionAppSlotResource) appStackPython(data acceptance.TestData, planSku string, pythonVersion string) string { return fmt.Sprintf(` provider "azurerm" { diff --git a/internal/services/appservice/windows_function_app_resource_test.go b/internal/services/appservice/windows_function_app_resource_test.go index 95e82fd97435..d6d113a7cb98 100644 --- a/internal/services/appservice/windows_function_app_resource_test.go +++ b/internal/services/appservice/windows_function_app_resource_test.go @@ -692,6 +692,22 @@ func TestAccWindowsFunctionApp_appStackDotNet6(t *testing.T) { data.ImportStep(), }) } +func TestAccWindowsFunctionApp_appStackDotNet6Isolated(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_windows_function_app", "test") + r := WindowsFunctionAppResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.appStackDotNetIsolated(data, SkuBasicPlan, "6"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("kind").HasValue("functionapp"), + check.That(data.ResourceName).Key("site_config.0.windows_fx_version").HasValue("DotNet-Isolated|6"), + ), + }, + data.ImportStep(), + }) +} func TestAccWindowsFunctionApp_appStackNode(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_windows_function_app", "test") @@ -1810,6 +1826,33 @@ resource "azurerm_windows_function_app" "test" { `, r.template(data, planSku), data.RandomInteger, version) } +func (r WindowsFunctionAppResource) appStackDotNetIsolated(data acceptance.TestData, planSku string, version string) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%s + +resource "azurerm_windows_function_app" "test" { + name = "acctest-WFA-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + service_plan_id = azurerm_service_plan.test.id + + storage_account_name = azurerm_storage_account.test.name + storage_account_access_key = azurerm_storage_account.test.primary_access_key + + site_config { + application_stack { + dotnet_version = "%s" + use_dotnet_isolated_runtime = true + } + } +} +`, r.template(data, planSku), data.RandomInteger, version) +} + func (r WindowsFunctionAppResource) appStackNode(data acceptance.TestData, planSku string, nodeVersion string) string { return fmt.Sprintf(` provider "azurerm" { diff --git a/internal/services/appservice/windows_function_app_slot_resource_test.go b/internal/services/appservice/windows_function_app_slot_resource_test.go index 2d2f1e171451..67f53a17047f 100644 --- a/internal/services/appservice/windows_function_app_slot_resource_test.go +++ b/internal/services/appservice/windows_function_app_slot_resource_test.go @@ -602,6 +602,22 @@ func TestAccWindowsFunctionAppSlot_appStackDotNet6(t *testing.T) { }) } +func TestAccWindowsFunctionAppSlot_appStackDotNet6Isolated(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_windows_function_app_slot", "test") + r := WindowsFunctionAppSlotResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.appStackDotNetIsolated(data, SkuStandardPlan, "6"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("kind").HasValue("functionapp"), + ), + }, + data.ImportStep(), + }) +} + func TestAccWindowsFunctionAppSlot_appStackNode(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_windows_function_app_slot", "test") r := WindowsFunctionAppSlotResource{} @@ -1683,6 +1699,30 @@ resource "azurerm_windows_function_app_slot" "test" { `, r.template(data, planSku), data.RandomInteger, version) } +func (r WindowsFunctionAppSlotResource) appStackDotNetIsolated(data acceptance.TestData, planSku string, version string) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%s + +resource "azurerm_windows_function_app_slot" "test" { + name = "acctest-WFAS-%d" + function_app_id = azurerm_windows_function_app.test.id + storage_account_name = azurerm_storage_account.test.name + storage_account_access_key = azurerm_storage_account.test.primary_access_key + + site_config { + application_stack { + dotnet_version = "%s" + use_dotnet_isolated_runtime = true + } + } +} +`, r.template(data, planSku), data.RandomInteger, version) +} + func (r WindowsFunctionAppSlotResource) appStackNode(data acceptance.TestData, planSku string, nodeVersion string) string { return fmt.Sprintf(` provider "azurerm" { diff --git a/website/docs/r/linux_function_app.html.markdown b/website/docs/r/linux_function_app.html.markdown index dd6177b6592f..8df9f467c678 100644 --- a/website/docs/r/linux_function_app.html.markdown +++ b/website/docs/r/linux_function_app.html.markdown @@ -130,7 +130,9 @@ A `application_stack` block supports the following: * `docker` - (Optional) One or more `docker` blocks as defined below. -* `dotnet_version` - (Optional) The version of .Net to use. Possible values include `3.1` and `6`. +* `dotnet_version` - (Optional) The version of .Net to use. Possible values include `3.1` and `6.0`. + +* `use_dotnet_isolated_runtime` - (Optional) Should the DotNet process use an isolated runtime. Defaults to `false`. * `java_version` - (Optional) The Version of Java to use. Supported versions include `8`, and `11`. diff --git a/website/docs/r/linux_function_app_slot.html.markdown b/website/docs/r/linux_function_app_slot.html.markdown index 28cf9fcd9be9..58dbc8c0c657 100644 --- a/website/docs/r/linux_function_app_slot.html.markdown +++ b/website/docs/r/linux_function_app_slot.html.markdown @@ -378,9 +378,11 @@ An `application_stack` block supports the following: * `docker` - (Optional) a `docker` block as detailed below. -* `dotnet_version` - (Optional) The version of .Net. Possible values are `3.1` and `6` +* `dotnet_version` - (Optional) The version of .Net. Possible values are `3.1` and `6.0`. -* `java_version` - (Optional) The version of Java to use. Possible values are `8`, and `11` +* `use_dotnet_isolated_runtime` - (Optional) Should the DotNet process use an isolated runtime. Defaults to `false`. + +* `java_version` - (Optional) The version of Java to use. Possible values are `8`, and `11`. * `node_version` - (Optional) The version of Node to use. Possible values include `12`, and `14` diff --git a/website/docs/r/linux_web_app.html.markdown b/website/docs/r/linux_web_app.html.markdown index 7d0ac8bd684a..1bdcc1d2374a 100644 --- a/website/docs/r/linux_web_app.html.markdown +++ b/website/docs/r/linux_web_app.html.markdown @@ -123,9 +123,9 @@ A `application_stack` block supports the following: * `docker_image` - (Optional) The Docker image reference, including repository host as needed. -* `docker_image_tag` - (Optional) The image Tag to use. e.g. `latest` +* `docker_image_tag` - (Optional) The image Tag to use. e.g. `latest`. -* `dotnet_version` - (Optional) The version of .Net to use. Possible values include `2.1`, `3.1`, and `5.0`. +* `dotnet_version` - (Optional) The version of .Net to use. Possible values include `2.1`, `3.1`, `5.0`, and `6.0`. * `java_server` - (Optional) The java server type. Possible values include `JAVA`, `TOMCAT`, and `JBOSSEAP`. diff --git a/website/docs/r/linux_web_app_slot.html.markdown b/website/docs/r/linux_web_app_slot.html.markdown index 30550275bf62..de710003f07c 100644 --- a/website/docs/r/linux_web_app_slot.html.markdown +++ b/website/docs/r/linux_web_app_slot.html.markdown @@ -126,9 +126,9 @@ A `application_stack` block supports the following: * `docker_image` - (Optional) The Docker image reference, including repository host as needed. -* `docker_image_tag` - (Optional) The image Tag to use. e.g. `latest` +* `docker_image_tag` - (Optional) The image Tag to use. e.g. `latest`. -* `dotnet_version` - (Optional) The version of .Net to use. Possible values include `2.1`, `3.1`, and `5.0`. +* `dotnet_version` - (Optional) The version of .Net to use. Possible values include `2.1`, `3.1`, `5.0`, and `6.0`. * `java_server` - (Optional) The java server type. Possible values include `JAVA`, `TOMCAT`, and `JBOSSEAP`. diff --git a/website/docs/r/windows_function_app.html.markdown b/website/docs/r/windows_function_app.html.markdown index a57ad7ba61c0..b0cd27871b75 100644 --- a/website/docs/r/windows_function_app.html.markdown +++ b/website/docs/r/windows_function_app.html.markdown @@ -130,6 +130,8 @@ A `application_stack` block supports the following: * `dotnet_version` - (Optional) The version of .Net to use. Possible values include `3.1` and `6`. +* `use_dotnet_isolated_runtime` - (Optional) Should the DotNet process use an isolated runtime. Defaults to `false`. + * `java_version` - (Optional) The Version of Java to use. Supported versions include `8`, and `11`. * `node_version` - (Optional) The version of Node to run. Possible values include `~12`, `~14`, and `~16`. diff --git a/website/docs/r/windows_function_app_slot.html.markdown b/website/docs/r/windows_function_app_slot.html.markdown index b5bb7f35a798..1964868bd7f2 100644 --- a/website/docs/r/windows_function_app_slot.html.markdown +++ b/website/docs/r/windows_function_app_slot.html.markdown @@ -373,6 +373,8 @@ An `application_stack` block supports the following: * `dotnet_version` - (Optional) The version of .Net. Possible values are `3.1` and `6` +* `use_dotnet_isolated_runtime` - (Optional) Should the DotNet process use an isolated runtime. Defaults to `false`. + * `java_version` - (Optional) The version of Java to use. Possible values are `8`, and `11` * `node_version` - (Optional) The version of Node to use. Possible values include `12`, and `14`