A terraform
provider that makes it possible to render Jinja templates within a terraform
project.
The Jinja engine used under the hood is based on the gonja
Golang library and aims to be as close as possible to python
's Jinja.
The JSON schema validation engine is based on the jsonschema
Golang library.
provider "jinja" {
strict_undefined = true
}
data "jinja_template" "render" {
source {
template = file("${path.module}/template.j2")
directory = path.module
}
context {
type = "yaml"
data = "${path.module}/src/context.yaml"
}
}
output "rendered" {
value = data.jinja_template.render.result
}
You can run a full example from the dedicated sub-folder.
- Provider configuration:
jinja
- Data sources:
ℹ️ The documentation folder is generated using tfplugindocs and running make docs . |
---|
Please read through the contribution guidelines before diving into any work.
- Get
make
with the online instructions ; - Install go
>= 1.21
by following the official documentation ; - Grab
tfplugindocs
using the dedicated procedure ; - Download
goreleaser
from its website ; - Fetch the latest
terraform
binary from Hashicorp's web page.
The unit tests can be run using:
make test
The provider can be installed locally, using:
make install
See the Makefile
for more details on what it means.
The example located under examples/
can be ran with:
make example