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

"Invalid address to set" error with azurerm_app_service data source and subnet IP restriction #8211

Closed
simonbrady opened this issue Aug 23, 2020 · 3 comments · Fixed by #8212

Comments

@simonbrady
Copy link
Contributor

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 v0.13.0
+ provider registry.terraform.io/hashicorp/azurerm v2.24.0

Affected Resource(s)

  • azurerm_app_service data source

Terraform Configuration Files

Resource config:

provider "azurerm" {
  version = "~>2"
  features {}
}

resource "azurerm_resource_group" "test" {
  name     = "appsvc-test-rg"
  location = "australiaeast"
}

resource "azurerm_virtual_network" "test" {
  name                = "appsvc-test-vnet"
  resource_group_name = azurerm_resource_group.test.name
  address_space       = ["10.0.0.0/16"]
  location            = azurerm_resource_group.test.location
}

resource "azurerm_subnet" "test" {
  name                 = "appsvc-test-subnet"
  resource_group_name  = azurerm_resource_group.test.name
  virtual_network_name = azurerm_virtual_network.test.name
  address_prefixes     = ["10.0.0.0/24"]
  service_endpoints    = ["Microsoft.Web"]
}

resource "azurerm_app_service_plan" "appsvc" {
  name                = "appsvc-test-app-service-plan"
  location            = azurerm_resource_group.test.location
  resource_group_name = azurerm_resource_group.test.name

  sku {
    tier     = "Free"
    size     = "F1"
    capacity = 0
  }
}

resource "azurerm_app_service" "appsvc" {
  name                = "appsvc-test-app-service"
  location            = azurerm_resource_group.test.location
  resource_group_name = azurerm_resource_group.test.name
  app_service_plan_id = azurerm_app_service_plan.appsvc.id
  https_only          = true

  site_config {
    default_documents         = ["hostingstart.html"]
    use_32_bit_worker_process = true

    ip_restriction {
      virtual_network_subnet_id = azurerm_subnet.test.id
    }
  }
}

Data source config (in different directory):

provider "azurerm" {
  version = "~>2"
  features {}
}

data "azurerm_app_service" "test" {
  name                = "appsvc-test-app-service"
  resource_group_name = "appsvc-test-rg"
}

Debug Output

https://gist.github.com/simonbrady/2456363026137c4af48cb2d2585a4f7b

Panic Output

n/a

Expected Behavior

Data source reads state of azurerm_app_service.test including ip_restriction sub-block of site_config

Actual Behavior

Refreshing data source fails with

Error: Invalid address to set: []string{"site_config", "0", "ip_restriction", "0", "subnet_id"}

Steps to Reproduce

  1. Run terraform apply for resource config (should complete without error)
  2. Run terraform apply for data source config

Important Factoids

References

@simonbrady
Copy link
Contributor Author

Fix in #8212

@ghost
Copy link

ghost commented Aug 27, 2020

This has been released in version 2.25.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.25.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Sep 23, 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 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants