Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions alz/azuredevops/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ module "azure_devops" {
agent_pool_name = local.resource_names.version_control_system_agent_pool
use_self_hosted_agents = var.use_self_hosted_agents
create_branch_policies = var.create_branch_policies
create_variable_group = var.iac_type == "terraform"
}

module "file_manipulation" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ stages:
displayName: What If
condition: eq($${{ parameters.skipWhatIf }}, false)
variables:
- group: ${variable_group_name}
- name: parametersFileName
value: parameters.json

Expand Down Expand Up @@ -75,7 +74,6 @@ stages:
dependsOn: whatif
condition: not(or(failed(), canceled()))
variables:
- group: ${variable_group_name}
- name: parametersFileName
value: parameters.json

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ stages:
- stage: validate
displayName: Validation Bicep
variables:
- group: ${variable_group_name}
- name: parametersFileName
value: parameters.json

Expand Down
1 change: 1 addition & 0 deletions alz/github/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ module "github" {
default_runner_group_name = var.default_runner_group_name
use_self_hosted_runners = var.use_self_hosted_runners
create_branch_policies = var.create_branch_policies
create_storage_account_variables = var.iac_type == "terraform"
}

module "file_manipulation" {
Expand Down
8 changes: 7 additions & 1 deletion modules/azure_devops/variable_group.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
resource "azuredevops_variable_group" "example" {
resource "azuredevops_variable_group" "alz" {
count = var.create_variable_group ? 1 : 0
project_id = local.project_id
name = var.variable_group_name
description = var.variable_group_name
Expand All @@ -19,3 +20,8 @@ resource "azuredevops_variable_group" "example" {
value = var.backend_azure_storage_account_container_name
}
}

moved {
from = "azuredevops_variable_group.example"
to = "azuredevops_variable_group.alz[0]"
}
10 changes: 10 additions & 0 deletions modules/azure_devops/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -288,3 +288,13 @@ variable "create_branch_policies" {
EOT
type = bool
}

variable "create_variable_group" {
description = <<-EOT
**(Required)** Whether to create an Azure Pipelines variable group for shared configuration.

When true, creates a variable group containing backend and subscription details
used across multiple pipelines.
EOT
type = bool
}
18 changes: 18 additions & 0 deletions modules/github/action_variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,37 @@ resource "github_actions_variable" "azure_tenant_id" {
}

resource "github_actions_variable" "backend_azure_resource_group_name" {
count = var.create_storage_account_variables ? 1 : 0
repository = github_repository.alz.name
variable_name = "BACKEND_AZURE_RESOURCE_GROUP_NAME"
value = var.backend_azure_resource_group_name
}

resource "github_actions_variable" "backend_azure_storage_account_name" {
count = var.create_storage_account_variables ? 1 : 0
repository = github_repository.alz.name
variable_name = "BACKEND_AZURE_STORAGE_ACCOUNT_NAME"
value = var.backend_azure_storage_account_name
}

resource "github_actions_variable" "backend_azure_storage_account_container_name" {
count = var.create_storage_account_variables ? 1 : 0
repository = github_repository.alz.name
variable_name = "BACKEND_AZURE_STORAGE_ACCOUNT_CONTAINER_NAME"
value = var.backend_azure_storage_account_container_name
}

moved {
from = "github_actions_variable.backend_azure_resource_group_name"
to = "github_actions_variable.backend_azure_resource_group_name[0]"
}

moved {
from = "github_actions_variable.backend_azure_storage_account_name"
to = "github_actions_variable.backend_azure_storage_account_name[0]"
}

moved {
from = "github_actions_variable.backend_azure_storage_account_container_name"
to = "github_actions_variable.backend_azure_storage_account_container_name[0]"
}
10 changes: 10 additions & 0 deletions modules/github/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -270,3 +270,13 @@ variable "create_branch_policies" {
EOT
type = bool
}

variable "create_storage_account_variables" {
description = <<-EOT
**(Required)** Whether to create GitHub Actions variables for Azure storage account details.

When true: Creates repository-level variables for backend storage configuration
When false: Assumes variables are managed externally
EOT
type = bool
}
Loading