Skip to content

Commit

Permalink
feat: add webhook provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Sauerer committed Sep 24, 2024
1 parent 241cd23 commit c14abfd
Show file tree
Hide file tree
Showing 119 changed files with 6,485 additions and 7,232 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/speakeasy_sdk_generation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
with:
speakeasy_version: latest
openapi_docs: |
- https://docs.api.epilot.io/file.yaml
- https://docs.api.epilot.io/webhooks.yaml
overlay_docs: |
- ./overlay.yaml
languages: |
Expand Down
455 changes: 363 additions & 92 deletions .speakeasy/gen.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
all: speakeasy docs

original.yaml:
# curl https://docs.api.epilot.io/file.yaml > original.yaml
cp openapi.yml original.yaml
curl https://docs.api.epilot.io/webhooks.yaml > original.yaml


original_modified.yaml: original.yaml overlay.yaml
speakeasy overlay apply -s original.yaml -o overlay.yaml > original_modified.yaml
Expand All @@ -13,7 +13,7 @@ overlay.yaml:

speakeasy:
$(eval TMP := $(shell mktemp -d))
# curl https://docs.api.epilot.io/file.yaml > $(TMP)/openapi.yaml
# curl https://docs.api.epilot.io/webhooks.yaml > $(TMP)/openapi.yaml
cp openapi.yml $(TMP)/openapi.yaml
speakeasy overlay apply -s $(TMP)/openapi.yaml -o overlay.yaml > $(TMP)/final.yaml
speakeasy generate sdk --lang terraform -o . -s $(TMP)/final.yaml
Expand Down
66 changes: 53 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ TF_REATTACH_PROVIDERS=... terraform apply

<!-- End SDK <no value> -->

<!-- Start SDK Installation [installation] -->
## SDK Installation
<!-- Start Installation [installation] -->
## Installation

To install this provider, copy and paste this code into your Terraform configuration. Then, run `terraform init`.

Expand All @@ -59,7 +59,7 @@ terraform {
required_providers {
epilot-webhook = {
source = "epilot-dev/epilot-webhook"
version = "0.4.0"
version = "0.5.1"
}
}
}
Expand All @@ -68,19 +68,17 @@ provider "epilot-webhook" {
# Configuration options
}
```
<!-- End SDK Installation [installation] -->
<!-- End Installation [installation] -->

<!-- Start SDK Example Usage [usage] -->
## SDK Example Usage
<!-- Start Testing the provider locally [usage] -->
## Testing the provider locally

### Testing the provider locally
#### Local Provider

Should you want to validate a change locally, the `--debug` flag allows you to execute the provider against a terraform instance locally.

This also allows for debuggers (e.g. delve) to be attached to the provider.

### Example

```sh
go run main.go --debug
# Copy the TF_REATTACH_PROVIDERS env var
Expand All @@ -89,13 +87,55 @@ cd examples/your-example
TF_REATTACH_PROVIDERS=... terraform init
TF_REATTACH_PROVIDERS=... terraform apply
```
<!-- End SDK Example Usage [usage] -->

<!-- Start Available Resources and Operations [operations] -->
## Available Resources and Operations
#### Compiled Provider

Terraform allows you to use local provider builds by setting a `dev_overrides` block in a configuration file called `.terraformrc`. This block overrides all other configured installation methods.

1. Execute `go build` to construct a binary called `terraform-provider-epilot-webhook`
2. Ensure that the `.terraformrc` file is configured with a `dev_overrides` section such that your local copy of terraform can see the provider binary

Terraform searches for the `.terraformrc` file in your home directory and applies any configuration settings you set.

```
provider_installation {
dev_overrides {
"registry.terraform.io/epilot-dev/epilot-webhook" = "<PATH>"
}
# For all other providers, install them directly from their origin provider
# registries as normal. If you omit this, Terraform will _only_ use
# the dev_overrides block, and so no other providers will be available.
direct {}
}
```
<!-- End Testing the provider locally [usage] -->

<!-- Start Available Resources and Data Sources [operations] -->
## Available Resources and Data Sources

### Resources

* [epilot-webhook_webhook](docs/resources/webhook.md)
### Data Sources

* [epilot-webhook_webhook](docs/data-sources/webhook.md)
<!-- End Available Resources and Data Sources [operations] -->

<!-- Start Summary [summary] -->
## Summary

Webhooks: Service for configuring webhooks on different events
<!-- End Summary [summary] -->

<!-- Start Table of Contents [toc] -->
## Table of Contents

<!-- End Available Resources and Operations [operations] -->
* [Installation](#installation)
* [Available Resources and Data Sources](#available-resources-and-data-sources)
* [Testing the provider locally](#testing-the-provider-locally)
<!-- End Table of Contents [toc] -->

<!-- Placeholder for Future Speakeasy SDK Sections -->

Expand Down
4 changes: 0 additions & 4 deletions examples/data-sources/epilot-file_file/data-source.tf

This file was deleted.

2 changes: 2 additions & 0 deletions examples/data-sources/epilot-webhook_webhook/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
data "epilot-webhook_webhook" "my_webhook" {
}
4 changes: 2 additions & 2 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ terraform {
required_providers {
epilot-webhook = {
source = "epilot-dev/epilot-webhook"
version = "0.4.0"
version = "0.5.1"
}
}
}

provider "epilot-webhook" {
# Configuration options
}
}
26 changes: 0 additions & 26 deletions examples/resources/epilot-file_file-import/generated_resources.tf

This file was deleted.

20 changes: 0 additions & 20 deletions examples/resources/epilot-file_file-import/provider.tf

This file was deleted.

17 changes: 0 additions & 17 deletions examples/resources/epilot-file_file-import/resource.tf

This file was deleted.

1 change: 0 additions & 1 deletion examples/resources/epilot-file_file/import.sh

This file was deleted.

11 changes: 0 additions & 11 deletions examples/resources/epilot-file_file/resource.tf

This file was deleted.

1 change: 1 addition & 0 deletions examples/resources/epilot-webhook_webhook/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import epilot-webhook_webhook.my_epilot-webhook_webhook ""
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
epilot-webhook = {
source = "epilot-dev/epilot-webhook"
version = "2.1.1"
version = "0.5.0"
}
}
}
Expand All @@ -12,9 +12,7 @@ variable "epilot_auth" {
description = "epilot_auth"
}


provider "epilot-webhook" {
# Configuration options
epilot_auth = var.epilot_auth
server_url = "https://file.dev.sls.epilot.io"
}
}
4 changes: 4 additions & 0 deletions examples/resources/epilot-webhook_webhook/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource "epilot-webhook_webhook" "my_webhook" {
event_name = "automation_flow_target"
name = "Generated by Terraform"
}
2 changes: 1 addition & 1 deletion gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ go:
outputModelSuffix: output
packageName: openapi
terraform:
version: 0.4.0
version: 0.5.1
additionalDataSources: []
additionalDependencies: {}
additionalResources: []
Expand Down
Loading

0 comments on commit c14abfd

Please sign in to comment.