Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_app_service_slot_virtual_network_swift_connection error parsing Azure Resource ID %!q(*web.AppServiceResourceID=<nil>) #8048

Closed
uolter opened this issue Aug 7, 2020 · 4 comments · Fixed by #8111

Comments

@uolter
Copy link
Contributor

uolter commented Aug 7, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and AzureRM Provider) Version

  • terraform version: 0.12.24
  • azure provider: 2.18.0

Affected Resource(s)

  • azurerm_app_service_slot_virtual_network_swift_connection

Terraform Configuration Files

provider "azurerm" {
  version = "=2.18.0"
  features {}
}

variable "resource_group_name" {
  type    = string
  default = "dev-uolt"
}

variable "location" {
  type    = string
  default = "westeurope"
}

resource "azurerm_virtual_network" "example" {
  name                = "example-virtual-network"
  address_space       = ["10.0.0.0/16"]
  location            = var.location
  resource_group_name = var.resource_group_name
}

resource "azurerm_subnet" "example" {
  name                 = "example-subnet"
  resource_group_name  = var.resource_group_name
  virtual_network_name = azurerm_virtual_network.example.name
  address_prefixes     = ["10.0.1.0/24"]

  delegation {
    name = "example-delegation"

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

resource "azurerm_storage_account" "example" {
  name                     = "uoltstoragefunc"
  resource_group_name      = var.resource_group_name
  location                 = var.location
  account_tier             = "Standard"
  account_replication_type = "LRS"
}

resource "azurerm_app_service_plan" "example" {
  name                = "uolt-service-plan"
  location            = var.location
  resource_group_name = var.resource_group_name

  sku {
    tier = "PremiumV2"
    size = "P3v2"
  }
}

resource "azurerm_function_app" "example" {
  name                       = "uolt-azure-functions"
  location                   = var.location
  resource_group_name        = var.resource_group_name
  app_service_plan_id        = azurerm_app_service_plan.example.id
  storage_account_name       = azurerm_storage_account.example.name
  storage_account_access_key = azurerm_storage_account.example.primary_access_key
}

resource "azurerm_function_app_slot" "example" {
  name                       = "staging"
  location                   = var.location
  resource_group_name        = var.resource_group_name
  app_service_plan_id        = azurerm_app_service_plan.example.id
  function_app_name          = azurerm_function_app.example.name
  storage_account_name       = azurerm_storage_account.example.name
  storage_account_access_key = azurerm_storage_account.example.primary_access_key
}

resource "azurerm_app_service_slot_virtual_network_swift_connection" "example" {
  slot_name      = azurerm_function_app_slot.example.name
  app_service_id = azurerm_app_service_plan.example.id
  subnet_id      = azurerm_subnet.example.id
}

Expected Behavior

I am expecting to create a function app with it's plan and a slot called staging.
The slot function should have the integration with the subnet azurerm_subnet.example

Actual Behavior

The apply ends with the following error message, all the resources have been created expect the integration with the vnet that I need to create manually from the portal.

Error: Error parsing Azure Resource ID %!q(*web.AppServiceResourceID=)

on main.tf line 77, in resource "azurerm_app_service_slot_virtual_network_swift_connection" "example":
77: resource "azurerm_app_service_slot_virtual_network_swift_connection" "example" {

Steps to Reproduce

  1. terraform apply
@ziontech-devops
Copy link

ziontech-devops commented Aug 12, 2020

Got the same error.

Error: Error parsing Azure Resource ID %!q(*web.AppServiceResourceID=)

Also if you are calling from a module. There's no way you can add azurerm_app_service_slot name in the module output file.

@njuCZ
Copy link
Contributor

njuCZ commented Aug 13, 2020

@uolter, @ziontech-devops for app_service_id field, we could not use azurerm_app_service_plan id, but should use id of azurerm_app_service or azurerm_function_app , Could you please try use following config ?

resource "azurerm_app_service_slot_virtual_network_swift_connection" "example" {
  slot_name      = azurerm_function_app_slot.example.name
  app_service_id = azurerm_function_app.example.id
  subnet_id      = azurerm_subnet.example.id
}

I will also made a PR to update this document and enhance the validation rule.

@uolter
Copy link
Contributor Author

uolter commented Aug 14, 2020

@njuCZ thank you so much !!! It works to me !!!
Bye

@uolter uolter closed this as completed Aug 14, 2020
@ghost
Copy link

ghost commented Sep 13, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Sep 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants