Terraform and Kubernetes YAML manifests
From time to time I need to use Terraform to deploy resources in the Kubernetes cluster. I’m not a big fan of doing Kubernetes stuff from Terraform’s perspective, because it adds another layer of complexity on top of it and often I need to do some transformation of YAML manifest into HCL resource. The second issue can be easily solved by using:
- terraform-provider-kubectl with
yaml_body
as argument - resource kubernetes_manifest
from the official
kubernetes
provider. The HCL format of this resource can be easily grabbed from handy tool called tfk8s
Of course, it’s better to stick with the official Kubernetes terraform provider, but unfortunately, it introduces one nasty limitation when you deploy a custom resource definition of it must exist in Kubernetes because the planning phase fails instead. More about it here.
powered by Hugo and Noteworthy theme