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

Pass [] in zones of azurerm_public_ip will result a zone-redundant IP instead of a No Zone IP #11707

Closed
windwindblow opened this issue May 14, 2021 · 3 comments · Fixed by #11627

Comments

@windwindblow
Copy link

windwindblow commented May 14, 2021

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.31
AzureRM v2.58.0

Affected Resource(s)

  • azurerm_public_ip

Terraform Configuration Files

resource "azurerm_public_ip" "example_ip" {
  name = "ip_name"
  location = "East US"
  resource_group_name = "resource_group"
  sku = "Standard"
  allocation_method = "Static"
  zones = []
}

Expected Behaviour

A standard public IP address with "No Zone" should be created even if the region supports the Zone-redundant.

Actual Behaviour

A standard public IP address with Zone-redundant (zones are [1,2,3]) are created.

Steps to Reproduce

resource "azurerm_public_ip" "example_ip" {
  name = "ip_name"
  location = "East US"
  resource_group_name = "resource_group"
  sku = "Standard"
  allocation_method = "Static"
  zones = []
}
  1. terraform apply

References

Checking the Azure logs, if we put [] in the Terraform zones, [] will be omitted in the request. This leads Azure to create a zone redundant IP by default.
"requestbody": "{"location":"eastus","properties":{"idleTimeoutInMinutes":4,}],"publicIPAddressVersion":"IPv4","publicIPAllocationMethod":"Static"},"sku":{"name":"Standard"},"tags":{}}"

If we do the similar steps in Azure, you will see [] is sent as a valid zone parameter.
"requestbody": "{"sku":{"name":"Standard"},"properties":{"publicIPAllocationMethod":"Static"}]},"zones":[],"location":"East US"}",

Azure has released some updates which make things more confused.
https://azure.microsoft.com/en-us/updates/zone-behavior-change/
According to Azure/azure-powershell#12925, it seems Azure changes the network API in 2020-08-01 which azurerm is still at 2020-07-01. There could be some behavior changes in this area when azurerm is upgraded to 2020-08-01.

Azure Portal provides 5 options when creating an IP address in the Portal: No Zone, Zone Redundant, 1, 2, 3.

We understand the current behavior is Terraform will create a zone-redundant IP by default if we do not add the zones parameter. The bottom line we should allow the users to pass something to zones to be able to create a "No Zone" IP address even if we run it in the zone supported regions.

@windwindblow
Copy link
Author

I think it could be resolved after #11627 is checked in.

@ghost
Copy link

ghost commented Jun 11, 2021

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

@github-actions
Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 12, 2021
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