Manages an App Service Static Web App Function App Registration.
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "West Europe"
}
resource "azurerm_static_web_app" "example" {
name = "example"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
}
resource "azurerm_storage_account" "example" {
name = "examplesstorageacc"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
account_tier = "Standard"
account_replication_type = "LRS"
}
resource "azurerm_service_plan" "example" {
name = "example-service-plan"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
os_type = "Linux"
sku_name = "S1"
}
resource "azurerm_linux_function_app" "example" {
name = "example-function-app"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
service_plan_id = azurerm_service_plan.example.id
storage_account_name = azurerm_storage_account.example.name
storage_account_access_key = azurerm_storage_account.example.primary_access_key
site_config {}
lifecycle {
ignore_changes = [auth_settings_v2]
}
}
resource "azurerm_static_web_app_function_app_registration" "example" {
static_web_app_id = azurerm_static_web_app.example.id
function_app_id = azurerm_linux_function_app.example.id
}
The following arguments are supported:
static_web_app_id
(Required) - The ID of the Static Web App to register the Function App to as a backend. Changing this forces a new resource to be created.
function_app_id
(Required) - The ID of a Linux or Windows Function App to connect to the Static Web App as a Backend. Changing this forces a new resource to be created.
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the Static Site Custom Domain.read
- (Defaults to 5 minutes) Used when retrieving the Static Site Custom Domain.delete
- (Defaults to 30 minutes) Used when deleting the Static Site Custom Domain.Static Web App Function App Registration can be imported using the resource id
, e.g.
terraform import azurerm_static_web_app_function_app_registration.example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Web/staticSites/my-static-site1/userProvidedFunctionApps/myFunctionApp