|
1 | 1 | --- |
2 | 2 | page_title: "github_repository_webhook (Resource) - GitHub" |
| 3 | +subcategory: "" |
3 | 4 | description: |- |
4 | | - Creates and manages repository webhooks within GitHub organizations or personal accounts |
| 5 | + This resource allows you to create and manage webhooks for specific repositories. |
5 | 6 | --- |
6 | 7 |
|
7 | 8 | # github_repository_webhook (Resource) |
8 | 9 |
|
9 | | -This resource allows you to create and manage webhooks for repositories within your GitHub organization or personal account. |
| 10 | +This resource allows you to create and manage webhooks for specific repositories. |
10 | 11 |
|
11 | 12 | ~> **Note on Archived Repositories**: When a repository is archived, GitHub makes it read-only, preventing webhook modifications. If you attempt to destroy resources associated with archived repositories, the provider will gracefully handle the operation by logging an informational message and removing the resource from Terraform state without attempting to modify the archived repository. |
12 | 13 |
|
@@ -36,42 +37,57 @@ resource "github_repository_webhook" "example_webhook" { |
36 | 37 | } |
37 | 38 | ``` |
38 | 39 |
|
39 | | -## Argument Reference |
| 40 | +<!-- schema generated by tfplugindocs --> |
| 41 | +## Schema |
40 | 42 |
|
41 | | -The following arguments are supported: |
| 43 | +### Required |
42 | 44 |
|
43 | | -- `repository` - (Required) The repository of the webhook. |
| 45 | +- `events` (Set of String) A list of events which should trigger the webhook |
| 46 | +- `repository` (String) The repository name of the webhook, not including the organization, which will be inferred. |
44 | 47 |
|
45 | | -- `events` - (Required) A list of events which should trigger the webhook. See a list of [available events](https://developer.github.com/v3/activity/events/types/). |
| 48 | +### Optional |
46 | 49 |
|
47 | | -- `configuration` - (Required) Configuration block for the webhook. [Detailed below.](#configuration) |
| 50 | +- `active` (Boolean) Indicate if the webhook should receive events. Defaults to 'true'. |
| 51 | +- `configuration` (Block List, Max: 1) Configuration for the webhook. (see [below for nested schema](#nestedblock--configuration)) |
| 52 | +- `etag` (String) |
48 | 53 |
|
49 | | -- `active` - (Optional) Indicate if the webhook should receive events. Defaults to `true`. |
| 54 | +### Read-Only |
50 | 55 |
|
51 | | -### configuration |
| 56 | +- `id` (String) The ID of this resource. |
| 57 | +- `url` (String) Configuration block for the webhook |
52 | 58 |
|
53 | | -- `url` - (Required) The URL of the webhook. |
| 59 | +<a id="nestedblock--configuration"></a> |
| 60 | +### Nested Schema for `configuration` |
54 | 61 |
|
55 | | -- `content_type` - (Required) The content type for the payload. Valid values are either `form` or `json`. |
| 62 | +Required: |
56 | 63 |
|
57 | | -- `secret` - (Optional) The shared secret for the webhook. [See API documentation](https://developer.github.com/v3/repos/hooks/#create-a-hook). |
| 64 | +- `url` (String, Sensitive) The URL of the webhook. |
58 | 65 |
|
59 | | -- `insecure_ssl` - (Optional) Insecure SSL boolean toggle. Defaults to `false`. |
| 66 | +Optional: |
60 | 67 |
|
61 | | -## Attributes Reference |
| 68 | +- `content_type` (String) The content type for the payload. Valid values are either 'form' or 'json'. |
| 69 | +- `insecure_ssl` (Boolean) Insecure SSL boolean toggle. Defaults to 'false'. |
| 70 | +- `secret` (String, Sensitive) The shared secret for the webhook |
62 | 71 |
|
63 | | -The following additional attributes are exported: |
| 72 | +## Import |
64 | 73 |
|
65 | | -- `url` - URL of the webhook. This is a sensitive attribute because it may include basic auth credentials. |
| 74 | +Import is supported using the following syntax: |
66 | 75 |
|
67 | | -## Import |
| 76 | +Repository webhooks can be imported using the `name` of the repository, combined with the `id` of the webhook, separated by a `/` character. The `id` of the webhook can be found in the URL of the webhook. For example: `"https://github.com/example-org/example-repo/settings/hooks/123456789"`, where `123456789` is the `id` of the webhook. |
| 77 | + |
| 78 | +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: |
68 | 79 |
|
69 | | -Repository webhooks can be imported using the `name` of the repository, combined with the `id` of the webhook, separated by a `/` character. The `id` of the webhook can be found in the URL of the webhook. For example: `"https://github.com/example-org/example-repo/settings/hooks/14711452"`, where 14711452 is the `id` of the webhook. |
| 80 | +```terraform |
| 81 | +import { |
| 82 | + to = github_repository_webhook.example_webhook |
| 83 | + id = "example-repo/123456789" |
| 84 | +} |
| 85 | +``` |
70 | 86 |
|
71 | | -Importing uses the `name` of the repository, as well as the `id` of the webhook, e.g. |
| 87 | +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: |
72 | 88 |
|
73 | 89 | ```shell |
74 | | -terraform import github_repository_webhook.example_webhook example-repo/14711452 |
| 90 | +terraform import github_repository_webhook.example_webhook example-repo/123456789 |
75 | 91 | ``` |
76 | 92 |
|
77 | 93 | If secret is populated in the webhook's configuration, the value will be imported as "********". |
0 commit comments