hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.59k stars 4.63k forks source link

Add support for "Backup/restore over virtual network" option for Custom backup of azurerm_windows_web_app #26018

Open AjinkyaBapat opened 5 months ago

AjinkyaBapat commented 5 months ago

Is there an existing issue for this?

Community Note

Terraform Version

1.8.3

AzureRM Provider Version

3.104.0

Affected Resource(s)/Data Source(s)

azurerm_windows_web_app

Terraform Configuration Files

resource "azurerm_windows_web_app" "webapp" {
  app_settings = {
  }
  client_affinity_enabled       = true
  client_certificate_enabled    = false
  client_certificate_mode       = "Required"
  enabled                       = true
  https_only                    = true
  location                      = var.location
  name                          = var.name
  public_network_access_enabled = true
  resource_group_name           = var.resource_group_name
  service_plan_id               = var.service_plan_id
  tags                          = var.tags
  virtual_network_subnet_id     = var.subnet_id
  zip_deploy_file               = null
  identity {
    type = "SystemAssigned"
  }
  logs {
    detailed_error_messages = true
    failed_request_tracing  = false
  }
  site_config {
    always_on                   = true
    ftps_state                  = "FtpsOnly"
    http2_enabled               = false
    load_balancing_mode         = "LeastRequests"
    local_mysql_enabled         = false
    managed_pipeline_mode       = "Integrated"
    minimum_tls_version         = "1.2"
    remote_debugging_enabled    = false
    remote_debugging_version    = "VS2019"
    scm_minimum_tls_version     = "1.2"
    scm_use_main_ip_restriction = false
    use_32_bit_worker           = true
    vnet_route_all_enabled      = false
    websockets_enabled          = false
    worker_count                = 1
    application_stack {
      current_stack  = "dotnet"
      dotnet_version = "v6.0"
      php_version    = "Off"
      python         = false
    }
    cors {
      allowed_origins     = length(var.allowed_origins) > 0 ? var.allowed_origins : null
      support_credentials = var.support_credentials
    }
    virtual_application {
      physical_path = "site\\wwwroot"
      preload       = false
      virtual_path  = "/"
    }
  }

  sticky_settings {
    app_setting_names = []
  }

  backup {
    name = var.name
    enabled = true
    schedule {
      keep_at_least_one_backup = true
      start_time = "var.start_time"
      frequency_unit = "Day"
      frequency_interval = 1
      retention_period_days = 60
    }
    storage_account_url = "var.url"   
  }
}

Debug Output/Panic Output

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # module.windowsappservice["xyz"].azurerm_windows_web_app.webapp will be updated in-place
  ~ resource "azurerm_windows_web_app" "webapp" {
        id                                             = "id"
        name                                           = "xyz"
        tags                                           = {}
        # (25 unchanged attributes hidden)

      + backup {
          + enabled             = true
          + name                = "xyz"
          + storage_account_url = (sensitive value)

          + schedule {
              + frequency_interval       = 1
              + frequency_unit           = "Day"
              + keep_at_least_one_backup = true
              + retention_period_days    = 60
              + start_time               = "time"
            }
        }

        # (4 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Expected Behaviour

Created Custom Backup should have "Backup/restore over virtual network Integration" Option Enbaled. "vnetBackupRestoreEnabled": true

Actual Behaviour

"vnetBackupRestoreEnabled": false

image

Since this option is not True/Checked, my backups are failing as the destination Storage account has firewall turned on and can be accessed only from the Vnet.

Steps to Reproduce

terraform apply

Important Factoids

No response

References

No response

AjinkyaBapat commented 5 months ago

Also, I couldn't find any option in the backup block of azurerm_windows_web_app to set "Backup/restore over virtual network Integration" True or False.

frostsxx commented 3 weeks ago

Hi!

Any updates on this? @AjinkyaBapat