Azure / Azure-Landing-Zones-Library

Library of assets to deploy Azure Landing Zones architectures
https://azure.github.io/Azure-Landing-Zones-Library/
MIT License
17 stars 7 forks source link

Error processing override archetype identity_override - base archetype identity does not exist in the library #12

Closed chris-chalmers-soteria365 closed 2 months ago

chris-chalmers-soteria365 commented 3 months ago

Following the recent release I am unable to consume the archetype_definitions with https://registry.terraform.io/modules/Azure/avm-ptn-alz/azurerm/latest to override base_archetype. For identity and management I receive an error during Terraform Plan: _Error processing override archetype identityoverride - base archetype identity does not exist in the library.

lib/archetype_override_identity.json

{ "base_archetype": "identity", "name": "identity_override", "policy_assignments_to_add": [ "Deny-Private-DNS-Zones" ] }

resources.tf

module "alz_archetype_identity" { source = "git::https://github.com/Azure/terraform-azurerm-avm-ptn-alz?ref=v0.6.0" id = "${lower(var.client_friendly_name)}-identity" display_name = "Identity" parent_resource_id = module.alz_archetype_platform.management_group_resource_id base_archetype = "identity_override" default_location = var.location default_log_analytics_workspace_id = module.alz_management_resources.log_analytics_workspace.id }

providers.tf

provider "alz" { lib_urls = [ "./lib" ] }

versions.tf

terraform { required_version = ">= 1.7.5"

required_providers { azurerm = { source = "hashicorp/azurerm" version = ">= 3.96.0" } alz = { source = "azure/alz" version = ">= 0.6.3" } } }

chris-chalmers-soteria365 commented 3 months ago

Attempted to use the previous release by specifying alz_lib_ref with alz but it doesn't appear to download the older version

providers.tf

provider "alz" { alz_lib_ref = "platform/alz/2024.03.00" }

Workaround is to download the previous release source then save into a folder azlib_2024_03_00 then use

providers.tf

provider "alz" { use_alz_lib = false lib_urls = [ "./azlib_2024_03_00" ] }

igor-janevski-pbi commented 3 months ago

Same issue on our side. Can you please provide a fix asap?

matt-FFFFFF commented 3 months ago

Hi Please use the legacy tag: https://github.com/Azure/Azure-Landing-Zones-Library/tree/platform/alz/2024.03.01-legacy

igor-janevski-pbi commented 3 months ago

@matt-FFFFFF please share an example of how would the configs look (providers.tf and terraform.tf).

matt-FFFFFF commented 3 months ago

Can you try setting this config:

provider "alz" {
  alz_lib_ref = "2024.03.01-legacy"
}
igor-janevski-pbi commented 3 months ago

it doesn't work

│ Error: Archetype not found
│ 
│   with module.alz_archetype_identity.data.alz_archetype_keys.this,
│   on .terraform/modules/alz_archetype_identity/main.tf line 1, in data "alz_archetype_keys" "this":
│    1: data "alz_archetype_keys" "this" {
│ 
│ Unable to find archetype identity_override
matt-FFFFFF commented 3 months ago

@igor-janevski-pbi then you'll have to use this approach

Workaround is to download the previous release source then save into a folder azlib_2024_03_00 then use

providers.tf

provider "alz" {

use_alz_lib = false

lib_urls = [

"./azlib_2024_03_00"

]

}

matt-FFFFFF commented 3 months ago

Hi,

this should also work - there was a bug in the go-getter code

provider "alz" {
  use_alz_lib = false
  lib_urls = [
    "git::github.com/Azure/Azure-landing-zones-library?ref%3Dplatform%2Falz%2F2024.03.01-legacy"
  ]
igor-janevski-pbi commented 3 months ago
/usr/bin/git exited with 128: fatal: repository
│ '/home/vsts/work/1/s/terraform-azurerm-clz/github.com%2FAzure%2FAzure-landing-zones-library?ref%3Dplatform%2Falz%2F2024.03.01-legacy='
│ does not exist
│ 
matt-FFFFFF commented 3 months ago

Ok then I'm sorry but you'll have to copy the files locally and use the method described above

igor-janevski-pbi commented 2 months ago

Yes, that's how we use it now. Will this be fixed in some upcoming release though?

matt-FFFFFF commented 2 months ago

The next release will fix this, yes. However there will be some breaking changes too. As per the note on the provider and the module we are in active development.