Terraform-provider-azurerm: Cannot use ipv6 address as ip_restriction in azurerm_app_service

Created on 9 Apr 2020  ·  4Comments  ·  Source: terraform-providers/terraform-provider-azurerm

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.12.19

  • provider.azurerm v2.5.0

Affected Resource(s)

azurerm_app_service

Terraform Configuration Files

resource "azurerm_app_service" "web" {
  count               = length(var.webapps)
  name                = "webappname"
  location            = "westeurope"
  resource_group_name = azurerm_resource_group.web[0].name
  app_service_plan_id = azurerm_app_service_plan.web[0].id
  https_only          = true

  site_config {

    default_documents = ["index.html"]
    always_on = true

    ip_restriction {
      ip_address  = "x.x.0.0/16" # redacted real ip
    }

    ip_restriction {
      ip_address  = "x:x:x::/44" # redacted real ip
    }
  }

}

Debug Output

Expected Behavior

ipv6 format should be accepted, since move to CIDR notation it doesn't. In 1.44.0 when subnet value was give it worked

Actual Behavior

(I've replaced actutal ip values with an x)

Error: site_config.0.ip_restriction.1.ip_address must start with IPV4 address and/or slash, number of bits (0-32) as prefix. Example: 127.0.0.1/8. Got "x:x:x::/44".

  on ..\..\..\infra\terraform\global\web\main.tf line 44, in resource "azurerm_app_service" "web":
  44: resource "azurerm_app_service" "web" {

Steps to Reproduce

  1. terraform plan

Important Factoids

none

References

none

bug servicapp-service

Most helpful comment

Any update on this?

All 4 comments

To add, a scenario like the below also fails but with a different error message:

dynamic "ip_restriction" {
      for_each = var.ip6_cidr_blocks

      content {
        ip_address                = ip_restriction.value
        subnet_mask               = null
        virtual_network_subnet_id = null
      }
}

var.ip6_cidr_blocks is defined as a list of IPv6 CIDR blocks.

Error

Error: web.AppsClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="BadRequest" Message="IpSecurityRestriction.IpAddress is invalid.  It must be in CIDR format." Details=[{"Message":"IpSecurityRestriction.IpAddress is invalid.  It must be in CIDR format."},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","ExtendedCode":"51021","Message":"IpSecurityRestriction.IpAddress is invalid.  It must be in CIDR format.","MessageTemplate":"{0} is invalid.  {1}","Parameters":["IpSecurityRestriction.IpAddress","It must be in CIDR format."]}}]

Any update on this?

This has been released in version 2.31.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.31.0"
}
# ... other configuration ...

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!

Was this page helpful?
0 / 5 - 0 ratings