diff --git a/docs/resources/webhook.md b/docs/resources/webhook.md index 42fa51ce..fd123b48 100644 --- a/docs/resources/webhook.md +++ b/docs/resources/webhook.md @@ -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 @@ -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 +``` diff --git a/examples/resources/xray_webhook/import.sh b/examples/resources/xray_webhook/import.sh new file mode 100644 index 00000000..60e716c0 --- /dev/null +++ b/examples/resources/xray_webhook/import.sh @@ -0,0 +1 @@ +terraform import xray_webhook.my-webhook WebhookName \ No newline at end of file diff --git a/examples/resources/xray_webhook/resource.tf b/examples/resources/xray_webhook/resource.tf new file mode 100644 index 00000000..01f479f3 --- /dev/null +++ b/examples/resources/xray_webhook/resource.tf @@ -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" + } +} \ No newline at end of file diff --git a/pkg/xray/resource/resource_xray_webhook_test.go b/pkg/xray/resource/resource_xray_webhook_test.go index df4f0698..5ce46f2f 100644 --- a/pkg/xray/resource/resource_xray_webhook_test.go +++ b/pkg/xray/resource/resource_xray_webhook_test.go @@ -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 }}" @@ -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 }}" @@ -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",