Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion RESOURCES.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ The overall status of each resource or data source is captured in this document
| `github_actions_environment_variable` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| `github_actions_hosted_runner` | ❓ | ❓ | ❓ | ❓ | ❓ | ❓ | ❓ |
| `github_actions_organization_oidc_subject_claim_customization_template` | ❓ | ❓ | ❓ | ❓ | ❓ | ❓ | ❓ |
| `github_actions_organization_permissions` | ❓ | ❓ | ❓ | ❓ | ❓ | ❓ | ❓ |
| `github_actions_organization_permissions` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| `github_actions_organization_secret` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| `github_actions_organization_secret_repositories` | ❓ | ❓ | ❓ | ❓ | ❓ | ❓ | ❓ |
| `github_actions_organization_secret_repository` | ❓ | ❓ | ❓ | ❓ | ❓ | ❓ | ❓ |
Expand Down
79 changes: 55 additions & 24 deletions docs/resources/actions_organization_permissions.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---
page_title: "github_actions_organization_permissions (Resource) - GitHub"
subcategory: ""
description: |-
Creates and manages Actions permissions within a GitHub organization
Resource to manage the GitHub Actions organization permissions.
---

# github_actions_organization_permissions (Resource)

This resource allows you to create and manage GitHub Actions permissions within your GitHub enterprise organizations. You must have admin access to an organization to use this resource.
Resource to manage the GitHub Actions organization permissions.

## Example Usage

Expand All @@ -15,48 +16,78 @@ resource "github_repository" "example" {
name = "my-repository"
}

resource "github_actions_organization_permissions" "test" {
allowed_actions = "selected"
resource "github_actions_organization_permissions" "example" {
enabled_repositories = "selected"

enabled_repositories_config {
repository_ids = [github_repository.example.repo_id]
}

allowed_actions = "selected"

allowed_actions_config {
github_owned_allowed = true
patterns_allowed = ["actions/cache@*", "actions/checkout@*"]
verified_allowed = true
}
enabled_repositories_config {
repository_ids = [github_repository.example.repo_id]
}

sha_pinning_required = true
}
```

## Argument Reference
<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `enabled_repositories` (String) Policy that controls the repositories in the organization that are allowed to run GitHub Actions; this can be one of `all`, `none`, or `selected`.

The following arguments are supported:
### Optional

- `allowed_actions` - (Optional) The permissions policy that controls the actions that are allowed to run. Can be one of: `all`, `local_only`, or `selected`.
- `enabled_repositories` - (Required) The policy that controls the repositories in the organization that are allowed to run GitHub Actions. Can be one of: `all`, `none`, or `selected`.
- `allowed_actions_config` - (Optional) Sets the actions that are allowed in an organization. Only available when `allowed_actions` = `selected`. See [Allowed Actions Config](#allowed-actions-config) below for details.
- `enabled_repositories_config` - (Optional) Sets the list of selected repositories that are enabled for GitHub Actions in an organization. Only available when `enabled_repositories` = `selected`. See [Enabled Repositories Config](#enabled-repositories-config) below for details.
- `sha_pinning_required` - (Optional) Whether pinning to a specific SHA is required for all actions and reusable workflows in the organization.
- `allowed_actions` (String) Policy that controls the actions that are allowed to run; this can be one of `all`, `local_only`, or `selected`.
- `allowed_actions_config` (Block List, Max: 1) Configure the actions that are allowed in an organization; this is only supported when `allowed_actions` is set to `selected`. (see [below for nested schema](#nestedblock--allowed_actions_config))
- `enabled_repositories_config` (Block List, Max: 1) Configure the repositories that are enabled for GitHub Actions in an organization; this is only supported when `enabled_repositories` is set to `selected`. (see [below for nested schema](#nestedblock--enabled_repositories_config))
- `sha_pinning_required` (Boolean) If all actions and reusable workflows in an organization require pinning to a specific SHA.

### Allowed Actions Config
### Read-Only

The `allowed_actions_config` block supports the following:
- `id` (String) The ID of this resource.

- `github_owned_allowed` - (Required) Whether GitHub-owned actions are allowed in the organization.
- `patterns_allowed` - (Optional) Specifies a list of string-matching patterns to allow specific action(s). Wildcards, tags, and SHAs are allowed. For example, monalisa/octocat@*, monalisa/octocat@v2, monalisa/*."
- `verified_allowed` - (Optional) Whether actions in GitHub Marketplace from verified creators are allowed. Set to true to allow all GitHub Marketplace actions by verified creators.
<a id="nestedblock--allowed_actions_config"></a>
### Nested Schema for `allowed_actions_config`

### Enabled Repositories Config
Required:

The `enabled_repositories_config` block supports the following:
- `github_owned_allowed` (Boolean) If GitHub-owned actions are allowed.

- `repository_ids` - (Required) List of repository IDs to enable for GitHub Actions.
Optional:

- `patterns_allowed` (Set of String) List of string-matching patterns to allow specific actions; wildcards, tags, and SHAs are allowed. For example, `monalisa/octocat@*`, `monalisa/octocat@v2`, `monalisa/*`.
- `verified_allowed` (Boolean) If actions in GitHub Marketplace from verified creators are allowed.


<a id="nestedblock--enabled_repositories_config"></a>
### Nested Schema for `enabled_repositories_config`

Required:

- `repository_ids` (Set of Number) List of repository IDs to enable for GitHub Actions.

## Import

This resource can be imported using the name of the GitHub organization:
Import is supported using the following syntax:

In Terraform v1.5.0 and later, the [`import` block](https://developer.hashicorp.com/terraform/language/import) can be used with the `id` attribute, for example:

```terraform
import {
to = github_actions_organization_permissions.example
id = "org-name"
}
```

The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example:

```shell
terraform import github_actions_organization_permissions.test github_organization_name
terraform import github_actions_organization_permissions.example org-name
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import {
to = github_actions_organization_permissions.example
id = "org-name"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import github_actions_organization_permissions.example org-name
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@ resource "github_repository" "example" {
name = "my-repository"
}

resource "github_actions_organization_permissions" "test" {
allowed_actions = "selected"
resource "github_actions_organization_permissions" "example" {
enabled_repositories = "selected"

enabled_repositories_config {
repository_ids = [github_repository.example.repo_id]
}

allowed_actions = "selected"

allowed_actions_config {
github_owned_allowed = true
patterns_allowed = ["actions/cache@*", "actions/checkout@*"]
verified_allowed = true
}
enabled_repositories_config {
repository_ids = [github_repository.example.repo_id]
}

sha_pinning_required = true
}
Loading
Loading