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_virtual_machine_scale_set: allow empty zone specification #1787

Closed
Supermathie opened this issue Aug 17, 2018 · 1 comment · Fixed by #3142
Closed

azurerm_virtual_machine_scale_set: allow empty zone specification #1787

Supermathie opened this issue Aug 17, 2018 · 1 comment · Fixed by #3142
Labels
enhancement service/vmss Virtual Machine Scale Sets

Comments

@Supermathie
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

Description

We are trying to implement VMSSes that take advantage of zones if available. We would like the azurerm_virtual_machine_scale_set resource (and others for which you can specify zones, if any) to interpret a blank list of zones as "the zones are not specified".

The way the existing code behaves is:

resource "azurerm_virtual_machine_scale_set" "app" {
  …
  zones = []
}

# terraform plan →

Error: Error running plan: 1 error(s) occurred:

* azurerm_virtual_machine_scale_set.app: zones: attribute supports 1 item as a minimum, config has 0 declared
resource "azurerm_virtual_machine_scale_set" "app" {
  …
  zones = [1,2,3]
}

# terraform plan →

-/+ azurerm_virtual_machine_scale_set.app (new resource required)
…
      zones.#:                                                                                              "0" => "3" (forces new resource)
      zones.0:                                                                                              "" => "1" (forces new resource)
      zones.1:                                                                                              "" => "2" (forces new resource)
      zones.2:                                                                                              "" => "3" (forces new resource)

Why would we do such a crazy thing? The reason is that the following terraform could would easily let us take advantage of availability zones if present:

locals {
  _region_az_map = {
    "centralus" = "1,2,3"
  }
}

resource "azurerm_virtual_machine_scale_set" "app" {
  …
  zones = ["${compact(split(",", lookup(local._region_az_map, azurerm_resource_group.app.location, "1")))}"]
  …
}

New or Affected Resource(s)

  • azurerm_virtual_machine_scale_set

Potential Terraform Configuration

resource "azurerm_virtual_machine_scale_set" "app" {
  …
  zones = []
}

References

@ghost
Copy link

ghost commented May 2, 2019

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 May 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement service/vmss Virtual Machine Scale Sets
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants