Skip to content

Commit

Permalink
Merge pull request #15 from krowlandson/main
Browse files Browse the repository at this point in the history
Improve dependency map for partial deployments
  • Loading branch information
Kevin Rowlandson authored Oct 19, 2020
2 parents d21d699 + 137b5fb commit 8dab50e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ variable "tenant_id" {
module "enterprise_scale" {
source = "Azure/caf-enterprise-scale/azurerm"
version = "0.0.5-preview"
version = "0.0.6-preview"
root_parent_id = var.tenant_id
Expand All @@ -93,7 +93,7 @@ variable "tenant_id" {
module "enterprise_scale" {
source = "Azure/caf-enterprise-scale/azurerm"
version = "0.0.5-preview"
version = "0.0.6-preview"
# Mandatory Variables
root_parent_id = var.tenant_id
Expand Down
2 changes: 1 addition & 1 deletion resources.policy_assignments.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ resource "azurerm_policy_assignment" "enterprise_scale" {
not_scopes = try(length(each.value.template.properties.notScopes) > 0, false) ? each.value.template.properties.notScopes : local.empty_list
enforcement_mode = try(length(each.value.template.properties.enforcementMode) > 0, false) ? each.value.template.properties.enforcementMode : true

# Set explicit dependency on Policy Definition and Policy Set Definition deployments
# Set explicit dependency on Management Group, Policy Definition and Policy Set Definition deployments
depends_on = [
azurerm_management_group.level_1,
azurerm_management_group.level_2,
Expand Down
8 changes: 7 additions & 1 deletion resources.policy_set_definitions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ resource "azurerm_policy_set_definition" "enterprise_scale" {
metadata = try(length(each.value.template.metadata) > 0, false) ? jsonencode(each.value.template.metadata) : local.empty_string
parameters = try(length(each.value.template.parameters) > 0, false) ? jsonencode(each.value.template.parameters) : local.empty_string

# Set explicit dependency on Policy Definition deployments
# Set explicit dependency on Management Group and Policy Definition deployments
depends_on = [
azurerm_management_group.level_1,
azurerm_management_group.level_2,
azurerm_management_group.level_3,
azurerm_management_group.level_4,
azurerm_management_group.level_5,
azurerm_management_group.level_6,
azurerm_policy_definition.enterprise_scale,
]

Expand Down
11 changes: 11 additions & 0 deletions resources.role_assignments.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,15 @@ resource "azurerm_role_assignment" "enterprise_scale" {
role_definition_id = null // Not currently used
skip_service_principal_aad_check = null // Not currently used

# Set explicit dependency on Management Group and Role Definition deployments
depends_on = [
azurerm_management_group.level_1,
azurerm_management_group.level_2,
azurerm_management_group.level_3,
azurerm_management_group.level_4,
azurerm_management_group.level_5,
azurerm_management_group.level_6,
azurerm_role_definition.enterprise_scale,
]

}

0 comments on commit 8dab50e

Please sign in to comment.