Skip to content

Commit

Permalink
Generate File terraform provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Nishu Goel committed Jan 19, 2024
0 parents commit 0097320
Show file tree
Hide file tree
Showing 116 changed files with 11,574 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This allows generated code to be indexed correctly
*.go linguist-generated=false
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Terraform Provider release workflow.
name: Release

# This GitHub action creates a release when a tag that matches the pattern
# "v*" (e.g. v0.1.0) is created.
on:
push:
tags:
- 'v*'

# Releases need permissions to read and write the repository contents.
# GitHub considers creating releases and uploading assets as writing contents.
permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
with:
# Allow goreleaser to access older tag information.
fetch-depth: 0
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version-file: 'go.mod'
cache: true
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@111c56156bcc6918c056dbef52164cfa583dc549 # v5.2.0
id: import_gpg
with:
gpg_private_key: ${{ secrets.TERRAFORM_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.TERRAFORM_GPG_PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2.0
with:
args: release --clean
env:
# GitHub sets the GITHUB_TOKEN secret automatically.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
28 changes: 28 additions & 0 deletions .github/workflows/speakeasy_sdk_generation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Generate

on:
workflow_dispatch: # Allows manual triggering of the workflow to generate SDK
inputs:
force:
description: "Force generation of SDKs"
type: boolean
default: false
schedule:
- cron: 0 0 * * * # Runs every day at midnight

jobs:
generate:
uses: speakeasy-api/sdk-generation-action/.github/workflows/sdk-generation.yaml@v14
with:
speakeasy_version: latest
openapi_docs: |
- https://docs.api.epilot.io/file.yaml
overlay_docs: |
- ./overlay.yaml
languages: |
- terraform
mode: pr
force: ${{ github.event.inputs.force }}
secrets:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}
81 changes: 81 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Terraform Provider testing workflow.
name: Tests

# This GitHub action runs your tests for each pull request and push.
# Optionally, you can turn it on using a schedule for regular testing.
on:
pull_request:
paths-ignore:
- 'README.md'
push:
paths-ignore:
- 'README.md'

# Testing only needs permissions to read the repository contents.
permissions:
contents: read

jobs:
# Ensure project builds before running testing matrix
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version-file: 'go.mod'
cache: true
- run: go mod download
- run: go build -v .
- name: Run linters
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0
with:
version: latest

generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version-file: 'go.mod'
cache: true
- run: go generate ./...
- name: git diff
run: |
git diff --compact-summary --exit-code || \
(echo; echo "Unexpected difference in directories after code generation. Run 'go generate ./...' command and commit."; exit 1)
# Run acceptance tests in a matrix with Terraform CLI versions
test:
name: Terraform Provider Acceptance Tests
needs: build
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
# list whatever Terraform versions here you would like to support
terraform:
- '1.0.*'
- '1.1.*'
- '1.2.*'
- '1.3.*'
- '1.4.*'
steps:
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version-file: 'go.mod'
cache: true
- uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- run: go mod download
- env:
TF_ACC: "1"
run: go test -v -cover ./internal/provider/
timeout-minutes: 10
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# .gitignore
.terraform
.terraform*
*.tfstate*
# Local .terraform directories
**/.terraform/*
# .tfstate files
*.tfstate
*.tfstate.*
# Crash log files
crash.log
crash.*.log
# Exclude all .tfvars files, which are likely to contain sensitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
*.tfvars
*.tfvars.json
# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json
# Include override files you do wish to add to version control using negated pattern
# !example_override.tf
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*
# Ignore CLI configuration files
.terraformrc
terraform.rc
.DS_Store

terraform-provider-epilot-file
121 changes: 121 additions & 0 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
lockVersion: 2.0.0
id: 11c8545a-deb6-44f9-ba56-e71722af6a51
management:
docChecksum: 4ceee81932bc3b2685969447fa208c0e
docVersion: 0.1.0
speakeasyVersion: internal
generationVersion: 2.230.1
releaseVersion: 0.0.1
configChecksum: 173a2dbe4b228f5fa5f509353452c303
features:
terraform:
constsAndDefaults: 0.1.2
core: 3.8.1
globalSecurity: 2.81.2
globalServerURLs: 2.82.1
retries: 2.81.1
generatedFiles:
- internal/sdk/files.go
- internal/sdk/session.go
- internal/sdk/sdk.go
- examples/README.md
- go.mod
- go.sum
- internal/planmodifiers/boolplanmodifier/suppress_diff.go
- internal/planmodifiers/float64planmodifier/suppress_diff.go
- internal/planmodifiers/int64planmodifier/suppress_diff.go
- internal/planmodifiers/listplanmodifier/suppress_diff.go
- internal/planmodifiers/mapplanmodifier/suppress_diff.go
- internal/planmodifiers/numberplanmodifier/suppress_diff.go
- internal/planmodifiers/objectplanmodifier/suppress_diff.go
- internal/planmodifiers/setplanmodifier/suppress_diff.go
- internal/planmodifiers/stringplanmodifier/suppress_diff.go
- internal/planmodifiers/utils/state_check.go
- internal/provider/reflect/diags.go
- internal/provider/reflect/doc.go
- internal/provider/reflect/generic_attr_value.go
- internal/provider/reflect/helpers.go
- internal/provider/reflect/interfaces.go
- internal/provider/reflect/into.go
- internal/provider/reflect/map.go
- internal/provider/reflect/number.go
- internal/provider/reflect/options.go
- internal/provider/reflect/outof.go
- internal/provider/reflect/pointer.go
- internal/provider/reflect/primitive.go
- internal/provider/reflect/slice.go
- internal/provider/reflect/struct.go
- internal/provider/utils.go
- internal/sdk/pkg/models/sdkerrors/sdkerror.go
- internal/sdk/pkg/types/bigint.go
- internal/sdk/pkg/types/date.go
- internal/sdk/pkg/types/datetime.go
- internal/sdk/pkg/types/decimal.go
- internal/sdk/pkg/types/pointers.go
- internal/sdk/pkg/utils/contenttype.go
- internal/sdk/pkg/utils/form.go
- internal/sdk/pkg/utils/headers.go
- internal/sdk/pkg/utils/json.go
- internal/sdk/pkg/utils/pathparams.go
- internal/sdk/pkg/utils/queryparams.go
- internal/sdk/pkg/utils/requestbody.go
- internal/sdk/pkg/utils/retries.go
- internal/sdk/pkg/utils/security.go
- internal/sdk/pkg/utils/utils.go
- internal/validators/DateValidator.go
- internal/validators/ExactlyOneChild.go
- internal/validators/JSONParseValidator.go
- internal/validators/RFC3339Validator.go
- internal/validators/boolvalidators/not_null.go
- internal/validators/float64validators/not_null.go
- internal/validators/int64validators/not_null.go
- internal/validators/listvalidators/not_null.go
- internal/validators/mapvalidators/not_null.go
- internal/validators/numbervalidators/not_null.go
- internal/validators/objectvalidators/not_null.go
- internal/validators/setvalidators/not_null.go
- internal/validators/stringvalidators/not_null.go
- main.go
- terraform-registry-manifest.json
- tools/tools.go
- internal/sdk/pkg/models/operations/accesspubliclink.go
- internal/sdk/pkg/models/operations/deletefile.go
- internal/sdk/pkg/models/operations/downloadfile.go
- internal/sdk/pkg/models/operations/downloadfiles.go
- internal/sdk/pkg/models/operations/downloads3file.go
- internal/sdk/pkg/models/operations/generatepubliclink.go
- internal/sdk/pkg/models/operations/getallpubliclinksforfile.go
- internal/sdk/pkg/models/operations/previewfile.go
- internal/sdk/pkg/models/operations/previewpublicfile.go
- internal/sdk/pkg/models/operations/previews3file.go
- internal/sdk/pkg/models/operations/previews3fileget.go
- internal/sdk/pkg/models/operations/revokepubliclink.go
- internal/sdk/pkg/models/operations/savefile.go
- internal/sdk/pkg/models/operations/uploadfile.go
- internal/sdk/pkg/models/operations/uploadfilepublic.go
- internal/sdk/pkg/models/operations/uploadfilev2.go
- internal/sdk/pkg/models/operations/verifycustomdownloadurl.go
- internal/sdk/pkg/models/operations/deletesession.go
- internal/sdk/pkg/models/operations/getsession.go
- internal/sdk/pkg/models/shared/deletefilepayload.go
- internal/sdk/pkg/models/shared/s3reference.go
- internal/sdk/pkg/models/shared/downloadfilespayload.go
- internal/sdk/pkg/models/shared/publiclink.go
- internal/sdk/pkg/models/shared/fileentity.go
- internal/sdk/pkg/models/shared/uploadfilepayload.go
- internal/sdk/pkg/models/shared/fileupload.go
- internal/sdk/pkg/models/shared/verifycustomdownloadurlpayload.go
- internal/sdk/pkg/models/shared/security.go
- internal/provider/type_s3_reference.go
- internal/provider/type_versions.go
- USAGE.md
- internal/provider/provider.go
- examples/provider/provider.tf
- internal/provider/file_resource.go
- internal/provider/file_resource_sdk.go
- examples/resources/epilot-file_file/resource.tf
- internal/provider/uploadfile_resource.go
- internal/provider/uploadfile_resource_sdk.go
- examples/resources/epilot-file_upload_file/resource.tf
- internal/sdk/pkg/models/operations/options.go
- .gitattributes
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.PHONY: all docs
all: speakeasy docs

original.yaml:
curl https://docs.api.epilot.io/file.yaml > original.yaml

original_modified.yaml: original.yaml
cp original.yaml original_modified.yaml

overlay.yaml:
speakeasy overlay compare -s original.yaml -s original_modified.yaml > overlay.yaml

speakeasy:
$(eval TMP := $(shell mktemp -d))
curl https://docs.api.epilot.io/file.yaml > $(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

docs:
go generate ./...

Loading

0 comments on commit 0097320

Please sign in to comment.