Azure / terraform-azurerm-avm-template

Template repo for Azure Verified Modules using Terraform
MIT License
47 stars 30 forks source link

Validation Errors in Terraform Template #23

Closed terrymandin closed 1 year ago

terrymandin commented 1 year ago

I recently created a repo based on the AVM Terraform template and found validation errors:

C:\git\terraform-arurerm-avm-res-compute-virtualmachinescaleset>terraform validate
╷
│ Error: Reference to undeclared resource
│
│   on locals.telemetry.tf line 13, in locals:
│   13:   telem_random_hex = can(random_id.telem[0].hex) ? random_id.telem[0].hex : ""
│
│ A managed resource "random_id" "telem" has not been declared in the root module.
╵
╷
│ Error: Reference to undeclared resource
│
│   on locals.telemetry.tf line 13, in locals:
│   13:   telem_random_hex = can(random_id.telem[0].hex) ? random_id.telem[0].hex : ""
│
│ A managed resource "random_id" "telem" has not been declared in the root module.
╵
╷
│ Error: Reference to undeclared local value
│
│   on main.telemetry.tf line 2, in resource "random_id" "telemetry":
│    2:   count       = local.enable_telemetry ? 1 : 0
│
│ A local value with the name "enable_telemetry" has not been declared.

After resolving the above errors encountered this error:

C:\git\terraform-azurerm-avm-ptn-loadbalvmss>terraform validate
╷
│ Error: Unsupported argument
│ 
│   on main.telemetry.tf line 13, in resource "azurerm_resource_group_template_deployment" "telemetry":
│   13:   location            = var.location
│ 
│ An argument named "location" is not expected here.
herms14 commented 1 year ago

@matt-FFFFFF I submitted a PR to fix this issue

matt-FFFFFF commented 1 year ago

fixed by #25