Azure / ALZ-PowerShell-Module

The Azure Landing Zones Accelerators PowerShell module
https://www.powershellgallery.com/packages/ALZ/
MIT License
79 stars 39 forks source link

Starter module non-primitive type variable populated as a string #132

Closed sdeguchi closed 3 months ago

sdeguchi commented 3 months ago

Expected Behavior

ALZ-powershell-module should prompt with the correct non-primitive type default in the variables.tf. Also, the output in the terraform.tfvars file should be of the correct variable type declared in the variables.tf file.

Current Behavior

ALZ-powershell-module prompts with empty string for non-primitive type default, and the output in the terraform.tfvars is always a string. When running "terraform plan", I get the following error: "The given value is not suitable for var.landing_zone_management_group_children declared at variables.tf:48,1-21: list of object required."

Possible Solution

Could we make the variable value in the terraform.tfvars file null for non-primitive types so we can handle the defaults in the variables.tf file? If we set the variable as null in the terraform.tfvars file, we can declare the variable with nullable=false and it will get set with the default value.

Steps to Reproduce

  1. Create a new starter module with variables.tf file that contains a non-primitive type variable
  2. Use the -starterModuleOverrideFolderPath option to point to the new starter module and run ALZ-powershell-module
  3. Run ALZ-powershell-module until the non-primitive type is prompted for

Context (Environment)

Detailed Description

Running ALZ-powershell-module with a declared variable in variables.tf that is not a primitive type, the terraform.tfvars file will get populated with a string(empty string if using the default). The prompt for the default will also be an empty string.

variable_non_primitive accelerator_prompt

oZakari commented 3 months ago

Hi @sdeguchi, pinged you on Teams as well, but let me know when you have some time to connect.