Search code examples
yamlterraformazure-aksterraform-provider-azure

How to use yaml file in Terraform?


I have kubernetes configuration in a seperate yaml file. I want to use that yaml file while running terraform can I do it? If yes, then how.


Solution

  • According to my experience, Terraform supports the Kubernetes provider, but all the things in that provider are separate, such as deployment, pod, service and etc. It does not provide a way to load all the things from a configuration file.

    So, to deploy from the configuration file, I recommend you put the kubectl apply -f config_file in the null_resource. And it's also simple to delete all the things that have deployed with multiple mull_resource, you just need to use the Terraform command terraform destroy, it will remove all the resources that deployed through the Terraform file.