Skip to content

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

Closed
@sdeguchi

Description

@sdeguchi

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)

  • Operating System and version as reported by $PSVersionTable.OS: Microsoft Windows 10.0.22631
  • PowerShell versions as reported by $PSVersionTable.PSEdition: Core

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions