I’ll try to explain the outcome i’m looking for as it may be i’m going the completely wrong direction in the first place. Below is a null_resource with multiple commands in the local-exec piece. I’m trying to get everything within {} of local-exec into a variable so that i can maintain multiple variables with unique commands in each variable, and then use a LOOKUP within the null_resource so i can call different variables based on different ${terraform.workspace} values. So I’m trying to figure out how to properly write the variable so that it works when called by the local-exec provisioner.
- if there’s a better way to do this, let me know
- if this is a good way to reach my desired outcome, how do i do it?
Thanks!
resource “null_resource” “datadog_metrics” {
depends_on = [“null_resource.platform_auth”]
provisioner “local-exec” {
command = <<EOT
sudo runuser -l user -c ‘kubectl apply -f /home/terraform/kube-state-metrics/’;
sudo runuser -l user -c ‘kubectl apply -f /home/terraform/datadog_cluster_agent’/
EOT
}
}