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_databricks_workspace name validation is incorrect #8924

Closed
gplusplus314 opened this issue Oct 16, 2020 · 2 comments · Fixed by #8997
Closed

azurerm_databricks_workspace name validation is incorrect #8924

gplusplus314 opened this issue Oct 16, 2020 · 2 comments · Fixed by #8997

Comments

@gplusplus314
Copy link
Contributor

gplusplus314 commented Oct 16, 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.13.4

  • provider registry.terraform.io/databrickslabs/databricks v0.2.5
  • provider registry.terraform.io/hashicorp/azurerm v2.32.0

Affected Resource(s)

  • azurerm_databricks_workspace

Terraform Configuration Files

resource "azurerm_resource_group" "rg" {
  location = "eastus2"
  name     = "x-example-rg"
}

resource "azurerm_databricks_workspace" "dbw" {
  location            = azurerm_resource_group.rg.location
  name                = "x-example-dbw"
  resource_group_name = azurerm_resource_group.rg.name
}

Debug Output

Sorry, I can't provide this due to company policy. And it's irrelevant; I already found the issue. Please see the "important factoids" section.

Panic Output

No panics! 🍺 🍻

Expected Behavior

The terraform plan command should output a plan where the name of the azurerm_databricks_workspace resource is x-example-dbw. The use case here is that my organization wants to prefix the resources with single-letter codes.

Actual Behavior

Error: "name" first, second, and last characters must be a letter or number
 
  on REDACTED.tf line 42, in resource "azurerm_databricks_workspace" "dbw":
   42: resource "azurerm_databricks_workspace" "dbw" {

Steps to Reproduce

  1. terraform apply the configuration code given above.

Important Factoids

The Azure Portal shows the following validation criteria:

  1. The workspace name is required
  2. The value must have a length of at least 3.
  3. The value must have a length of at most 30.
  4. Only alphanumeric characters, underscores, and hyphens are allowed, and the name must be 1-30 characters long.

However, the current ValidateDatabricksWorkspaceName implementation has a regex that requires the first two characters to be
alphanumeric. This is not a restriction in Azure, at least not at the time of writing this. Additionally, Azure does not
disallow consecutive hyphens, but there is a second regex that disallows this.

I can very easily fix this and provide a PR, but I need to get clearance from my employer. I'm working on that; I'll follow up.

References

@katbyte katbyte added this to the v2.34.0 milestone Oct 23, 2020
katbyte pushed a commit that referenced this issue Oct 23, 2020
Fixes #8924 . I also shored up the relevant unit test a bit. Code was written in a style to closely match the Azure Portal's validation prompts to keep it as simple as possible.
@ghost
Copy link

ghost commented Oct 29, 2020

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

@ghost
Copy link

ghost commented Nov 23, 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 as resolved and limited conversation to collaborators Nov 23, 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.

3 participants