test(azure): hub e2e coverage for service-principal and entra-id-groups - #264
test(azure): hub e2e coverage for service-principal and entra-id-groups#264JohannesRudolph wants to merge 1 commit into
Conversation
Adds e2e/ test roots for both modules following the established Azure pattern
(modules/azure/{storage-account,resource-group}/e2e): a single test_context
grab-bag, the module sourced via a relative path, and a meshstack_building_block
that depends_on the whole integration module so the delete run finishes before
the backplane's federated identity credentials are torn down.
azure/service-principal is WORKSPACE_LEVEL, so the building block targets the
meshWorkspace; azure/entra-id-groups is TENANT_LEVEL and targets the Azure
meshTenant. Both derive a per-run backplane name from name_suffix so custom role
definitions, app registrations and UAMI names don't clash across retried runs.
Also fixes four wiring bugs that blocked both integrations from even reaching
`tofu validate`:
- azure/service-principal: the azure_subscription_id BBD input used
PLATFORM_TENANT_ID on a WORKSPACE_LEVEL definition, where no platform tenant
exists. Switched to STATIC backed by a new azure_subscription_id variable,
matching azure/storage-account and azure/budget-alert.
- azure/entra-id-groups: the integration passed `scope` to a backplane module
that declares no such variable. The backplane creates no azurerm role
assignments, so the now-unused azure_scope variable is dropped.
- azure/entra-id-groups: PLATFORM_TENANT_WORKSPACE_IDENTIFIER /
PLATFORM_TENANT_PROJECT_IDENTIFIER are not valid assignment types; the
provider accepts WORKSPACE_IDENTIFIER / PROJECT_IDENTIFIER.
- azure/entra-id-groups: a TENANT_LEVEL definition requires
spec.supported_platforms.
The backplane README's required-permissions table referenced the removed
var.scope and implied a separate portal consent step; it now names the actual
Microsoft Graph app roles and Entra directory role needed to grant them.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Scorecard Check
📊 meshstack-hub Module Scorecard
📋 Per-Module Category SummaryScore per category per building block.
Core Structure — ✅ all passingBasic module file structure and documentation — applies to 2 modules
Core Structure — Summary
Integration — ✅ all passingmeshstack_integration.tf conventions — applies to 2 modules
Integration — Summary
Azure Backplane — some checks failingAzure UAMI-based automation principal conventions — applies to 2 modules
Azure Backplane — Summary
STACKIT Backplane — not applicableSTACKIT WIF-based automation principal conventions — applies to 0 modules No applicable modules. Testing — ✅ all passingEnd-to-end test coverage — applies to 2 modules
Testing — Summary
📈 Overall SummaryOverall Average Score: 87%Score Distribution
|
CI results — blocked on the expected Entra permission, and nothing elseBoth modules were dispatched against this branch in the internal e2e runner. Both fail at the same point, with the same error, before any resource is created:
No The corresponding Entra directory grant is tracked separately and needs an Entra admin to apply. Until then this PR cannot go green, which is expected and is the only thing outstanding. |
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
Adds
e2e/test roots forazure/service-principalandazure/entra-id-groups, and fixes the wiring bugs that surfaced while getting both integrations totofu validate.E2E tests
Both follow the established Azure pattern (
modules/azure/{storage-account,resource-group,budget-alert}/e2e): a singletest_contextgrab-bag, the module under test sourced via a relative../path, aprovider.tfpinning subscription and tenant, and ameshstack_building_blockwithdepends_on = [module.<integration>]so the delete run completes before the backplane's federated identity credentials are destroyed.azure/service-principalazure/entra-id-groupsWORKSPACE_LEVELTENANT_LEVELtarget_refmeshWorkspace/test_context.workspacemeshTenant/fixtures.azure.mesh_tenant_idhub-e2e-sp-<suffix>hub-e2e-eig-<suffix[0:12]>(UAMI names cap at 24 chars)application_id,service_principal_object_id,tenant_id,subscription_id,role_name == "Contributor",secret_expiration_date.admin/.user/.readerdisplay-name suffixes, the per-run prefixNeither test uses the
bbd_version_ref/countdual-mode gating from the e2e skill's checklist: both backplanes declare their ownproviderblocks, and OpenTofu refusescounton a module whose tree contains provider configurations. This matches what the three existing Azure e2e tests already do for the same reason.entra-id-groupsdeliberately passes an emptyadministrative_unit_id— the fixtures tenant has no Administrative Unit, and creating one per run would leave directory-level litter behind on a failed teardown. The AU membership path is therefore not covered.Bug fixes
Four pre-existing defects, all of which blocked
tofu validateon the integration roots:service-principal— theazure_subscription_idBBD input usedassignment_type = "PLATFORM_TENANT_ID"on aWORKSPACE_LEVELdefinition, where there is no platform tenant to resolve it from. Switched toSTATICbacked by a newazure_subscription_idvariable, matchingazure/storage-accountandazure/budget-alert.entra-id-groups— the integration passedscope = var.azure_scopeto a backplane module that declares noscopevariable. That backplane creates noazurermrole assignments (the UAMI only ever needs Microsoft Graph permissions), so the unusedazure_scopevariable is dropped rather than plumbed through.entra-id-groups—PLATFORM_TENANT_WORKSPACE_IDENTIFIER/PLATFORM_TENANT_PROJECT_IDENTIFIERare not valid assignment types. The provider acceptsWORKSPACE_IDENTIFIER/PROJECT_IDENTIFIER, which is whatske/ske-starterkitandstackit/git-repositoryuse for the same purpose.entra-id-groups— aTENANT_LEVELdefinition requiresspec.supported_platforms; added[{ name = "AZURE" }].backplane/README.mdforentra-id-groupsreferenced the removedvar.scopeand described admin consent as a separate portal step. It now names the actual Microsoft Graph app roles required and notes that Application Administrator / Cloud Application Administrator cannot consent to Microsoft Graph application permissions.Verification
tofu validatepasses for bothe2e/roots, bothbackplane/tiers and theentra-id-groupsbuildingblock/.tofu fmt -recursiveclean; no trailing whitespace.azure/entra-id-groupsis 100% overall;azure/service-principalsits at 74% because its backplane predates the UAMI convention (app registration +create_service_principal_nametoggle) — pre-existing and out of scope here.CI is expected to fail on the Microsoft Graph app-role assignments in both backplanes until the smoke-test CI identity is granted the corresponding directory permissions. That grant is being handled separately; run links and the exact error are in the review thread.
🤖 Generated with Claude Code