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

Adds a rule to check that the name of a windows virtual machine is valid #332

Conversation

JannoTjarks
Copy link
Member

Hi,

i added the rule azurerm_windows_virtual_machine_invalid_name.

It checks, if the name is a valid windows server hostname, based on this documenation:
https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules#microsoftcompute
image

Based on the terraform documentation, the check is skipped, if the computer_name attribute is specified. In future this rule could be expanded or a second rule specific for computer_name could be added.
image

Thank you!

@JannoTjarks
Copy link
Member Author

@wata727 could you help me with the failing check?

@wata727
Copy link
Member

wata727 commented Apr 10, 2024

CI is failing due to differences with automatically generated code.
Since docs/README.md is automatically generated, please update the template and commit the generated code.

@JannoTjarks
Copy link
Member Author

CI is failing due to differences with automatically generated code. Since docs/README.md is automatically generated, please update the template and commit the generated code.

@wata727, got it, thanks for the hint :)
Now all checks are green. I hope, it looks good to you!


```hcl
resource "azurerm_windows_virtual_machine" "foo" {
name = ... // invalid value
Copy link
Member

@wata727 wata727 May 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are probably referring to the automatically generated rule docs, but we recommend that you write an actual value (e.g. dummy-) if possible. Because it's easier for users to understand.
It would also be a good idea to replace "How to Fix" with the actual value.

@JannoTjarks JannoTjarks force-pushed the feature/invalid-name-windows-server branch from e6f9d52 to 413c83e Compare May 9, 2024 13:18
@JannoTjarks
Copy link
Member Author

@wata727 please take a look. I fixed the regex in the error message and updated the markdown documentation for this rule :)

Copy link
Member

@wata727 wata727 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@wata727 wata727 merged commit 793a327 into terraform-linters:master May 12, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants