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

location should be validated in azurerm_resource_group #5594

Closed
t3mi opened this issue Feb 3, 2020 · 2 comments · Fixed by #6242
Closed

location should be validated in azurerm_resource_group #5594

t3mi opened this issue Feb 3, 2020 · 2 comments · Fixed by #6242

Comments

@t3mi
Copy link
Contributor

t3mi commented Feb 3, 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 v0.12.20

  • provider.azurerm v1.42.0

Affected Resource(s)

  • azurerm_resource_group

Terraform Configuration Files

provider "azurerm" {}

resource "azurerm_resource_group" "test" {
  name     = "test"
  location = ""
}

Debug Output

Panic Output

Expected Behavior

At least in plan phase (validate is better) this should be catched like with name for the resource group

Error: "name" may only contain alphanumeric characters, dash, underscores, parentheses and periods       

  on main.tf line 3, in resource "azurerm_resource_group" "test":
   3: resource "azurerm_resource_group" "test" {

Actual Behavior

Plan is generated and apply fails.

Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.


------------------------------------------------------------------------

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # azurerm_resource_group.test will be created
  + resource "azurerm_resource_group" "test" {
      + id   = (known after apply)
      + name = "test"
      + tags = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.

------------------------------------------------------------------------

Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.

Steps to Reproduce

  1. terraform init
  2. terraform plan

Important Factoids

References

  • #0000
@tombuildsstuff tombuildsstuff self-assigned this Mar 25, 2020
@tombuildsstuff tombuildsstuff added this to the v2.3.0 milestone Mar 25, 2020
tombuildsstuff added a commit that referenced this issue Mar 25, 2020
This commit makes the NormalizeLocation field more strict - by introducing
a new method for the StateFunc. In addition this adds validation to the
`location` field which ensures this isn't an empty string for the Default
Schema which fixes #5594.
@ghost
Copy link

ghost commented Mar 27, 2020

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

@ghost
Copy link

ghost commented Apr 25, 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 Apr 25, 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.

4 participants