Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alex-leonhardt/terraform-provider-gotemplate
a custom terraform provider to use go text/template language instead of terraform's
https://github.com/alex-leonhardt/terraform-provider-gotemplate
golang template terraform terraform-provider
Last synced: about 2 months ago
JSON representation
a custom terraform provider to use go text/template language instead of terraform's
- Host: GitHub
- URL: https://github.com/alex-leonhardt/terraform-provider-gotemplate
- Owner: alex-leonhardt
- License: mpl-2.0
- Created: 2018-04-16T23:23:03.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-03-31T15:23:12.000Z (almost 4 years ago)
- Last Synced: 2024-11-15T04:10:52.364Z (about 2 months ago)
- Topics: golang, template, terraform, terraform-provider
- Language: Go
- Size: 6.62 MB
- Stars: 20
- Watchers: 2
- Forks: 12
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# terraform-provider-gotemplate
## build and run tf
```
go build -o terraform-provider-gotemplate; tf init; tf plan && tf apply
```## mixed json
when having a mix of json, like
```
{
"m": "yolo",
22
}
```one can use the included `template funcs` to assert the type and change how one deals with the values/keys - example see:
https://gist.github.com/alex-leonhardt/8ed3f78545706d89d466434fb6870023### template functions
to assert a type when dealing with mixed json, you have the following available:
- isInt
- isString
- isSlice
- isArray
- isMapand you can use them like this
```
{{ if isInt $v }}
do stuff with {{ $v }}
{{ endif }}{{ if isMap $v }}
do range over {{ $v }} like ...
{{ range $k, $v := $v -}}
k={{ $k }}, v={{ $v }}
{{- end }}
{{ endif }}
```