Skip to content

Commit 358a884

Browse files
committed
bug fixes
1 parent 7eb8d87 commit 358a884

8 files changed

Lines changed: 109 additions & 61 deletions

File tree

alz/azuredevops/main.tf

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -103,26 +103,27 @@ module "azure_devops" {
103103
}
104104

105105
module "file_manipulation" {
106-
source = "../../modules/file_manipulation"
107-
vcs_type = "azuredevops"
108-
files = module.files.files
109-
use_self_hosted_agents_runners = var.use_self_hosted_agents
110-
resource_names = local.resource_names
111-
use_separate_repository_for_templates = var.use_separate_repository_for_templates
112-
iac_type = var.iac_type
113-
module_folder_path = local.starter_module_folder_path
114-
bicep_config_file_path = var.bicep_config_file_path
115-
starter_module_name = var.starter_module_name
116-
project_or_organization_name = var.azure_devops_project_name
117-
root_module_folder_relative_path = var.root_module_folder_relative_path
118-
on_demand_folder_repository = var.on_demand_folder_repository
119-
on_demand_folder_artifact_name = var.on_demand_folder_artifact_name
120-
ci_template_file_name = local.ci_template_file_name
121-
cd_template_file_name = local.cd_template_file_name
122-
pipeline_target_folder_name = local.target_folder_name
123-
bicep_parameters_file_path = var.bicep_parameters_file_path
124-
agent_pool_or_runner_configuration = local.agent_pool_or_runner_configuration
125-
pipeline_files_directory_path = local.pipeline_files_directory_path
126-
pipeline_template_files_directory_path = local.pipeline_template_files_directory_path
127-
terraform_architecture_file_path = var.terraform_architecture_file_path
106+
source = "../../modules/file_manipulation"
107+
vcs_type = "azuredevops"
108+
files = module.files.files
109+
use_self_hosted_agents_runners = var.use_self_hosted_agents
110+
resource_names = local.resource_names
111+
use_separate_repository_for_templates = var.use_separate_repository_for_templates
112+
iac_type = var.iac_type
113+
module_folder_path = local.starter_module_folder_path
114+
bicep_config_file_path = var.bicep_config_file_path
115+
starter_module_name = var.starter_module_name
116+
project_or_organization_name = var.azure_devops_project_name
117+
root_module_folder_relative_path = var.root_module_folder_relative_path
118+
on_demand_folder_repository = var.on_demand_folder_repository
119+
on_demand_folder_artifact_name = var.on_demand_folder_artifact_name
120+
ci_template_file_name = local.ci_template_file_name
121+
cd_template_file_name = local.cd_template_file_name
122+
pipeline_target_folder_name = local.target_folder_name
123+
bicep_parameters_file_path = var.bicep_parameters_file_path
124+
agent_pool_or_runner_configuration = local.agent_pool_or_runner_configuration
125+
pipeline_files_directory_path = local.pipeline_files_directory_path
126+
pipeline_template_files_directory_path = local.pipeline_template_files_directory_path
127+
terraform_architecture_file_path = var.terraform_architecture_file_path
128+
terraform_intermediate_root_management_group_state_resource_path_for_import = var.terraform_intermediate_root_management_group_state_resource_path_for_import
128129
}

alz/azuredevops/variables.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,3 +989,14 @@ variable "terraform_architecture_file_path" {
989989
type = string
990990
default = "lib/architecture_definitions/alz_custom.alz_architecture_definition.yaml"
991991
}
992+
993+
variable "terraform_intermediate_root_management_group_state_resource_path_for_import" {
994+
description = <<-EOT
995+
**(Optional, default: `null`)** Resource path for the management group in the Terraform architecture.
996+
997+
Used for generating accurate resource references in Terraform deployments.
998+
Null when not applicable.
999+
EOT
1000+
type = string
1001+
default = "module.management_groups[0].module.management_groups.azapi_resource.management_groups_level_0"
1002+
}

alz/github/main.tf

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -104,27 +104,28 @@ module "github" {
104104
}
105105

106106
module "file_manipulation" {
107-
source = "../../modules/file_manipulation"
108-
vcs_type = "github"
109-
files = module.files.files
110-
use_self_hosted_agents_runners = var.use_self_hosted_runners
111-
resource_names = local.resource_names
112-
use_separate_repository_for_templates = var.use_separate_repository_for_templates
113-
iac_type = var.iac_type
114-
module_folder_path = local.starter_module_folder_path
115-
bicep_config_file_path = var.bicep_config_file_path
116-
starter_module_name = var.starter_module_name
117-
project_or_organization_name = var.github_organization_name
118-
root_module_folder_relative_path = var.root_module_folder_relative_path
119-
on_demand_folder_repository = var.on_demand_folder_repository
120-
on_demand_folder_artifact_name = var.on_demand_folder_artifact_name
121-
ci_template_file_name = local.ci_template_file_name
122-
cd_template_file_name = local.cd_template_file_name
123-
pipeline_target_folder_name = local.target_folder_name
124-
bicep_parameters_file_path = var.bicep_parameters_file_path
125-
agent_pool_or_runner_configuration = local.agent_pool_or_runner_configuration
126-
pipeline_files_directory_path = local.pipeline_files_directory_path
127-
pipeline_template_files_directory_path = local.pipeline_template_files_directory_path
128-
concurrency_value = local.resource_names.storage_container
129-
terraform_architecture_file_path = var.terraform_architecture_file_path
107+
source = "../../modules/file_manipulation"
108+
vcs_type = "github"
109+
files = module.files.files
110+
use_self_hosted_agents_runners = var.use_self_hosted_runners
111+
resource_names = local.resource_names
112+
use_separate_repository_for_templates = var.use_separate_repository_for_templates
113+
iac_type = var.iac_type
114+
module_folder_path = local.starter_module_folder_path
115+
bicep_config_file_path = var.bicep_config_file_path
116+
starter_module_name = var.starter_module_name
117+
project_or_organization_name = var.github_organization_name
118+
root_module_folder_relative_path = var.root_module_folder_relative_path
119+
on_demand_folder_repository = var.on_demand_folder_repository
120+
on_demand_folder_artifact_name = var.on_demand_folder_artifact_name
121+
ci_template_file_name = local.ci_template_file_name
122+
cd_template_file_name = local.cd_template_file_name
123+
pipeline_target_folder_name = local.target_folder_name
124+
bicep_parameters_file_path = var.bicep_parameters_file_path
125+
agent_pool_or_runner_configuration = local.agent_pool_or_runner_configuration
126+
pipeline_files_directory_path = local.pipeline_files_directory_path
127+
pipeline_template_files_directory_path = local.pipeline_template_files_directory_path
128+
concurrency_value = local.resource_names.storage_container
129+
terraform_architecture_file_path = var.terraform_architecture_file_path
130+
terraform_intermediate_root_management_group_state_resource_path_for_import = var.terraform_intermediate_root_management_group_state_resource_path_for_import
130131
}

alz/github/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,3 +1041,15 @@ variable "terraform_architecture_file_path" {
10411041
type = string
10421042
default = "lib/architecture_definitions/alz_custom.alz_architecture_definition.yaml"
10431043
}
1044+
1045+
variable "terraform_intermediate_root_management_group_state_resource_path_for_import" {
1046+
description = <<-EOT
1047+
**(Optional, default: `null`)** Resource path for the management group in the Terraform architecture.
1048+
1049+
Used for generating accurate resource references in Terraform deployments.
1050+
Null when not applicable.
1051+
EOT
1052+
type = string
1053+
default = "module.management_groups[0].module.management_groups.azapi_resource.management_groups_level_0"
1054+
}
1055+

alz/local/main.tf

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,22 @@ module "azure" {
4949
}
5050

5151
module "file_manipulation" {
52-
source = "../../modules/file_manipulation"
53-
vcs_type = "local"
54-
files = module.files.files
55-
resource_names = local.resource_names
56-
iac_type = var.iac_type
57-
module_folder_path = local.starter_module_folder_path
58-
bicep_config_file_path = var.bicep_config_file_path
59-
starter_module_name = var.starter_module_name
60-
root_module_folder_relative_path = var.root_module_folder_relative_path
61-
on_demand_folder_repository = var.on_demand_folder_repository
62-
on_demand_folder_artifact_name = var.on_demand_folder_artifact_name
63-
pipeline_target_folder_name = local.script_target_folder_name
64-
bicep_parameters_file_path = var.bicep_parameters_file_path
65-
pipeline_files_directory_path = local.script_source_folder_path
66-
terraform_architecture_file_path = var.terraform_architecture_file_path
52+
source = "../../modules/file_manipulation"
53+
vcs_type = "local"
54+
files = module.files.files
55+
resource_names = local.resource_names
56+
iac_type = var.iac_type
57+
module_folder_path = local.starter_module_folder_path
58+
bicep_config_file_path = var.bicep_config_file_path
59+
starter_module_name = var.starter_module_name
60+
root_module_folder_relative_path = var.root_module_folder_relative_path
61+
on_demand_folder_repository = var.on_demand_folder_repository
62+
on_demand_folder_artifact_name = var.on_demand_folder_artifact_name
63+
pipeline_target_folder_name = local.script_target_folder_name
64+
bicep_parameters_file_path = var.bicep_parameters_file_path
65+
pipeline_files_directory_path = local.script_source_folder_path
66+
terraform_architecture_file_path = var.terraform_architecture_file_path
67+
terraform_intermediate_root_management_group_state_resource_path_for_import = var.terraform_intermediate_root_management_group_state_resource_path_for_import
6768
}
6869

6970
resource "local_file" "alz" {

alz/local/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,3 +740,15 @@ variable "terraform_architecture_file_path" {
740740
type = string
741741
default = "lib/architecture_definitions/alz_custom.alz_architecture_definition.yaml"
742742
}
743+
744+
variable "terraform_intermediate_root_management_group_state_resource_path_for_import" {
745+
description = <<-EOT
746+
**(Optional, default: `null`)** Resource path for the management group in the Terraform architecture.
747+
748+
Used for generating accurate resource references in Terraform deployments.
749+
Null when not applicable.
750+
EOT
751+
type = string
752+
default = "module.management_groups[0].module.management_groups.azapi_resource.management_groups_level_0"
753+
}
754+

modules/file_manipulation/locals.intermediate_root_management_group.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ locals {
1414
locals {
1515
import_block = <<EOT
1616
import {
17-
to = azapi_resource.management_groups_level_0["${local.intermediate_root_management_group.id}"]
17+
to = ${var.terraform_intermediate_root_management_group_state_resource_path_for_import}["${local.intermediate_root_management_group.id}"]
1818
id = "/providers/Microsoft.Management/managementGroups/${local.intermediate_root_management_group.id}"
1919
}
2020
EOT

modules/file_manipulation/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,3 +240,13 @@ variable "terraform_architecture_file_path" {
240240
EOT
241241
type = string
242242
}
243+
244+
variable "terraform_intermediate_root_management_group_state_resource_path_for_import" {
245+
description = <<-EOT
246+
**(Optional, default: `null`)** Resource path for the management group in the Terraform architecture.
247+
248+
Used for generating accurate resource references in Terraform deployments.
249+
Null when not applicable.
250+
EOT
251+
type = string
252+
}

0 commit comments

Comments
 (0)