This is my first question here.
resource "local_file" "values" {
content = data.template_file.values.rendered
filename = "values-${var.environment}.yaml"
}
data "template_file" "values" {
template = file("${path.module}/values-template.yaml")
vars {
key1 = var.value1
key2 = var.value2
}
I have used the above snippet to create a file "values-${var.environment}.yaml". we are using terraform cloud as a backend remote. what data block do I use to retrieve the "values-${var.environment}.yaml" into my local machine or to use them in below resource block.
resource "helm_release" "prism" {
depends_on = [ data.local_file.prism ]
name = "prism"
repository = "xxxx"
chart = "prism"
values = []
}
which provider block should I use to deploy the helm releases in kubernetes?
provider "helm" {
alias = "eks-prism-app-prod-apse2"
kubernetes {
host = data.aws_eks_cluster.prism.endpoint
cluster_ca_certificate = base64decode(data.aws_eks_cluster.prism.certificate_authority.0.data)
token = data.aws_eks_cluster_auth.prism.token
load_config_file = false
}
}
I tried with the above block, but i was blocked with "Error: Kubernetes cluster unreachable: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable"
I did manually import the values by saving it to local machine using terraform state show module.manifests.data.local_file.prism > values.yaml. Then I deployed manually from local machine using kubeconfig and exporting aws keys.
I want to automate these with out manual intervention.
Help will be appreciated and Thanks in advance.