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_linux_virtual_machine doesn't allow "." in name #5944

Closed
plrca2 opened this issue Feb 28, 2020 · 5 comments · Fixed by #5966
Closed

azurerm_linux_virtual_machine doesn't allow "." in name #5944

plrca2 opened this issue Feb 28, 2020 · 5 comments · Fixed by #5966

Comments

@plrca2
Copy link

plrca2 commented Feb 28, 2020

Azure allows resource names to have "." as long as it's not the last character

@plrca2
Copy link
Author

plrca2 commented Feb 28, 2020

Relevant line
azurerm/internal/services/compute/validation.go:

                // The value can only contain alphanumeric characters and cannot start with a number.
                if matched := regexp.MustCompile(`^[a-zA-Z0-9-_]+$`).Match([]byte(v)); !matched {
                        errors = append(errors, fmt.Errorf("%q may only contain alphanumeric characters, dashes and underscores", k))
                }

@plrca2
Copy link
Author

plrca2 commented Feb 29, 2020

diff --git a/azurerm/internal/services/compute/validation.go b/azurerm/internal/services/compute/validation.go
index be083dadf..f183ae3c1 100644
--- a/azurerm/internal/services/compute/validation.go
+++ b/azurerm/internal/services/compute/validation.go
@@ -71,7 +71,7 @@ func validateName(maxLength int) func(i interface{}, k string) (warnings []strin
                }
 
                // The value can only contain alphanumeric characters and cannot start with a number.
-               if matched := regexp.MustCompile(`^[a-zA-Z0-9-_]+$`).Match([]byte(v)); !matched {
+               if matched := regexp.MustCompile(`^[a-zA-Z0-9-_\.]+$`).Match([]byte(v)); !matched {
                        errors = append(errors, fmt.Errorf("%q may only contain alphanumeric characters, dashes and underscores", k))
                }

@ArcturusZhang
Copy link
Contributor

I submitted a PR that may resolve this.

@ghost
Copy link

ghost commented Mar 19, 2020

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

@ghost
Copy link

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