Skip to content

Commit 78d7dd1

Browse files
authored
fix(azure): use object id instead of principal id (#71)
The documentation for the `application_password` resource says: >`application_object_id` - (Required) The Object ID of the Application >for which this password should be created. Changing this field forces >a new resource to be created. https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/resources/application_password#application_object_id We were using the wrong id. 🤦 Signed-off-by: Salim Afiune Maya <afiune@lacework.net>
1 parent af9c35e commit 78d7dd1

File tree

1 file changed

+2
-2
lines changed
  • azure/modules/ad_application

1 file changed

+2
-2
lines changed

azure/modules/ad_application/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ resource "azurerm_role_assignment" "grant_reader_role_to_subscriptions" {
9898
count = var.create ? length(data.azurerm_subscriptions.available.subscriptions) : 0
9999
scope = "/subscriptions/${data.azurerm_subscriptions.available.subscriptions[count.index].subscription_id}"
100100

101-
principal_id = azuread_service_principal.lacework[0].id
101+
principal_id = local.service_principal_id
102102
role_definition_name = "Reader"
103103
}
104104

@@ -109,7 +109,7 @@ resource "random_password" "generator" {
109109

110110
resource "azuread_application_password" "client_secret" {
111111
count = var.create ? 1 : 0
112-
application_object_id = local.service_principal_id
112+
application_object_id = azuread_application.lacework[count.index].object_id
113113
value = random_password.generator[count.index].result
114114
end_date = "2299-12-31T01:02:03Z"
115115
depends_on = [azuread_service_principal.lacework]

0 commit comments

Comments
 (0)