Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

radeksimko/terraform-gen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Releases

No releases published

Packages

No packages published

Languages