File tree Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -9,9 +9,16 @@ resource "azurerm_container_group" "this" {
9
9
subnet_ids = var. subnet_ids
10
10
tags = var. tags
11
11
12
- identity {
13
- type = var. identity_ids == null ? " SystemAssigned" : " SystemAssigned, UserAssigned"
14
- identity_ids = var. identity_ids
12
+ dynamic "identity" {
13
+ for_each = (var. enable_system_assigned_identity || var. identity_ids != null ) ? [1 ] : []
14
+
15
+ content {
16
+ type = join (" , " , compact ([
17
+ var . enable_system_assigned_identity ? " SystemAssigned" : " " ,
18
+ var . identity_ids != null ? " UserAssigned" : " "
19
+ ]))
20
+ identity_ids = var. identity_ids
21
+ }
15
22
}
16
23
17
24
dynamic "image_registry_credential" {
Original file line number Diff line number Diff line change @@ -37,6 +37,12 @@ variable "restart_policy" {
37
37
default = " Never"
38
38
}
39
39
40
+ variable "enable_system_assigned_identity" {
41
+ type = bool
42
+ description = " Specifies whether to enable System Assigned identity for container instance or not"
43
+ default = false
44
+ }
45
+
40
46
variable "identity_ids" {
41
47
type = list (string )
42
48
description = " Specifies a list of User Assigned Managed Identity IDs to be assigned to this Container Group."
@@ -70,9 +76,9 @@ variable "exposed_ports_udp" {
70
76
variable "image_registry_credential" {
71
77
type = list (object ({
72
78
server = string
73
- username = string
74
- password = string
75
- user_assigned_identity_id = string
79
+ username = optional ( string )
80
+ password = optional ( string )
81
+ user_assigned_identity_id = optional ( string )
76
82
}))
77
83
description = " List of objects to configure connection to private registry"
78
84
default = []
You can’t perform that action at this time.
0 commit comments