test: seed Terraform provider read permission - #329
Merged
Mani Bindra (maniSbindra) merged 1 commit intoAug 28, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR stabilizes the Terraform E2E permission-count assertions by always seeding Microsoft.Resources/subscriptions/providers/read (used by AzureRM 3.x/4.x during provider-cache initialization) into the Terraform E2E bootstrap permissions, ensuring test results don’t depend on residual RBAC state.
Changes:
- Introduces a shared Terraform E2E bootstrap-permissions helper that includes deployments
{read,write}plussubscriptions/providers/read, and returns independent slices to avoid shared-mutation bugs. - Updates Terraform E2E tests to use the helper and adjusts affected expected permission counts (+1).
- Adds focused unit coverage for helper contents and slice independence, and wires that test into the
testunitTaskfile target.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Taskfile.yml | Updates unit-test task to also run the new Terraform bootstrap-permissions unit test. |
| e2eTests/e2eTerraformWithImportAndTargeting_test.go | Switches to shared bootstrap permissions and updates expected permission counts. |
| e2eTests/e2eTerraformPermissions_test.go | Adds bootstrap-permissions helper + unit test validating contents and slice independence. |
| e2eTests/e2eTerraformInvalid_test.go | Switches Terraform invalid-path E2Es to shared bootstrap permissions. |
| e2eTests/e2eTerraformAuthPermissionMismatch_test.go | Switches to shared bootstrap permissions and updates expected permission count. |
| e2eTests/e2eTerraformAuthorizationRequestDenied_test.go | Switches to shared bootstrap permissions for the Authorization_RequestDenied E2E. |
| e2eTests/e2eTerraform_test.go | Switches Terraform E2Es to shared bootstrap permissions and updates expectations/comments for the seeded permission. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Mani Bindra (maniSbindra)
deleted the
fix/terraform-e2e-provider-read-permission
branch
August 28, 2026 12:36
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.
Summary
Seed
Microsoft.Resources/subscriptions/providers/readas a bootstrap permission across the Terraform E2E suite and include it consistently in expected E2E results.This makes Terraform permission-count assertions independent of whether AzureRM's resource-provider cache request is temporarily authorized by residual RBAC state.
Background
AzureRM 3.x and 4.x can initialize their resource-provider cache by calling:
This maps to:
The call predates #328 and was observed in failures both before and after service-principal rotation. Post-merge runs also showed the permission affecting both the primary and alternate Terraform identities, so workflow spacing and identity rotation do not make the current exact permission counts deterministic.
Changes
Microsoft.Resources/deployments/readMicrosoft.Resources/deployments/writeMicrosoft.Resources/subscriptions/providers/readTestTerraformACIWithInitialPermissionswith all nine permissions supplied initially.Scope
This change is intentionally limited to Terraform E2E setup and assertions. It does not change:
cmd/terraformCmd.goor production MPF output;Production Terraform runs continue to discover this permission dynamically when the selected AzureRM version and configuration require it. This avoids unconditionally reporting the permission for AzureRM configurations, such as newer 5.x defaults, that may not perform the provider-cache listing.
Validation
Related issue
References #231.