Skip to content

Commit

Permalink
chore: move mgmt sub and set a prefix for management groups
Browse files Browse the repository at this point in the history
  • Loading branch information
florianow committed Feb 23, 2024
1 parent 568fe5e commit f298d47
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
4 changes: 4 additions & 0 deletions kit/azure/organization-hierarchy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,15 @@ After deploying this module, you should probably deploy the following kit module
| [azurerm_management_group.management](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/management_group) | resource |
| [azurerm_management_group.parent](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/management_group) | resource |
| [azurerm_management_group.platform](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/management_group) | resource |
| [azurerm_management_group_subscription_association.management](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/management_group_subscription_association) | resource |
| [azurerm_subscription.management](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/subscription) | resource |
| [azurerm_subscription.current](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subscription) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_cloudfoundation"></a> [cloudfoundation](#input\_cloudfoundation) | Name of your cloud foundation | `string` | n/a | yes |
| <a name="input_connectivity"></a> [connectivity](#input\_connectivity) | n/a | `string` | `"lv-connectivity"` | no |
| <a name="input_identity"></a> [identity](#input\_identity) | n/a | `string` | `"lv-identity"` | no |
| <a name="input_landingzones"></a> [landingzones](#input\_landingzones) | n/a | `string` | `"lv-landingzones"` | no |
Expand Down
4 changes: 1 addition & 3 deletions kit/azure/organization-hierarchy/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,10 @@ resource "azurerm_management_group" "management" {
parent_management_group_id = azurerm_management_group.platform.id
}

# Move management subscription into the new organization hierarchy
# add this if moving the management group under the created hierardhy is desired
# moves the management subscription into the new organization hierarchy
data "azurerm_subscription" "current" {
}

# add a name to the existing subscription
resource "azurerm_subscription" "management" {
subscription_id = data.azurerm_subscription.current.subscription_id
subscription_name = "${var.cloudfoundation}-management"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,19 @@ provider "azurerm" {
EOF
}

locals {
# the prefix used the name of your cloudfoundation
management_group_prefix = "${include.platform.locals.cloudfoundation.name}"
}

inputs = {
# todo: set input variables
connectivity = "lv-connectivity"
identity = "lv-identity"
landingzones = "lv-landingzones"
cloudfoundation = "${local.management_group_prefix}"
connectivity = "${local.management_group_prefix}-connectivity"
identity = "${local.management_group_prefix}-identity"
landingzones = "${local.management_group_prefix}-landingzones"
locations = ["germanywestcentral"]
management = "lv-management"
parentManagementGroup = "lv-foundation"
platform = "lv-platform"

management = "${local.management_group_prefix}-management"
parentManagementGroup = "${local.management_group_prefix}-foundation"
platform = "${local.management_group_prefix}-platform"
}
5 changes: 5 additions & 0 deletions kit/azure/organization-hierarchy/variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
variable "cloudfoundation" {
type = string
nullable = false
description = "Name of your cloud foundation"
}

variable "parentManagementGroup" {
default = "lv-foundation"
Expand Down

0 comments on commit f298d47

Please sign in to comment.