Rss

mail@pastecode.io avatar
unknown
yaml
2 months ago
1.9 kB
3
Indexable
Never

resource "azurerm_subnet" "fnappsubnet" {
  name                 = "fnappsubnet"
  resource_group_name  = data.azurerm_resource_group.rex.name
  virtual_network_name = azurerm_virtual_network.rex_vnet.name
  address_prefixes     = ["10.0.5.0/24"]
  

  delegation {
    name = "fnapp-delegation"

    service_delegation {
      name    = "Microsoft.Web/serverFarms"
      actions = ["Microsoft.Network/virtualNetworks/subnets/action"]
    }
  }
  depends_on = [ azurerm_virtual_network.rex_vnet ]
}



resource "azurerm_function_app" "confulencerexfnapp" {
  name                       = "confulencerexfnapp"
  location            = data.azurerm_resource_group.rex.location
  resource_group_name = data.azurerm_resource_group.rex.name
  app_service_plan_id        = azurerm_service_plan.rex_plan.id
  storage_account_name       = azurerm_storage_account.rex_storage.name
  storage_account_access_key = azurerm_storage_account.rex_storage.primary_access_key
  site_config {
    application_stack {
      docker{
       image_name       = ""
       image_tag        = "" 
       registry_url     = ""
       registry_username = ""
       registry_password = ""
      }
    }
  }

  app_settings = {
     WEBSITE_WEBDEPLOY_USE_SCM           = true
     FUNCTIONS_WORKER_RUNTIME         = "dotnet" # Adjust based on your runtime
     WEBSITES_ENABLE_APP_SERVICE_STORAGE = false
  }
  identity {
    type = "SystemAssigned"
  }

  depends_on = [azurerm_service_plan.rex_plan,azurerm_storage_account.rex_storage,data.azurerm_container_registry.rex_container_registry]
}
resource "azurerm_app_service_virtual_network_swift_connection" "fnappswiftconn" {
  app_service_id = azurerm_function_app.confulencerexfnapp.id
  subnet_id      = azurerm_subnet.fnappsubnet.id

depends_on = [azurerm_subnet.fnappsubnet, azurerm_function_app.confulencerexfnapp]
  lifecycle {
    ignore_changes = [
      subnet_id,
    ]
  }
}
Leave a Comment