Member-only story
The tricky thing with YAML files in Kubernetes, is that it’s not so easy to use variables within the files to inject values into them. Kustomize also doesn’t solve thing problem very well, so I will show a way to use Terraform to take a bunch of YAML files with variables, inject values into those variables to generate “rendered” YAML files, that can then be applied to a Kubernetes cluster.
Note: I would recommend using something like Helm or FluxCD over this, but sometimes needs must. ¯\_(ツ)_/¯
(This doesn’t have to be for Kubernetes YAML files, you could use this for a range of use cases where you need to inject some values into template files.)
Code for this example can be found here:
This is what the templates folder structure looks like: