|
| 1 | +--- |
| 2 | +layout: "github" |
| 3 | +page_title: "GitHub: github_repository_custom_properties" |
| 4 | +description: |- |
| 5 | + Manages multiple custom property values for a GitHub repository |
| 6 | +--- |
| 7 | + |
| 8 | +# github_repository_custom_properties |
| 9 | + |
| 10 | +This resource allows you to manage multiple custom property values for a GitHub repository in a single resource block. Property values are updated in-place when changed, without recreating the resource. |
| 11 | + |
| 12 | +~> **Note:** This resource manages **values** for custom properties that have already been defined at the organization level (e.g. using [`github_organization_custom_properties`](organization_custom_properties.html)). It cannot create new property definitions. |
| 13 | + |
| 14 | +~> **Note:** This resource requires the provider to be configured with an organization owner. Individual user accounts are not supported. |
| 15 | + |
| 16 | +## Example Usage |
| 17 | + |
| 18 | +```hcl |
| 19 | +resource "github_repository" "example" { |
| 20 | + name = "example" |
| 21 | +} |
| 22 | +
|
| 23 | +resource "github_repository_custom_properties" "example" { |
| 24 | + repository_name = github_repository.example.name |
| 25 | +
|
| 26 | + property { |
| 27 | + name = "environment" |
| 28 | + value = ["production"] |
| 29 | + } |
| 30 | +
|
| 31 | + property { |
| 32 | + name = "team" |
| 33 | + value = ["platform"] |
| 34 | + } |
| 35 | +} |
| 36 | +``` |
| 37 | + |
| 38 | +## Example Usage - Multi-Select Property |
| 39 | + |
| 40 | +```hcl |
| 41 | +resource "github_repository_custom_properties" "example" { |
| 42 | + repository_name = "my-repo" |
| 43 | +
|
| 44 | + property { |
| 45 | + name = "languages" |
| 46 | + value = ["go", "typescript", "python"] |
| 47 | + } |
| 48 | +
|
| 49 | + property { |
| 50 | + name = "environment" |
| 51 | + value = ["staging"] |
| 52 | + } |
| 53 | +} |
| 54 | +``` |
| 55 | + |
| 56 | +## Argument Reference |
| 57 | + |
| 58 | +The following arguments are supported: |
| 59 | + |
| 60 | +* `repository_name` - (Required) The name of the repository. Changing this will force the resource to be recreated. |
| 61 | + |
| 62 | +* `property` - (Required) One or more property blocks as defined below. At least one must be specified. |
| 63 | + |
| 64 | +### property |
| 65 | + |
| 66 | +* `name` - (Required) The name of the custom property. Must correspond to a property already defined at the organization level. |
| 67 | + |
| 68 | +* `value` - (Required) The value(s) for the custom property. This is always specified as a set of strings, even for non-multi-select properties. For `string`, `single_select`, `true_false`, and `url` property types, provide a single value. For `multi_select` properties, multiple values can be provided. |
| 69 | + |
| 70 | +## Attributes Reference |
| 71 | + |
| 72 | +In addition to all arguments above, the following attributes are exported: |
| 73 | + |
| 74 | +* `id` - A composite ID in the format `owner:repository_name`. |
| 75 | + |
| 76 | +## Import |
| 77 | + |
| 78 | +Repository custom properties can be imported using the `owner/repository_name` format. When imported, **all** custom property values currently set on the repository will be imported into state. |
| 79 | + |
| 80 | +``` |
| 81 | +terraform import github_repository_custom_properties.example my-org/my-repo |
| 82 | +``` |
| 83 | + |
| 84 | +## Differences from `github_repository_custom_property` |
| 85 | + |
| 86 | +This resource (`github_repository_custom_properties`, plural) manages **all** custom property values for a repository in a single resource block, with in-place updates when values change. This is useful when you want to manage multiple properties together as a unit. |
| 87 | + |
| 88 | +The singular [`github_repository_custom_property`](repository_custom_property.html) resource manages a **single** property value per resource instance. Use it when you need independent lifecycle management for each property. |
0 commit comments