Quantcast
Viewing latest article 21
Browse Latest Browse All 38

Answer by Giulio Vian for Pass output (database password) from Terraform to Kubernetes manifest in CICD pipeline

One solution is to generate the Kubernetes yaml from a template.

The pattern uses templatefile function in Terraform 0.12 or the template provider earlier versions to read and local_file resource to write. For example:

data "template_file""service_template" {  template = "${file("${path.module}/templates/service.tpl")}"  vars {    postgres_password = ""${module.postgres.db_master_pass}"  }}resource "local_file""template" {  content  = "${data.template_file.service_template.rendered}"  filename = "postegres_service.yaml"}

There are many other options, like using to the Kubernetes provider, but I think this better matches your question.


Viewing latest article 21
Browse Latest Browse All 38

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>