Skip to content

Commit

Permalink
Fix Wf provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Nishu Goel committed Jun 11, 2024
1 parent bb03e77 commit 15bcf15
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 95 deletions.
10 changes: 5 additions & 5 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
83 changes: 83 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# epilot-workflow

<div align="left">
<a href="https://speakeasyapi.dev/"><img src="https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge&logoColor=FBE331&logo=speakeasy&labelColor=545454" /></a>
<a href="https://github.com/epilot-dev/terraform-provider-epilot-workflow.git/actions"><img src="https://img.shields.io/github/actions/workflow/status/epilot-dev/terraform-provider-epilot-workflow/speakeasy_sdk_generation.yml?style=for-the-badge" /></a>

</div>

<no value>
<!-- Start SDK <no value> -->
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
}
```
<!-- End SDK <no value> -->

<no value>
<!-- Start SDK <no value> -->
### 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
```
<!-- End SDK <no value> -->

<no value>
<!-- Start SDK <no value> -->

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

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

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" = "<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 {}
}
```

Your `<PATH>` may vary depending on how your Go environment variables are configured. Execute `go env GOBIN` to set it, then set the `<PATH>` 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)
2 changes: 1 addition & 1 deletion examples/provider/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
epilot-workflow = {
source = "epilot-dev/epilot-workflow"
version = "0.8.1"
version = "0.8.2"
}
}
}
Expand Down
98 changes: 20 additions & 78 deletions examples/resources/epilot-workflow_workflow_definition/resource.tf
Original file line number Diff line number Diff line change
@@ -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"

}
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.8.1
version: 0.8.2
additionalDataSources: []
additionalDependencies: {}
additionalResources: []
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/workflowdefinition_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 7 additions & 6 deletions internal/provider/workflowdefinition_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions internal/sdk/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
},
}
Expand Down

0 comments on commit 15bcf15

Please sign in to comment.