首页 > 解决方案 > 在 bitbucket 中找不到 terraform

问题描述

所以我正在尝试在 bitbucket 上创建一个管道。在我的本地计算机上,我导航到该文件夹cd terraform/environments/dev​​并运行terraform init没有问题。但是,当我在 bitbucket 上运行测试管道时,它会在第二个操作时停止,因为

bash: terraform: command not found

我怎样才能解决这个问题?我相信我需要以某种方式在 bitbucket 上安装 terraform,但我不知道该怎么做。我是否使用 python pip 命令?如果是这样,如何以及为什么?

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

标签: pythonamazon-web-servicesterraformbitbucketatlassian-sourcetree

解决方案


您需要构建代理的正确映像。在这种情况下,代理基本上只需要安装和访问 terraform:

image: hashicorp/terraform

这将解决您的问题。当然,您也可以将图像的标签设置为您特定版本的 Terraform。


推荐阅读