简体   繁体   中英

terraform not found in bitbucket

So i am trying to create a pipeline on bitbucket. On my local computer, I navigate to the folder cd terraform/environments/dev and 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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM