Azure / terraform-azurerm-aks

Terraform Module for deploying an AKS cluster
MIT License
359 stars 469 forks source link

var.prefix is required #489

Closed jrsherry closed 11 months ago

jrsherry commented 11 months ago

Is there an existing issue for this?

Greenfield/Brownfield provisioning

greenfield

Terraform Version

1.5.7

Module Version

7.5.0

AzureRM Provider Version

latest

Affected Resource(s)/Data Source(s)

azurerm_3.76.0

Terraform Configuration Files

Any of the examples in this repo with 'prefix' variable removed.

tfvars variables values

N/A

Debug Output/Panic Output

Error: the "dns_prefix" must begin and end with a letter or a number, container only letters, numbers, and hyphens and be between 1 and 54 characters in length, got ""

Expected Behaviour

Per the README, and variables.tf, prefix is optional. However, if left unset, application of this module fails due to empty string being an invalid dns_prefix.

Actual Behaviour

No response

Steps to Reproduce

No response

Important Factoids

No response

References

No response

jrsherry commented 11 months ago

Closed the issue. The documentation is correct in that the variable is optional when the cluster_log_analytics_workspace_name is set. Unfortunately I had log_analytics_workspace_enabled set to false and didn't realize that I still needed to pass a workspace name to avoid the prefix error.

Glaaj commented 3 months ago

Seems to me like this still doesn't make much sense to "require" a name for a log analytics workspace when you disable creation.

Either the logic to disable the variable should be fixed or the documentation should provide this information since the error you get doesn't help much.

zioproto commented 3 months ago

Seems to me like this still doesn't make much sense to "require" a name for a log analytics workspace when you disable creation.

Either the logic to disable the variable should be fixed or the documentation should provide this information since the error you get doesn't help much.

It is not about the log analytics.

It is used here: https://github.com/Azure/terraform-azurerm-aks/blob/4729aee8c064da747186a14d6c3575c67e673692/main.tf#L24

Glaaj commented 3 months ago

Yes I've found the reason for it :)

However the description of the variable doesn't match with the behavior as that states the following:

"(Optional) The prefix for the resources created in the specified Azure Resource Group. Omitting this variable requires both `var.cluster_log_analytics_workspace_name` and `var.cluster_name` have been set."

And the fact that it's optional without a mention of dns_prefix using it is what confused me at first. The field dns_prefix isn't a requirement according to the documentation but it's not intuitive this way, at least not for me.