|
| 1 | +--- |
| 2 | +layout: "github" |
| 3 | +page_title: "GitHub: github_actions_organization_workflow_permissions" |
| 4 | +description: |- |
| 5 | + Manages GitHub Actions workflow permissions for a GitHub Organization. |
| 6 | +--- |
| 7 | + |
| 8 | +# github_actions_organization_workflow_permissions |
| 9 | + |
| 10 | +This resource allows you to manage GitHub Actions workflow permissions for a GitHub Organization account. This controls the default permissions granted to the GITHUB_TOKEN when running workflows and whether GitHub Actions can approve pull request reviews. |
| 11 | + |
| 12 | +You must have organization admin access to use this resource. |
| 13 | + |
| 14 | +## Example Usage |
| 15 | + |
| 16 | +```hcl |
| 17 | +# Basic workflow permissions configuration |
| 18 | +resource "github_actions_organization_workflow_permissions" "example" { |
| 19 | + organization_slug = "my-organization" |
| 20 | +
|
| 21 | + default_workflow_permissions = "read" |
| 22 | + can_approve_pull_request_reviews = false |
| 23 | +} |
| 24 | +
|
| 25 | +# Allow write permissions and PR approvals |
| 26 | +resource "github_actions_organization_workflow_permissions" "permissive" { |
| 27 | + organization_slug = "my-organization" |
| 28 | +
|
| 29 | + default_workflow_permissions = "write" |
| 30 | + can_approve_pull_request_reviews = true |
| 31 | +} |
| 32 | +``` |
| 33 | + |
| 34 | +## Argument Reference |
| 35 | + |
| 36 | +The following arguments are supported: |
| 37 | + |
| 38 | +* `organization_slug` - (Required) The slug of the organization. |
| 39 | + |
| 40 | +* `default_workflow_permissions` - (Optional) The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be `read` or `write`. Defaults to `read`. |
| 41 | + |
| 42 | +* `can_approve_pull_request_reviews` - (Optional) Whether GitHub Actions can approve pull request reviews. Defaults to `false`. |
| 43 | + |
| 44 | +## Attributes Reference |
| 45 | + |
| 46 | +In addition to all arguments above, the following attributes are exported: |
| 47 | + |
| 48 | +* `id` - The organization slug. |
| 49 | + |
| 50 | +## Import |
| 51 | + |
| 52 | +Organization Actions workflow permissions can be imported using the organization slug: |
| 53 | + |
| 54 | +```sh |
| 55 | +terraform import github_actions_organization_workflow_permissions.example my-organization |
| 56 | +``` |
| 57 | + |
| 58 | +## Notes |
| 59 | + |
| 60 | +~> **Note:** This resource requires a GitHub Organization account and organization admin permissions. |
| 61 | + |
| 62 | +When this resource is destroyed, the workflow permissions will be reset to safe defaults: |
| 63 | + |
| 64 | +* `default_workflow_permissions` = `read` |
| 65 | +* `can_approve_pull_request_reviews` = `false` |
0 commit comments