Skip to content

Commit 5ebdf5a

Browse files
committed
fix(terraform): update role assignments to use demo_group for AKS, OpenAI, and Service Bus modules
1 parent c663293 commit 5ebdf5a

4 files changed

Lines changed: 24 additions & 9 deletions

File tree

infra/terraform/kubernetes.tf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,11 @@ module "aks" {
6464
module "aks-role" {
6565
source = "Azure/avm-res-authorization-roleassignment/azurerm"
6666
version = "0.2.0"
67-
users_by_object_id = {
68-
current_user = data.azurerm_client_config.current.object_id
67+
# users_by_object_id = {
68+
# current_user = data.azurerm_client_config.current.object_id
69+
# }
70+
groups_by_object_id = {
71+
demo_group = azuread_group_without_members.example.object_id
6972
}
7073
role_definitions = {
7174
aks_cluster_admin_role = {
@@ -78,7 +81,7 @@ module "aks-role" {
7881
role_assignments = {
7982
role_assignment_1 = {
8083
role_definition = "aks_cluster_admin_role"
81-
any_principals = ["current_user"]
84+
groups = ["demo_group"]
8285
}
8386
}
8487
}

infra/terraform/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,9 @@ resource "azurerm_resource_group" "example" {
8282
name = "rg-${local.name}"
8383
location = var.location
8484
}
85+
86+
resource "azuread_group_without_members" "example" {
87+
display_name = "AKS Store Demo App"
88+
owners = [data.azuread_client_config.current.object_id]
89+
security_enabled = true
90+
}

infra/terraform/openai.tf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,11 @@ module "aoai-role" {
4444
count = local.deploy_azure_openai ? 1 : 0
4545
source = "Azure/avm-res-authorization-roleassignment/azurerm"
4646
version = "0.2.0"
47-
users_by_object_id = {
48-
current_user = data.azurerm_client_config.current.object_id
47+
# users_by_object_id = {
48+
# current_user = data.azurerm_client_config.current.object_id
49+
# }
50+
groups_by_object_id = {
51+
"demo_group" = azuread_group_without_members.example.object_id
4952
}
5053
role_definitions = {
5154
cognitive_services_openai_user_role = {
@@ -58,7 +61,7 @@ module "aoai-role" {
5861
role_assignments = {
5962
role_assignment_1 = {
6063
role_definition = "cognitive_services_openai_user_role"
61-
any_principals = ["current_user"]
64+
any_principals = ["demo_group"]
6265
}
6366
}
6467
}

infra/terraform/servicebus.tf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ module "avm-res-authorization-roleassignment-sb" {
2222
count = local.deploy_azure_servicebus ? 1 : 0
2323
source = "Azure/avm-res-authorization-roleassignment/azurerm"
2424
version = "0.2.0"
25-
users_by_object_id = {
26-
current_user = data.azurerm_client_config.current.object_id
25+
# users_by_object_id = {
26+
# current_user = data.azurerm_client_config.current.object_id
27+
# }
28+
groups_by_object_id = {
29+
demo_group = azuread_group_without_members.example.object_id
2730
}
2831
role_definitions = {
2932
service_bus_data_owner_role = {
@@ -36,7 +39,7 @@ module "avm-res-authorization-roleassignment-sb" {
3639
role_assignments = {
3740
role_assignment_1 = {
3841
role_definition = "service_bus_data_owner_role"
39-
any_principals = ["current_user"]
42+
any_principals = ["demo_group"]
4043
}
4144
}
4245
}

0 commit comments

Comments
 (0)