0

I want to run a .sh script

  resource "null_resource" "Add_pipeline_Stages2" {
    provisioner "local-exec" {
      command= "chmod +x ${path.cwd}/../Terraform-Scripts/addpipelinestage.sh"
      interpreter = ["bash", "-command"] 

    }
    depends_on = [null_resource.iac_Configuration]
  }

but I got this error:

bash: line 0: bash: chmod +x /home/vsts/work/1/s/Terraform/templates/../Terraform- 
Scripts/addpipelinestage.sh: invalid option name
7
  • What is in the script? Commented Aug 11, 2022 at 7:51
  • The script contain sed commands and az run pipeline commands Commented Aug 11, 2022 at 7:52
  • Ok, and can you change in the interpreter from -command to -c? Commented Aug 11, 2022 at 7:55
  • (local-exec): Executing: ["bash" "-c" "chmod +x /home/vsts/work/1/s/Terraform/templates/../Terraform-Scripts/addpipelinestage.sh"] Got this output. Commented Aug 11, 2022 at 8:23
  • @MarkoE The null resource completion done in Apply stage. But I donot get the output of script and any result of my script, what i want to do. Commented Aug 11, 2022 at 8:23

1 Answer 1

3

Since the script needs to be invoked after changing it to be executable, here is what needs to change:

resource "null_resource" "Add_pipeline_Stages2" {
  provisioner "local-exec" {
    command     = "chmod +x ${path.cwd}/../Terraform-Scripts/addpipelinestage.sh; ${path.cwd}/../Terraform-Scripts/addpipelinestage.sh"
    interpreter = ["bash", "-c"]
  }
  depends_on = [null_resource.iac_Configuration]
}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.