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.
Policy Operations
The API provides endpoints for the following operations:
- Getting policy groups associated with a stack
- Getting policy packs associated with a stack
Get Stack Policy Groups
Get Policy Groups associated with a stack.
GET /api/stacks/{organization}/{project}/{stack}/policygroups
Parameters
Parameter | Type | In | Description |
---|---|---|---|
organization | string | path | organization name |
project | string | path | project name |
stack | string | path | stack name |
Example
curl \
-H "Accept: application/vnd.pulumi+8" \
-H "Content-Type: application/json" \
-H "Authorization: token $PULUMI_ACCESS_TOKEN" \
https://api.pulumi.com/api/stacks/{organization}/{project}/{stack}/policygroups
Default response
Status: 200 OK
{
"policyGroups": [
{
"name": "continuous-policy",
"isOrgDefault": false,
"numStacks": 1,
"numEnabledPolicyPacks": 1
}
]
}
Get Stack Policy Packs
Get Policy Packs associated with a stack.
GET /api/stacks/{organization}/{project}/{stack}/policypacks
Parameters
Parameter | Type | In | Description |
---|---|---|---|
organization | string | path | organization name |
project | string | path | project name |
stack | string | path | stack name |
Example
curl \
-H "Accept: application/vnd.pulumi+8" \
-H "Content-Type: application/json" \
-H "Authorization: token $PULUMI_ACCESS_TOKEN" \
https://api.pulumi.com/api/stacks/{organization}/{project}/{stack}/policypacks
Default response
Status: 200 OK
{
"requiredPolicies": [
{
"name": "continuous-policy",
"version": 3,
"versionTag": "0.0.3",
"displayName": "",
"packLocation": "REDACTED",
"config": {
"all": {
"enforcementLevel": "mandatory"
},
"continuous-policy": {
"enforcementLevel": "mandatory",
"policies": [
{
"assertion": {
"operator": "eq",
"value": 0
},
"label": "No node12 Lambdas",
"mode": "ai",
"query": "nodejs version 12"
}
]
}
}
}
]
}
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.