terraform-gen

module
v0.0.0-...-e9beeda Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2024 License: MIT

README

terraform-gen

Generator(s) of code for Terraform providers.

DEPRECATED/ARCHIVED

The repository is no longer maintained.

For alternatives you may check out the officially maintained provider code generation projects as announced in October 2023: https://www.hashicorp.com/blog/terraform-provider-code-generation-now-in-tech-preview

Why

After you spend time implementing many resources and data sources for Terraform you might realise there's a few parts of the work that are repetitive and 😱 scream for automation.

These include:

  • schema (more or less enriched copy of SDK struct & its fields)
  • flatten* & expand* helper functions (SDK struct <-> schema)
  • documentation for all fields

Unresolved challenges

  • TypeSet vs TypeList
  • ValidateFunc
  • MinItems
  • Set for complex (non-primitive) fields
  • ... many others

Caveats

The current version generates code that is unlikely to be accepted/production-ready without manual tweaks. As such it's not recommended to call this as part of go generate nor submit PRs to Terraform with raw generated code.

Also gofmt is your friend. 🚿

Examples

See /_examples.

License

See LICENSE.

Directories

Path Synopsis
_examples
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL