Stack Policy
Stack Policy APIs allow you to retrieve information about policy groups and policy packs associated with a Pulumi stack. Policies define governance rules that are enforced during stack updates.
Get Stack Policy Groups
GET
/api/stacks/{orgName}/{projectName}/{stackName}/policygroupsReturns the list of policy groups that include the specified stack. Policy groups define which policy packs are enforced on a set of stacks. The response includes each group’s name, the stacks it applies to, and the policy packs configured within it.
Request Parameters
orgNamestring path requiredThe organization nameprojectNamestring path requiredThe project namestackNamestring path requiredThe stack name
Responses
200
OK
Schema: AppListPolicyGroupsResponse
- List of policy groups
- ↳
namestring requiredThe unique name of the policy group. - ↳
isOrgDefaultboolean requiredWhether this is the organization’s default policy group, applied to all stacks not in another group. - ↳
numStacksinteger requiredNumber of stacks assigned to this policy group. - ↳
numAccountsinteger optionalNumber of cloud accounts assigned to this policy group. - ↳
entityTypeenum requiredThe type of entity this policy group targets (e.g. stacks, accounts).Values:stacks,accounts - ↳
modeenum requiredThe enforcement mode of the policy group.Values:audit,preventative - ↳
numEnabledPolicyPacksinteger requiredNumber of policy packs currently enabled in this group.
Get Stack Policy Packs
GET
/api/stacks/{orgName}/{projectName}/{stackName}/policypacksReturns the policy packs currently enforced on the specified stack through its policy group memberships. The optional ‘mode’ query parameter filters results by enforcement mode: ‘audit’ (violations are logged but allowed) or ‘preventative’ (violations block the update). Returns 400 if the mode parameter is invalid.
Request Parameters
orgNamestring path requiredThe organization nameprojectNamestring path requiredThe project namestackNamestring path requiredThe stack namemodestring query optionalFilter by policy group enforcement mode (‘audit’ or ‘preventative’)
Responses
200
OK
Schema: AppGetStackPolicyPacksResponse
- RequiredPolicies is a list of required Policy Packs to run during the update.
- ↳
namestring requiredThe name (unique and URL-safe) of the required Policy Pack. - ↳
versioninteger requiredThe version of the required Policy Pack. - ↳
versionTagstring requiredThe version tag of the required Policy Pack. - ↳
displayNamestring requiredThe pretty name of the required Policy Pack. - ↳
packLocationstring optionalWhere the Policy Pack can be downloaded from. - ↳
configmap[string]object optionalThe configuration that is to be passed to the Policy Pack. This is map a of policies mapped to their configuration. Each individual configuration must comply with the JSON schema for each Policy within the Policy Pack. - ↳
environmentsarray[string] optionalReferences to ESC environments whose resolved values the CLI should inject into the policy pack process.
Errors:
400 Invalid mode parameter value
Thank you for your feedback!
If you have a question about how to use Pulumi, reach out in Community Slack.
Open an issue on GitHub to report a problem or suggest an improvement.