Skip to content

Commit

Permalink
feat(azuread-provider): upgrade to v2 #49
Browse files Browse the repository at this point in the history
  • Loading branch information
julie-ng committed Jan 11, 2022
1 parent 3a82a5f commit fd7a1e6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ resource "azuread_group" "groups" {
for_each = var.groups
display_name = "demo-${each.value}-${local.suffix}"
prevent_duplicate_names = true
security_enabled = true
}

# ------------------
Expand Down Expand Up @@ -205,4 +206,4 @@ module "service_connections" {
module.arm_environments,
module.service_principals
]
}
}
10 changes: 0 additions & 10 deletions modules/service-principal/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,12 @@
# ------------------
# See https://docs.microsoft.com/en-us/azure/active-directory/develop/app-objects-and-service-principals

resource "random_password" "secret" {
length = 30
special = true
min_numeric = 5
min_special = 2
override_special = "-_%@?"
}

resource "azuread_application" "app" {
display_name = local.name
}

resource "azuread_application_password" "workspace_sp_secret" {
application_object_id = azuread_application.app.object_id
value = random_password.secret.result
end_date_relative = var.password_lifetime
}

resource "azuread_service_principal" "sp" {
Expand Down
8 changes: 4 additions & 4 deletions modules/service-principal/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ output "aad_app" {
}

output "display_name" {
value = azuread_application.app.display_name
value = azuread_application.app.display_name
}

output "principal_id" {
value = azuread_service_principal.sp.id
value = azuread_service_principal.sp.id
}

output "client_id" {
Expand All @@ -20,7 +20,7 @@ output "client_id" {
}

output "client_secret" {
value = random_password.secret.result
description = "Client Secret for Service Principal"
value = azuread_application_password.workspace_sp_secret.value
description = "Client Secret for Service Principal to be imported into Key Vault"
sensitive = true
}

0 comments on commit fd7a1e6

Please sign in to comment.