Skip to content

Commit

Permalink
feat: Azure bootstrap service principle roles (GaloyMoney#61)
Browse files Browse the repository at this point in the history
* test spn creation for running inception

* fix spn creation for app reg

* fix spn creation for app reg

* fix spn scope arguments

* longer app secret expiry

* removed unused comment block
  • Loading branch information
fireballpoint1 committed Aug 8, 2022
1 parent 3da9f9d commit dfe7b32
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions modules/bootstrap/azure/service-principal.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,19 @@ provider "azurerm" {
resource "azuread_service_principal" "bootstrap" {
application_id = azuread_application.inception.application_id
}

# Create Application password (client secret)
resource "azuread_application_password" "inception_app_password" {
application_object_id = azuread_application.inception.object_id
end_date_relative = "48h" # expire in 3 years
}

data "azurerm_subscription" "current" {
}

# Create Contributor role assignment for Service Principal
resource "azurerm_role_assignment" "bootstrap_spn_contributor" {
scope = data.azurerm_subscription.current.id
role_definition_name = "Contributor"
principal_id = azuread_service_principal.bootstrap.id
}

0 comments on commit dfe7b32

Please sign in to comment.