Home > Blockchain >  terraform not found in bitbucket
terraform not found in bitbucket

Time:11-13

So i am trying to create a pipeline on bitbucket. On my local computer, I navigate to the folder cd terraform/environments/devand run terraform init without an issue. However, when I run the test pipeline on bitbucket, it stops on the second action because

bash: terraform: command not found

How can I fix this? I believe I need to install terraform on bitbucket somehow but I am not sure how to do so. Do I use python pip commands? If so, how and why?

image: atlassian/default-image:2

pipelines:
  branches:

    test:
      - step:
          name: 'Navigate to Dev'
          script:
            - cd terraform/environments/dev
          condition:
            changesets:
              includePaths:
                - "terraform/modules"
                - "terraform/environments/dev"
      - step:
          name: 'Initialize Terraform'
          script:
            - terraform init

CodePudding user response:

You need the correct image for your build agent. In this situation, the agent basically only needs terraform installed and accessible:

image: hashicorp/terraform

This will fix your issue. You can also of course set the tag for the image to your specific version of Terraform.

  • Related