Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hashicorp/terraform-plugin-codegen-spec
Terraform Provider Code Generation Specification and Go Bindings
https://github.com/hashicorp/terraform-plugin-codegen-spec
terraform
Last synced: about 1 month ago
JSON representation
Terraform Provider Code Generation Specification and Go Bindings
- Host: GitHub
- URL: https://github.com/hashicorp/terraform-plugin-codegen-spec
- Owner: hashicorp
- License: mpl-2.0
- Created: 2023-05-03T02:30:44.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-16T13:36:12.000Z (about 2 months ago)
- Last Synced: 2024-09-27T12:41:53.983Z (about 1 month ago)
- Topics: terraform
- Language: Go
- Homepage:
- Size: 411 KB
- Stars: 7
- Watchers: 11
- Forks: 4
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Terraform Provider Code Specification
> _[Terraform Provider Code Generation](https://developer.hashicorp.com/terraform/plugin/code-generation) is currently in tech preview. If you have general questions or feedback about provider code generation, please create a new topic in the [Plugin Development Community Forum](https://discuss.hashicorp.com/c/terraform-providers/tf-plugin-sdk)._
## Overview
The Terraform Provider Code Specification is a versioned interface which is defined with a JSON schema, and has associated Go language bindings. The specification defines a [Terraform Provider](https://developer.hashicorp.com/terraform/plugin) representation which can be used for the generation of Go code for use in a provider, for example, with the [Plugin Framework Code Generator](https://developer.hashicorp.com/terraform/plugin/code-generation/framework-generator).
A specification can be generated from a declarative API model, such as OpenAPI with the [OpenAPI Provider Spec Generator](https://developer.hashicorp.com/terraform/plugin/code-generation/openapi-generator).
## Documentation
Full details of each of the fields defined within the JSON schema are available on the HashiCorp Developer site: https://developer.hashicorp.com//terraform/plugin/code-generation/specification.
## Versioning
### Schema
Schema versioning (e.g., [0.1](./spec/v0.1/schema.json)) follows the convention of using a _MAJOR.MINOR_ version, similar to the versioning used by [OpenAPI Specification](https://github.com/OAI/OpenAPI-Specification/blob/main/schemas/v3.1/schema.json) for example.
### Tags & Releases
Tags and releases follow the convention of [semantic versioning](https://semver.org/) adhering to _MAJOR.MINOR.PATCH_ versions.
## Usage
A JSON schema (e.g., [0.1](./spec/v0.1/schema.json)) defines the structure of a specification implementation by provider developers. For example:
```json
{
"$id": "https://github.com/hashicorp/terraform-plugin-codegen-spec/spec/v0.1/schema.json",
"$schema": "https://json-schema.org/draft-07/schema",
"type": "object",
"properties": {
"datasources": {
"type": "array",
"items": {
"$ref": "#/$defs/datasource"
}
},
"provider": {
"$ref": "#/$defs/provider"
},
"resources": {
"type": "array",
"items": {
"$ref": "#/$defs/resource"
}
},
"version": {
"type": "string",
"minLength": 3
}
},
"required": [
"provider",
"version"
],
...
}
```A corresponding specification implementation (e.g., [example.json](./spec/v0.1/example.json)) could look as follows:
```json
{
"datasources": [
{
...
}
],
"provider": {
...
},
"resources": [
{
...
}
]
}
```Refer to [example.json](./spec/v0.1/example.json) for an example specification.
## License
Refer to [Mozilla Public License v2.0](./LICENSE).
## Experimental Status
By using the software in this repository (the "Software"), you acknowledge that: (1) the Software is still in development, may change, and has not been released as a commercial product by HashiCorp and is not currently supported in any way by HashiCorp; (2) the Software is provided on an "as-is" basis, and may include bugs, errors, or other issues; (3) the Software is NOT INTENDED FOR PRODUCTION USE, use of the Software may result in unexpected results, loss of data, or other unexpected results, and HashiCorp disclaims any and all liability resulting from use of the Software; and (4) HashiCorp reserves all rights to make all decisions about the features, functionality and commercial release (or non-release) of the Software, at any time and without any obligation or liability whatsoever.