Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

bitbucket pipeline failing when provisioning resource to Azure cloud using terraform scripts

Vivek Bairi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 21, 2024

Hi,

I am trying to deploy resources in Azure cloud using terraform scripts and bitbucket pipelines.

It's getting failed at initial stage. error screenshot has been attached

Unable to figure out why it's unable find terraform

Error on Build line 66:
/opt/atlassian/pipelines/agent/tmp/shellScript13245989058089105971.sh: line 5: terraform: not found

Could you please help me on this

bitbucket-error.jpg

Below is my pipeline script

image: hashicorp/terraform:light

pipelines:
  default:
    - step:
        name: Terraform init & Plan
        script:
          - terraform --version
          - terraform init
          - terraform validate
         

1 answer

1 vote
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 24, 2024

Hi Vivek and welcome to the community!

I believe the culprit is that you have added in this repo a Repository variable with the name PATH. The shell uses PATH to find commands, so if you replace its usual list of locations, then some commands won't work anymore.

If you want to add a directory to the environment variable PATH, you can use a command like the following in your step's script (and remove the PATH variable from your Repository's variables):

- export PATH=$PATH:~/opt/bin

If this Repository variable is not related to the PATH environment variable that the shell uses to find commands, you can change its name to something different.

Please feel free to let me know how it goes and if you have any questions.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events