Skip to content

Commit

Permalink
feat(azuread_application): random id for oauth2_permission_scope (#2027)
Browse files Browse the repository at this point in the history
Co-authored-by: Simon Schneider <[email protected]>
  • Loading branch information
arnaudlh and Simon Schneider authored Sep 6, 2024
2 parents 5c9c51f + 36863f0 commit cf4f9d3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ azuread_applications = {
id = "d4c3605a-b327-35c5-f04d-77f7fcdd4995"
type = "Admin"
value = "app"
},
{
admin_consent_description = "Allow to administer app2."
admin_consent_display_name = "Administer app2"
enabled = true
type = "Admin"
value = "app2"
}
]
}
Expand Down
9 changes: 8 additions & 1 deletion modules/azuread/applications_v1/azuread_application.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ resource "azuread_application" "app" {
content {
admin_consent_description = oauth2_permission_scope.value.admin_consent_description
admin_consent_display_name = oauth2_permission_scope.value.admin_consent_display_name
id = oauth2_permission_scope.value.id
id = try(oauth2_permission_scope.value.id, random_uuid.oauth2_permission_scopes[oauth2_permission_scope.key].id)
enabled = try(oauth2_permission_scope.value.enabled, null)
type = try(oauth2_permission_scope.value.type, null)
user_consent_description = try(oauth2_permission_scope.value.user_consent_description, null)
Expand Down Expand Up @@ -131,3 +131,10 @@ resource "random_uuid" "app_role_id" {
if try(value.id, null) == null
}
}

resource "random_uuid" "oauth2_permission_scopes" {
for_each = {
for key, value in try(var.settings.api.oauth2_permission_scopes, {}) : key => value
if try(value.id, null) == null
}
}

0 comments on commit cf4f9d3

Please sign in to comment.