forked from loafle/openapi-generator-original
[Terraform] New Terraform Provider generator (#22949)
* [new] Add Terraform provider generator Add a new experimental code generator that produces HashiCorp Terraform providers from OpenAPI specifications using the Plugin Framework SDK. The generator (terraform-provider) supports: - CRUD operation detection from REST patterns and vendor extensions - Resource, data source, and model generation per API tag - HTTP client with API key, bearer token, and basic auth - Type mapping from OpenAPI/Go types to Terraform schema types - Import state support - Configurable provider name, registry address, and version Includes mustache templates for: provider, resources, data sources, models, client, go.mod, GNUmakefile, README, and example configs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [new] Add Terraform provider petstore sample and acceptance tests Add sample generation config and generated Terraform provider for the petstore OpenAPI spec, along with Go acceptance tests that exercise the provider lifecycle (create, read, update, delete, import). Generated output includes: - Provider with auth configuration (API key, bearer, basic) - Pet, User, and Store resources and data sources - Client package with HTTP client and model structs - Go acceptance tests using terraform-plugin-testing - Example Terraform configurations for each resource/data source Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: docs * terraform: add more sample tests and ci workflow * ci: get ci passing * ci: fixes * chore: docs --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
46
.github/workflows/samples-terraform.yaml
vendored
Normal file
46
.github/workflows/samples-terraform.yaml
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
name: Samples Terraform
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'samples/client/petstore/terraform/**'
|
||||
- 'samples/client/petstore/terraform-addpet/**'
|
||||
- 'samples/client/petstore/terraform-server/**'
|
||||
- 'samples/client/others/terraform/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'samples/client/petstore/terraform/**'
|
||||
- 'samples/client/petstore/terraform-addpet/**'
|
||||
- 'samples/client/petstore/terraform-server/**'
|
||||
- 'samples/client/others/terraform/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Terraform Provider
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sample:
|
||||
- samples/client/petstore/terraform/
|
||||
- samples/client/petstore/terraform-addpet/
|
||||
- samples/client/petstore/terraform-server/
|
||||
- samples/client/others/terraform/allof-discriminator/
|
||||
- samples/client/others/terraform/oneof-anyof-required/
|
||||
- samples/client/others/terraform/oneof-discriminator-lookup/
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: "stable"
|
||||
- run: go version
|
||||
- name: Install Dependencies
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: |
|
||||
go mod tidy
|
||||
- name: Build provider
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: go build -v ./...
|
||||
- name: Run tests
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: go test ./... -v -timeout 120m
|
||||
Reference in New Issue
Block a user