Azure / alz-terraform-accelerator

Azure Landing Zones Terraform Accelerator
MIT License
96 stars 32 forks source link

bug: Invalid value for "path" #167

Closed autocloudarc closed 1 week ago

autocloudarc commented 1 month ago

Is there an existing issue for this?

Bootstrap or Starter Module Deployment? (Required)

starter_module

ALZ-PowerShell-Module Version (Required)

3.0.0

alz-terraform-accelerator Version (Required)

2.3.0

Starter Module (Required)

complete

Input arguments of the ALZ-PowerShell-Module (Required)

{
  "allow_storage_access_from_my_ip": "true",
  "apply_approvers": "email01@outlook.com,email02@domain.com",
  "bootstrap_subscription_id": "<partially-redacted>23c",
  "create_branch_policies": "true",
  "environment_name": "mgmt",
  "github_organization_name": "auto-cloud-arc",
  "github_personal_access_token": "ghp_<partially-redacted>",
  "github_runners_personal_access_token": "<ghp_partially-redacted>",
  "postfix_number": 1,
  "service_name": "alz",
  "use_private_networking": "true",
  "use_runner_group": "false",
  "use_self_hosted_runners": "true",
  "use_separate_repository_for_templates": "true"
}

{
  "configuration_file_path": ".\\output\\starter\\v2.3.0\\complete\\config.yaml",
  "default_postfix": "landing-zone",
  "root_parent_management_group_id": "",
  "starter_location": "centralus",
  "subscription_id_connectivity": "<partially-redacted>dc",
  "subscription_id_identity": "<partially-redacted>10",
  "subscription_id_management": "<partially-redacted>5f"
}

Contents of the configuration file used for the complete starter module. (Optional)

# This file contains templated variables to avoid repeating the same hard-coded values.
# Templated variables are denoted by the dollar curly braces token. The following details each templated variable that you can use:
# `starter_location`: This is an Azure location sourced from the `starter_location` variable. This can be used to set the location of resources.
# `default_postfix`: This is a string sourced from the variable `default_postfix`. This can be used to append to resource names for consistency.
# `root_parent_management_group_id`: This is the id of the management group that the ALZ hierarchy will be nested under.
# `subscription_id_identity`: The subscription ID of the subscription to deploy the identity resources to, sourced from the variable `subscription_id_identity`.
# `subscription_id_connectivity`: The subscription ID of the subscription to deploy the connectivity resources to, sourced from the variable `subscription_id_connectivity`.
# `subscription_id_management`: The subscription ID of the subscription to deploy the management resources to, sourced from the variable `subscription_id_management`.
---
archetypes: # `caf-enterprise-scale` module, add inputs as listed on the module registry where necessary.
  root_name: org-name
  root_id: org-id
  subscription_id_connectivity: ${subscription_id_connectivity}
  subscription_id_identity: ${subscription_id_identity}
  subscription_id_management: ${subscription_id_management}
  root_parent_id: ${root_parent_management_group_id}
  deploy_corp_landing_zones: true
  deploy_online_landing_zones: true
  default_location: ${starter_location}
  disable_telemetry: true
  deploy_management_resources: true
  configure_management_resources:
    location: ${starter_location}
    settings:
      security_center:
        config:
          email_security_contact: "email@domain.com"
    advanced:
      asc_export_resource_group_name: rg-asc-export
      custom_settings_by_resource_type:
        azurerm_resource_group:
          management:
            name: rg-management
        azurerm_log_analytics_workspace:
          management:
            name: log-management
        azurerm_automation_account:
          management:
            name: aa-management
connectivity:
  hubnetworking: # `hubnetworking` module, add inputs as listed on the module registry where necessary.
    hub_virtual_networks:
      primary:
        name: vnet-hub
        resource_group_name: rg-connectivity
        location: ${starter_location}
        address_space:
          - 10.0.0.0/16
        firewall:
          name: fw-hub
          sku_name: AZFW_VNet
          sku_tier: Standard
          subnet_address_prefix: 10.0.1.0/24
          zones: ["1", "2", "3"]
          default_ip_configuration:
            public_ip_config:
              zones: ["1", "2", "3"]
              name: "pip-hub"
        virtual_network_gateway: # `avm-ptn-vnetgateway` module, add inputs as listed on the module registry where necessary.
          name: vgw-hub
          subnet_address_prefix: 10.0.2.0/24
  vwan: # `avm-ptn-virtualwan` module, add inputs as listed on the module registry where necessary.

Debug Output/Panic Output (Optional)

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Warning: Argument is deprecated
│ 
│   with module.hubnetworking.azurerm_route_table.hub_routing,
│   on .terraform/modules/hubnetworking/main.tf line 77, in resource "azurerm_route_table" "hub_routing":
╷
│ Error: Invalid function argument
│   77:   disable_bgp_route_propagation = false
│ 
│   on locals.tf line 10, in locals:
│   10:     yamldecode(templatefile("${path.module}/${local.config_file_name}", local.config_template_file_variables)) :
│     ├────────────────
│     │ while calling templatefile(path, vars)
│     │ local.config_file_name is "config.yaml"
│     │ path.module is "."
│ 
│ Invalid value for "path" parameter: no file exists at "./config.yaml"; this
│ function works only with files that are distributed as part of the
│ configuration source code, so if this file will be created by a resource in
│ this configuration you must instead obtain this result from an attribute of
│ that resource.
╵
│ 
│ The property `disable_bgp_route_propagation` has been superseded by the
│ property `bgp_route_propagation_enabled` and will be removed in v4.0 of the
│ AzureRM Provider.
╵
Error: Process completed with exit code 1.

Expected Behaviour (Required)

No erros in Terraform Plan and Apply job

Actual Behaviour (Required)

image

Steps to Reproduce (Optional)

Run the CD pipeline in GitHub

Important Factoids (Optional)

No response

References (Optional)

No response

autocloudarc commented 1 month ago

Update: I believe I've found a workaround now by ...uploading the starter config.yaml file in the complete folder to the alz-mgmt repository, but would still like to keep this open so it can be further investigated and fixed on the backend anyway (maybe one of the functions inside the ALZ PowerShell module isn't uploading the ./config.yaml file to this GitHub org's alz-mgmt repo?)

image

autocloudarc commented 1 week ago

Since there hasn't been any additional activity for this issue, closing now. The workaround stated can still be referenced anyway when this issue closes.