I was wondering if someone could point me in the right direction, I am looking at verbalising our Kubernetes version within our Terraform module as currently its hard coded.
Every now and then we get an error saying that our "orchestration version" isn't valid when we deploy our cluster - this is due to Azure dropping our Kubernetes version... (We deploy our dev/uat envs daily)
So I came up with the idea of using a variable for our version so we can always deploy avoiding the "invalid orchestration" error. I scripted the bash script for what I need;
az aks get-versions --location westeurope --query 'orchestrators' -o tsv | awk '{print $3}' | tail -2 | head -n 1
But now I wish to use the output from ^^^ to use as our Kubernetes version within our Terraform module we deploy daily.
Can anyone point me in the right direction?
I've had a look at using build-args within the docker container.
Use external
datasource:
https://www.terraform.io/docs/providers/external/data_source.html.
The only trouble is that the output and (optional) input must be valid Jsons with some limitiations.
Example:
data "external" "myjson" {
program = [
"${path.module}/scriptWhichReturnsJson.sh",
]
result {
}
}
...
resource ... {
value = data.external.myjson.property
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With