Repository navigation
Add Azure providers and create incubator's Azure CI identities - #240
Merged
Merged
Conversation
Contributor
|
Terraform plan in terraform Plan: 11 to add, 0 to change, 0 to destroy. Changes to Outputs.Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# azapi_resource.incubator_ci_federated_credential["apply"] will be created
+ resource "azapi_resource" "incubator_ci_federated_credential" {
+ body = {
+ properties = {
+ audiences = [
+ "api://AzureADTokenExchange",
]
+ claimsMatchingExpression = {
+ languageVersion = 1
+ value = "claims['sub'] eq 'repo:hackforla/incubator:ref:refs/heads/main' and claims['repository_id'] eq '348201813' and claims['repository_owner_id'] eq '11635254'"
}
+ issuer = "https://token.actions.githubusercontent.com"
}
}
+ id = (known after apply)
+ ignore_body_changes = (write-only attribute)
+ ignore_casing = false
+ ignore_missing_property = true
+ ignore_null_property = false
+ name = "github-incubator"
+ output = (known after apply)
+ parent_id = (known after apply)
+ schema_validation_enabled = false
+ sensitive_body = (write-only attribute)
+ type = "Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials@2025-05-31-preview"
}
# azapi_resource.incubator_ci_federated_credential["plan"] will be created
+ resource "azapi_resource" "incubator_ci_federated_credential" {
+ body = {
+ properties = {
+ audiences = [
+ "api://AzureADTokenExchange",
]
+ claimsMatchingExpression = {
+ languageVersion = 1
+ value = "claims['sub'] matches 'repo:*' and claims['repository_id'] eq '348201813' and claims['repository_owner_id'] eq '11635254'"
}
+ issuer = "https://token.actions.githubusercontent.com"
}
}
+ id = (known after apply)
+ ignore_body_changes = (write-only attribute)
+ ignore_casing = false
+ ignore_missing_property = true
+ ignore_null_property = false
+ name = "github-incubator"
+ output = (known after apply)
+ parent_id = (known after apply)
+ schema_validation_enabled = false
+ sensitive_body = (write-only attribute)
+ type = "Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials@2025-05-31-preview"
}
# azuread_app_role_assignment.incubator_ci["apply-app-readwrite-ownedby"] will be created
+ resource "azuread_app_role_assignment" "incubator_ci" {
+ app_role_id = "************************************"
+ id = (known after apply)
+ principal_display_name = (known after apply)
+ principal_object_id = (known after apply)
+ principal_type = (known after apply)
+ resource_display_name = (known after apply)
+ resource_object_id = "************************************"
}
# azuread_app_role_assignment.incubator_ci["plan-app-read-all"] will be created
+ resource "azuread_app_role_assignment" "incubator_ci" {
+ app_role_id = "************************************"
+ id = (known after apply)
+ principal_display_name = (known after apply)
+ principal_object_id = (known after apply)
+ principal_type = (known after apply)
+ resource_display_name = (known after apply)
+ resource_object_id = "************************************"
}
# azurerm_resource_group.incubator_ci[0] will be created
+ resource "azurerm_resource_group" "incubator_ci" {
+ id = (known after apply)
+ location = "westus2"
+ name = "incubator-ci"
+ tags = {
+ "managed-by" = "terraform-devops-security"
}
}
# azurerm_role_assignment.incubator_ci["apply-contributor"] will be created
+ resource "azurerm_role_assignment" "incubator_ci" {
+ condition_version = (known after apply)
+ id = (known after apply)
+ name = (known after apply)
+ principal_id = (known after apply)
+ principal_type = "ServicePrincipal"
+ role_definition_id = (known after apply)
+ role_definition_name = "Contributor"
+ scope = "/subscriptions/12253474-af37-486c-bf98-182c9b3bdeb2"
+ skip_service_principal_aad_check = (known after apply)
}
# azurerm_role_assignment.incubator_ci["apply-rbac-admin"] will be created
+ resource "azurerm_role_assignment" "incubator_ci" {
+ condition_version = (known after apply)
+ id = (known after apply)
+ name = (known after apply)
+ principal_id = (known after apply)
+ principal_type = "ServicePrincipal"
+ role_definition_id = (known after apply)
+ role_definition_name = "Role Based Access Control Administrator"
+ scope = "/subscriptions/12253474-af37-486c-bf98-182c9b3bdeb2"
+ skip_service_principal_aad_check = (known after apply)
}
# azurerm_role_assignment.incubator_ci["plan-kv-secrets"] will be created
+ resource "azurerm_role_assignment" "incubator_ci" {
+ condition_version = (known after apply)
+ id = (known after apply)
+ name = (known after apply)
+ principal_id = (known after apply)
+ principal_type = "ServicePrincipal"
+ role_definition_id = (known after apply)
+ role_definition_name = "Key Vault Secrets User"
+ scope = "/subscriptions/12253474-af37-486c-bf98-182c9b3bdeb2"
+ skip_service_principal_aad_check = (known after apply)
}
# azurerm_role_assignment.incubator_ci["plan-reader"] will be created
+ resource "azurerm_role_assignment" "incubator_ci" {
+ condition_version = (known after apply)
+ id = (known after apply)
+ name = (known after apply)
+ principal_id = (known after apply)
+ principal_type = "ServicePrincipal"
+ role_definition_id = (known after apply)
+ role_definition_name = "Reader"
+ scope = "/subscriptions/12253474-af37-486c-bf98-182c9b3bdeb2"
+ skip_service_principal_aad_check = (known after apply)
}
# azurerm_user_assigned_identity.incubator_ci["apply"] will be created
+ resource "azurerm_user_assigned_identity" "incubator_ci" {
+ client_id = (known after apply)
+ id = (known after apply)
+ location = "westus2"
+ name = "incubator-tf-apply"
+ principal_id = (known after apply)
+ resource_group_name = "incubator-ci"
+ tags = {
+ "managed-by" = "terraform-devops-security"
}
+ tenant_id = (known after apply)
}
# azurerm_user_assigned_identity.incubator_ci["plan"] will be created
+ resource "azurerm_user_assigned_identity" "incubator_ci" {
+ client_id = (known after apply)
+ id = (known after apply)
+ location = "westus2"
+ name = "incubator-tf-plan"
+ principal_id = (known after apply)
+ resource_group_name = "incubator-ci"
+ tags = {
+ "managed-by" = "terraform-devops-security"
}
+ tenant_id = (known after apply)
}
Plan: 11 to add, 0 to change, 0 to destroy.
Changes to Outputs:
+ incubator_azure_ci_client_ids = {
+ apply = (known after apply)
+ plan = (known after apply)
}✅ Plan applied in Apply Terraform changes on merge #65 Outputsincubator_azure_ci_client_ids = {
apply = "3ed75320-4929-4cc2-bd82-7b25f50c2577"
plan = "47e2bdcb-3c85-4d59-be12-869552bba440"
} |
12 of 14 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #238.
Adds Azure to this repo's Terraform and creates the Azure identities hackforla/incubator's Terraform CI will log in with, mirroring
incubator-tf-plan/incubator-tf-applyon AWS.backend.tf:azurerm,azureadandazapiproviders.azurermskips resource provider registration, which the Reader-only plan identity can't do.azure-ci-identities.tf(new), gated oniam_onlylikecloudtrail.tf: resource groupincubator-ci, identitiesincubator-tf-plan/incubator-tf-apply, flexible federated credentials viaazapi(apply trustsmainonly), subscription roles, and Graph app-role grants. Outputs both client IDs.ARM_*variables on the dflook steps, as this repo's hand-made identities (terraform/azure-ci-bootstrap.md). Noazure/login: it signs in the runner's CLI, which the dflook container can't see.Expected plan: 11 to add, 0 to change, 0 to destroy (all Azure; no AWS changes). A local read-only plan against production state matched. This PR's CI plan is also the first proof that the plan identity's OIDC login works from inside the dflook container.
Known gap, not addressed here: with
azurerm/azureadin place, a local run needs an Azure login even withiam_only = true.After merge: confirm the apply logged in and created the 11 resources, then set incubator's
AZURE_*repository variables from the outputs.