From bb03e77a24852550d4791d8e1f900da19e1ebab7 Mon Sep 17 00:00:00 2001 From: Nishu Goel Date: Fri, 7 Jun 2024 00:12:32 +0200 Subject: [PATCH 1/2] Upgrade goreleaser version: 2 --- .goreleaser.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index c2c6bb3..280ae29 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,5 +1,6 @@ # Visit https://goreleaser.com for documentation on how to customize this # behavior. +version: 2 before: hooks: # this is just an example and not a requirement for provider building/publishing @@ -56,5 +57,3 @@ release: name_template: "{{ .ProjectName }}_{{ .Version }}_manifest.json" # If you want to manually examine the release before its live, uncomment this line: # draft: true -changelog: - skip: true From 15bcf153f6aa3e2d3d5141223671aff556946e4f Mon Sep 17 00:00:00 2001 From: Nishu Goel Date: Tue, 11 Jun 2024 15:26:14 +0200 Subject: [PATCH 2/2] Fix Wf provider --- .speakeasy/gen.lock | 10 +- README.md | 83 ++++++++++++++++ examples/provider/provider.tf | 2 +- .../resource.tf | 98 ++++--------------- gen.yaml | 2 +- .../workflowdefinition_data_source.go | 4 +- .../provider/workflowdefinition_resource.go | 13 +-- internal/sdk/sdk.go | 4 +- 8 files changed, 121 insertions(+), 95 deletions(-) create mode 100644 README.md diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 7878e84..da5aa15 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -3,10 +3,10 @@ id: 5a857039-7f4b-42d5-86fd-449767242ed2 management: docChecksum: 49e71e8528a2034de903094a70555fe5 docVersion: 1.0.0 - speakeasyVersion: 1.300.0 - generationVersion: 2.338.14 - releaseVersion: 0.8.1 - configChecksum: e7e9cc490827bbf6dac7a17daa218da8 + speakeasyVersion: 1.303.4 + generationVersion: 2.340.2 + releaseVersion: 0.8.2 + configChecksum: 7ce13d26abba12900e05100bdca957a2 repoURL: https://github.com/epilot-dev/terraform-provider-epilot-workflow.git repoSubDirectory: . published: true @@ -21,7 +21,7 @@ features: unions: 2.85.0 terraform: additionalDependencies: 0.1.0 - core: 3.21.2 + core: 3.21.3 deprecations: 2.81.1 globalSecurity: 2.81.6 globalServerURLs: 2.82.1 diff --git a/README.md b/README.md new file mode 100644 index 0000000..1049a92 --- /dev/null +++ b/README.md @@ -0,0 +1,83 @@ +# epilot-workflow + +
+ + + +
+ + + +To install this provider, copy and paste this code into your Terraform configuration. Then, run `terraform init`. + +```hcl +terraform { + required_providers { + epilot-workflow = { + source = "epilot-dev/epilot-workflow" + version = "0.8.2" + } + } +} + +provider "epilot-workflow" { + # Configuration options +} +``` + + + + +### Testing the provider locally + +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 +# In a new terminal +cd examples/your-example +TF_REATTACH_PROVIDERS=... terraform init +TF_REATTACH_PROVIDERS=... terraform apply +``` + + + + + + + + + +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. + +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-workflow" = "" + } + + # 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 {} +} +``` + +Your `` may vary depending on how your Go environment variables are configured. Execute `go env GOBIN` to set it, then set the `` to the value returned. If nothing is returned, set it to the default location, `$HOME/go/bin`. + +Note: To use the dev_overrides, please ensure you run `go build` in this folder. You must have a binary available for terraform to find. + +### Contributions + +While we value open-source contributions to this SDK, this library is generated programmatically. +Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release! + +### SDK Created by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks) diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index 887c3b8..eecd43c 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -2,7 +2,7 @@ terraform { required_providers { epilot-workflow = { source = "epilot-dev/epilot-workflow" - version = "0.8.1" + version = "0.8.2" } } } diff --git a/examples/resources/epilot-workflow_workflow_definition/resource.tf b/examples/resources/epilot-workflow_workflow_definition/resource.tf index 5f4c385..3405316 100644 --- a/examples/resources/epilot-workflow_workflow_definition/resource.tf +++ b/examples/resources/epilot-workflow_workflow_definition/resource.tf @@ -1,80 +1,22 @@ +terraform { + required_providers { + epilot-workflow = { + source = "epilot-dev/epilot-workflow" + version = "1.0.1" + } + + } +} + +provider "epilot-workflow" { + # Configuration options + bearer_auth = var.bearer_auth +} + +variable "bearer_auth" { + type = string +} + resource "epilot-workflow_workflow_definition" "my_workflowdefinition" { - creation_time = "2021-04-27T12:01:13.000Z" - description = "...my_description..." - due_date = "2021-04-27T12:00:00.000Z" - enable_ecp_workflow = false - flow = [ - { - section = { - id = "2a31ed4e-b201-4187-9740-15a348b64814" - name = "Meredith Bruen" - order = 1.95 - steps = [ - { - assigned_to = [ - "...", - ] - automation_config = { - flow_id = "...my_flow_id..." - } - description = { - enabled = true - value = "...my_value..." - } - due_date = "2021-04-27T12:00:00.000Z" - dynamic_due_date = { - action_type_condition = "STEP_CLOSED" - number_of_units = 73.8 - step_id = "...my_step_id..." - time_period = "weeks" - } - ecp = { - description = "...my_description..." - enabled = false - journey = { - id = "64361b27-76d7-498c-b5f3-e120ea0dc9e1" - journey_id = "...my_journey_id..." - name = "Lorraine Witting" - } - label = "...my_label..." - } - execution_type = "AUTOMATION" - id = "3f96aa0e-3408-45f7-9b11-76521d792fea" - installer = { - description = "...my_description..." - enabled = true - journey = { - id = "830af35a-c0f0-4516-986c-6d56674fb26d" - journey_id = "...my_journey_id..." - name = "Paulette O'Hara" - } - label = "...my_label..." - } - journey = { - id = "9b2b84e8-8293-4d18-a93f-16fc9936c940" - journey_id = "...my_journey_id..." - name = "Dr. Joel Hermann" - } - name = "Lorene Denesik" - order = 4.83 - requirements = [ - { - condition = "CLOSED" - definition_id = "...my_definition_id..." - type = "STEP" - }, - ] - type = "SECTION" - user_ids = [ - 9.27, - ] - }, - ] - type = "STEP" - } - }, - ] - id = "70408a19-3e72-4165-b76b-6381b5dd263e" - last_update_time = "2021-04-27T12:01:13.000Z" - name = "Nina Bednar" + } \ No newline at end of file diff --git a/gen.yaml b/gen.yaml index 3aec6be..d940d13 100644 --- a/gen.yaml +++ b/gen.yaml @@ -27,7 +27,7 @@ go: outputModelSuffix: output packageName: openapi terraform: - version: 0.8.1 + version: 0.8.2 additionalDataSources: [] additionalDependencies: {} additionalResources: [] diff --git a/internal/provider/workflowdefinition_data_source.go b/internal/provider/workflowdefinition_data_source.go index b81e0e9..5b63484 100644 --- a/internal/provider/workflowdefinition_data_source.go +++ b/internal/provider/workflowdefinition_data_source.go @@ -568,8 +568,8 @@ func (r *WorkflowDefinitionDataSource) Read(ctx context.Context, req datasource. resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.WorkflowDefinition == nil { - resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) + if !(res.WorkflowDefinition != nil) { + resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) return } data.RefreshFromSharedWorkflowDefinition(res.WorkflowDefinition) diff --git a/internal/provider/workflowdefinition_resource.go b/internal/provider/workflowdefinition_resource.go index 84e3efb..f83992b 100644 --- a/internal/provider/workflowdefinition_resource.go +++ b/internal/provider/workflowdefinition_resource.go @@ -8,6 +8,7 @@ import ( tfTypes "github.com/epilot-dev/terraform-provider-epilot-workflow/internal/provider/types" "github.com/epilot-dev/terraform-provider-epilot-workflow/internal/sdk" "github.com/epilot-dev/terraform-provider-epilot-workflow/internal/sdk/models/operations" + "github.com/epilot-dev/terraform-provider-epilot-workflow/internal/validators" speakeasy_listvalidators "github.com/epilot-dev/terraform-provider-epilot-workflow/internal/validators/listvalidators" speakeasy_numbervalidators "github.com/epilot-dev/terraform-provider-epilot-workflow/internal/validators/numbervalidators" speakeasy_objectvalidators "github.com/epilot-dev/terraform-provider-epilot-workflow/internal/validators/objectvalidators" @@ -872,8 +873,8 @@ func (r *WorkflowDefinitionResource) Create(ctx context.Context, req resource.Cr resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.WorkflowDefinition == nil { - resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) + if !(res.WorkflowDefinition != nil) { + resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) return } data.RefreshFromSharedWorkflowDefinition(res.WorkflowDefinition) @@ -925,8 +926,8 @@ func (r *WorkflowDefinitionResource) Read(ctx context.Context, req resource.Read resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.WorkflowDefinition == nil { - resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) + if !(res.WorkflowDefinition != nil) { + resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) return } data.RefreshFromSharedWorkflowDefinition(res.WorkflowDefinition) @@ -971,8 +972,8 @@ func (r *WorkflowDefinitionResource) Update(ctx context.Context, req resource.Up resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.WorkflowDefinition == nil { - resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) + if !(res.WorkflowDefinition != nil) { + resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) return } data.RefreshFromSharedWorkflowDefinition(res.WorkflowDefinition) diff --git a/internal/sdk/sdk.go b/internal/sdk/sdk.go index fac2754..60dc8dd 100644 --- a/internal/sdk/sdk.go +++ b/internal/sdk/sdk.go @@ -136,8 +136,8 @@ func New(opts ...SDKOption) *SDK { Language: "go", OpenAPIDocVersion: "1.0.0", SDKVersion: "0.0.1", - GenVersion: "2.338.14", - UserAgent: "speakeasy-sdk/go 0.0.1 2.338.14 1.0.0 github.com/epilot-dev/terraform-provider-epilot-workflow/internal/sdk", + GenVersion: "2.340.2", + UserAgent: "speakeasy-sdk/go 0.0.1 2.340.2 1.0.0 github.com/epilot-dev/terraform-provider-epilot-workflow/internal/sdk", Hooks: hooks.New(), }, }