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

Community Discussion - This module's minimum usage is not as simple as it should be. #427

Open
1 task done
chrisjohnson00 opened this issue Aug 16, 2023 · 1 comment
Open
1 task done
Labels
enhancement New feature or request

Comments

@chrisjohnson00
Copy link

chrisjohnson00 commented Aug 16, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Greenfield/Brownfield provisioning

greenfield

Terraform Version

1.5.5

Module Version

7.3.1

AzureRM Provider Version

3.69.0

Affected Resource(s)/Data Source(s)

azurerm_log_analytics_workspace

Terraform Configuration Files

resource "azurerm_resource_group" "rg" {
  name     = "rg-${var.fq_stack_name}"
  location = var.region
}

module "aks" {
  source  = "Azure/aks/azurerm"
  version = "7.3.1"
  resource_group_name = azurerm_resource_group.rg.name
}

output "resource_group" {
  value = azurerm_resource_group.rg.name
}

tfvars variables values

fq_stack_name=poc-aks-argocd-dev

Debug Output/Panic Output

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform planned the following actions, but then encountered a problem:

  # module.aks.null_resource.kubernetes_version_keeper will be created
  + resource "null_resource" "kubernetes_version_keeper" {
      + id       = (known after apply)
      + triggers = {
          + "version" = null
        }
    }

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

Error: Resource precondition failed

  on .terraform/modules/aks/main.tf line 714, in resource "azurerm_log_analytics_workspace" "main":
 714:       condition     = can(coalesce(var.cluster_log_analytics_workspace_name, var.prefix))
    ├────────────────
    │ var.cluster_log_analytics_workspace_name is null
    │ var.prefix is ""

You must set one of `var.cluster_log_analytics_workspace_name` and
`var.prefix` to create `azurerm_log_analytics_workspace.main`.
Error: Terraform exited with code 1.
Error: Process completed with exit code 1.

Expected Behaviour

A default value cluster is created. Given this example:

module "aks" {
  source  = "Azure/aks/azurerm"
  version = "7.3.1"
  # insert the 1 required variable here
}

Actual Behaviour

According to the docs only specifying the resource_group_name is required to setup an AKS cluster. However, when I've done that, I get the provided error upon terraform plan stating that some other variable must be set.

Steps to Reproduce

terraform plan

Important Factoids

No response

References

No response

@lonegunmanb
Copy link
Member

lonegunmanb commented Aug 17, 2023

Thanks @chrisjohnson00 for opening this issue. We're using terraform-docs to generate the module's document now, only variable that without default attribute would be marked as "required".

This module is built as a general-purpose module, it's not designed for a specific scenario, and it's features are added at different time for different purposes, that caused one variable's default could be incompatible with another variable's default value.

The simplest usage for this module I've tried is:

module "aks" {
  source  = "../.."
  resource_group_name = azurerm_resource_group.main[0].name
  log_analytics_workspace_enabled = false
  role_based_access_control_enabled = true
  prefix = "aks-example"
}

To be honest, this is too complex if all you want is just try this module. And maybe we should consider enforcing a simplest example for every Azure Verified Module.

Maybe it's time to constrict this module's complexity and begin creating some scenario-focused smaller modules. e.g.: CloudPosse has created the following different modules that provision Aws subnet:

But if we're going to do so, we need more information on users' requirements, what's your scenario, so we can provide a simpler module that fits the requirement.

I'll change this issue to a community discussion topic, and everyone are welcomed to leave your opinion and suggestions in our repo for all Azure Verified Modules and leave your suggestions there, so our PM team can participate our discussion.

@lonegunmanb lonegunmanb changed the title bug - more than 1 variable required for deploy Community Discussion - This module's minimum usage is not as simple as it should be. Aug 17, 2023
@lonegunmanb lonegunmanb added enhancement New feature or request and removed bug Something isn't working labels Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

2 participants