Skip to content

Commit

Permalink
Merge pull request #172 from jfrog/add-missing-webhook-import-doc
Browse files Browse the repository at this point in the history
Add resource and import example for webhook documentation
  • Loading branch information
alexhung authored Apr 2, 2024
2 parents 8ae95aa + 97fb3c6 commit 428bd07
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 4 deletions.
26 changes: 25 additions & 1 deletion docs/resources/webhook.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,23 @@ description: |-

Provides an Xray webhoook resource. See [Xray Webhooks](https://jfrog.com/help/r/jfrog-security-documentation/configuring-xray?section=UUID-bb7641b3-e469-e0ef-221d-c0ebf660dde1_id_ConfiguringXray-ConfiguringWebhooks) and [REST API](https://jfrog.com/help/r/jfrog-rest-apis/xray-webhooks) for more details.


## Example Usage

```terraform
resource "xray_webhook" "my-webhook" {
name = "MyWebhook"
description = "My webhook description"
url = "https://tempurl.org"
use_proxy = false
user_name = "my_user_1"
password = "my_user_password"
headers = {
header1_name = "header1_value"
header2_name = "header2_value"
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand All @@ -31,3 +47,11 @@ Provides an Xray webhoook resource. See [Xray Webhooks](https://jfrog.com/help/r
### Read-Only

- `id` (String) The ID of this resource.

## Import

Import is supported using the following syntax:

```shell
terraform import xray_webhook.my-webhook WebhookName
```
1 change: 1 addition & 0 deletions examples/resources/xray_webhook/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import xray_webhook.my-webhook WebhookName
13 changes: 13 additions & 0 deletions examples/resources/xray_webhook/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
resource "xray_webhook" "my-webhook" {
name = "MyWebhook"
description = "My webhook description"
url = "https://tempurl.org"
use_proxy = false
user_name = "my_user_1"
password = "my_user_password"

headers = {
header1_name = "header1_value"
header2_name = "header2_value"
}
}
6 changes: 3 additions & 3 deletions pkg/xray/resource/resource_xray_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestAccWebhook_UpgradeFromSDKv2(t *testing.T) {
name = "{{ .name }}"
description = "{{ .description }}"
url = "{{ .url }}"
use_proxy = "{{ .use_proxy }}"
use_proxy = {{ .use_proxy }}
user_name = "{{ .user_name }}"
password = "{{ .password }}"
Expand Down Expand Up @@ -96,7 +96,7 @@ func TestAccWebhook_full(t *testing.T) {
name = "{{ .name }}"
description = "{{ .description }}"
url = "{{ .url }}"
use_proxy = "{{ .use_proxy }}"
use_proxy = {{ .use_proxy }}
user_name = "{{ .user_name }}"
password = "{{ .password }}"
Expand All @@ -108,7 +108,7 @@ func TestAccWebhook_full(t *testing.T) {
`
testData := map[string]string{
"name": resourceName,
"description": "test description ",
"description": "test description",
"url": url,
"use_proxy": "true",
"user_name": "test_user_1",
Expand Down

0 comments on commit 428bd07

Please sign in to comment.