I have this piece of Terraform code to run a cli bash script to configure a cluster for me, but Terraform will not run the script. The script runs fine, with no errors outside of Terraform.
The Error I am getting is:
│ Error: local-exec provisioner error
│
│ with null_resource.aks_configure,
│ on configure_cluster.tf line 2, in resource "null_resource" "aks_configure":
│ 2: provisioner "local-exec" {
│
│ Error running command './setupcluster.sh -r R21Kubernetes-newprodenveu -l francecentral -c R21KubernetesCluster-newprodenveu -e [email protected] -d argocdnewprodenveu.reporting21.com': exec: "/bin/bash":
│ executable file not found in %PATH%. Output:
╵
I have tried running this in PowerShell WSL
and GitBash
. Both give out the same error
Terraform Code:
resource "null_resource" "aks_configure" {
provisioner "local-exec" {
command = "${path.module}/setupcluster.sh -r ${local.rg_name} -l ${local.location_for_bash_script} -c ${local.kubernetesclustername} -e ${local.letsencryptemail} -d ${local.fulldnsname}"
interpreter = ["/bin/bash", "-c" ]
}
depends_on = [azurerm_kubernetes_cluster.r21_new_prod_kubernetes, azurerm_resource_group.r21_new_prod_rg ]
}
Folder structure:
The folder structure is below it’s basically one flat folder with everything in it, including the script.
┣ ????aks_nginx_ingress_helm.tf
┣ ????aksconnection.tf
┣ ????aksvnet.tf
┣ ????argocd_setup.tf
┣ ????argocd-values.yaml
┣ ????azure_secret_store.tpl.yaml
┣ ????cert-manager-setup.tf
┣ ????cloudflaredns.tf
┣ ????configure_cluster.tf
┣ ????createnewbackend.sh
┣ ????data_resource.tf
┣ ????deployenvcongifmap.yaml
┣ ????dns.tf
┣ ????external-secrets-setup.tf
┣ ????keyvault.tf
┣ ????kubernetes.tf
┣ ????kubernetesroleassignment.tf
┣ ????letsencrypt-issuer.tpl.yaml
┣ ????locals.tf
┣ ????nsg.tf
┣ ????output.tf
┣ ????providers.tf
┣ ????pushsecrettokv.tpl.yaml
┣ ????resourcegroup.tf
┣ ????setupcluster.sh
┣ ????sql_server.tf
┣ ????testingenv.conf
┗ ????variables.tf