Skip to content

Commit

Permalink
Add mgmt identity (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
adusumillipraveen authored Feb 20, 2023
1 parent a523b9e commit 47f8f6a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
18 changes: 18 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,21 @@ resource "azurerm_user_assigned_identity" "managed_identity" {

tags = var.common_tags
}

locals {
mgmt_env = ( var.env == "sandbox") ? "cftsbox-intsvc" : "cftptl-intsvc"
}

resource "azurerm_user_assigned_identity" "mgmt_managed_identity" {

count = (var.env == "sandbox" || var.env == "prod" ) ? 1 : 0

provider = azurerm.mgmt

resource_group_name = "managed-identities-${local.mgmt_env}-rg"
location = var.location

name = "${var.product}-${local.mgmt_env}-mi"

tags = var.common_tags
}
7 changes: 7 additions & 0 deletions state.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,11 @@ terraform {

provider "azurerm" {
features {}
}

provider "azurerm" {
alias = "mgmt"
subscription_id = var.mgmt_subscription_id
skip_provider_registration = true
features {}
}
4 changes: 3 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ variable "location" {

variable "common_tags" {
type = map(string)
}
}

variable "mgmt_subscription_id" {}

0 comments on commit 47f8f6a

Please sign in to comment.