Skip to content

Commit

Permalink
standardise identity ids
Browse files Browse the repository at this point in the history
  • Loading branch information
Darrell Bolger committed Jan 24, 2024
1 parent a0732b9 commit b18fb5c
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 24 deletions.
9 changes: 6 additions & 3 deletions modules/cognitive-account/src/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ resource "azurerm_cognitive_account" "main" {
}
}

identity {
type = var.identity_ids == null ? "SystemAssigned" : "SystemAssigned, UserAssigned"
identity_ids = var.identity_ids
dynamic "identity" {
for_each = var.identity != null ? [{}] : []
content {
type = identity.value.type
identity_ids = identity.value.identity_ids
}
}
}

Expand Down
12 changes: 9 additions & 3 deletions modules/cognitive-account/src/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ variable "fqdns" {
default = null
}

variable "identity_ids" {
type = list(string)
default = null
variable "identity" {
type = object({
type = string
identity_ids = optional(list(string))
})
default = {
type = "SystemAssigned"
identity_ids = []
}
}

variable "identifier" {
Expand Down
9 changes: 6 additions & 3 deletions modules/cosmosdb-account/src/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ resource "azurerm_cosmosdb_account" "main" {
}
}

identity {
type = var.identity_ids == null ? "SystemAssigned" : "SystemAssigned, UserAssigned"
identity_ids = var.identity_ids
dynamic "identity" {
for_each = var.identity != null ? [{}] : []
content {
type = identity.value.type
identity_ids = identity.value.identity_ids
}
}
}
12 changes: 9 additions & 3 deletions modules/cosmosdb-account/src/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ variable "failover_locations" {
default = null
}

variable "identity_ids" {
type = list(string)
default = null
variable "identity" {
type = object({
type = string
identity_ids = optional(list(string))
})
default = {
type = "SystemAssigned"
identity_ids = []
}
}

variable "identifier" {
Expand Down
9 changes: 6 additions & 3 deletions modules/linux-function-app/src/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ resource "azurerm_linux_function_app" "main" {
}
}

identity {
type = var.identity_ids == null ? "SystemAssigned" : "SystemAssigned, UserAssigned"
identity_ids = var.identity_ids
dynamic "identity" {
for_each = var.identity != null ? [{}] : []
content {
type = identity.value.type
identity_ids = identity.value.identity_ids
}
}
}

Expand Down
12 changes: 9 additions & 3 deletions modules/linux-function-app/src/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,15 @@ variable "identifier" {
type = string
}

variable "identity_ids" {
type = list(string)
default = null
variable "identity" {
type = object({
type = string
identity_ids = optional(list(string))
})
default = {
type = "SystemAssigned"
identity_ids = []
}
}

variable "instrumentation_key" {
Expand Down
9 changes: 6 additions & 3 deletions modules/linux-web-app/src/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@ resource "azurerm_linux_web_app" "main" {
}
}

identity {
type = var.identity_ids == null ? "SystemAssigned" : "SystemAssigned, UserAssigned"
identity_ids = var.identity_ids
dynamic "identity" {
for_each = var.identity != null ? [{}] : []
content {
type = identity.value.type
identity_ids = identity.value.identity_ids
}
}
}

Expand Down
12 changes: 9 additions & 3 deletions modules/linux-web-app/src/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,15 @@ variable "identifier" {
type = string
}

variable "identity_ids" {
type = list(string)
default = null
variable "identity" {
type = object({
type = string
identity_ids = optional(list(string))
})
default = {
type = "SystemAssigned"
identity_ids = []
}
}

variable "instrumentation_key" {
Expand Down

0 comments on commit b18fb5c

Please sign in to comment.