You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2276bce
Browse filesBrowse the repository at this point in the historyBrowse files
fix(iac/azure): move reservation role definition to bootstrap; runtime keeps only the assignment (closes#1092) (#1095)
The runtime container-apps module instantiated the cudly-reservation-role
module, which creates an azurerm_role_definition. Creating a role definition
needs Microsoft.Authorization/roleDefinitions/write, a bootstrap-class
permission the CI deploy service principal intentionally lacks (it has only
roleDefinitions/read plus roleAssignments/{read,write,delete}). Every Azure
deploy therefore 403'd at the role-definition write, exactly as the
bootstrap-vs-runtime IAM split intends.
Fix, honoring the split (no roleDefinitions/write granted to the deploy SP):
- Bootstrap: create the host-side reservation role definition in the
human-applied ci-cd-permissions module (new reservation_role.tf) and output
its resource ID and display name.
- Runtime: stop creating the definition in container-apps; resolve it via
data.azurerm_role_definition by name + subscription scope and keep only the
azurerm_role_assignment. A missing definition fails loud ("not found"),
signalling the operator to re-run the bootstrap rather than widening the SP.
- Shared module: factor the role display name into a local (single source of
truth) and expose it via a role_definition_name output so the runtime lookup
stays in lockstep.
- Drop the tenant-root "/providers/Microsoft.Capacity" assignable scope (a
subscription-scoped principal cannot register a scope above its subscription,
a latent 403). It is now gated behind include_capacity_provider_scope
(default false); the role is only ever assigned at subscription scope.
REQUIRED MANUAL STEP: a privileged human must re-apply the ci-cd-permissions
bootstrap once to create the role definition before the next runtime deploy.
Verified offline: terraform fmt -check, terraform validate, and tflint are
clean on the shared module, the bootstrap env, and the container-apps module
(apply not run; staging-first).
description="Full ARM resource ID of the host-side custom reservation-purchaser role definition created by this bootstrap. The runtime container-apps deploy looks the role up by name and assigns it."
description="Display name of the host-side custom reservation-purchaser role definition. The runtime container-apps module resolves the role by this exact name via data.azurerm_role_definition."
description="Custom role granting CUDly exactly the Microsoft.Capacity and Microsoft.BillingBenefits actions required by the calculatePrice -> purchase flow. Replaces the built-in Reservation Purchaser, which lacks reservationOrders/purchase/action."
description="Display name of the custom role definition. Runtime modules that look the role up via data.azurerm_role_definition must match this exact name."
Copy file name to clipboardExpand all lines: terraform/modules/iam/azure/cudly-reservation-role/variables.tf
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -7,3 +7,9 @@ variable "name_suffix" {
7
7
description="Suffix appended to the role display name to keep customer and host role definitions distinct within the same Azure AD tenant (e.g. the subscription ID)."
8
8
type=string
9
9
}
10
+
11
+
variable"include_capacity_provider_scope" {
12
+
description="When true, adds the tenant-root \"/providers/Microsoft.Capacity\" scope to assignable_scopes. Leave false (the default) for subscription-scoped principals: registering an assignable scope above the subscription requires tenant-root authority and otherwise 403s."
0 commit comments