简体   繁体   English

无法在 Azure Devops 管道中选择 Terraform 工作区

[英]Unable to select Terraform workspace in Azure Devops pipeline

I am trying to deploy infrastructure in AWS using Azure Devops.我正在尝试使用 Azure Devops 在 AWS 中部署基础设施。 I have a pipeline to deploy the infra into separate environments using Terraform.我有一个管道可以使用 Terraform 将基础设施部署到单独的环境中。 Using Terraform workspaces is how I have the back end infra being managed.使用 Terraform 工作区是我管理后端基础设施的方式。 I am getting an error selecting a workspace after initializing Terraform.初始化 Terraform 后选择工作区时出现错误。 Below is my azure-pipelines.yml file.下面是我的azure-pipelines.yml文件。 I am utilizing the built in Tasks integration to integrate the steps for Terraform deployment.我正在利用内置的任务集成来集成 Terraform 部署的步骤。 Any advice on how to structure the pipeline to get past this error would be helpful.有关如何构建管道以克服此错误的任何建议都会有所帮助。

azure-pipelines.yml天蓝色管道.yml

trigger:
- master

pool:
  vmImage: ubuntu-20.04

stages:
  - stage: TerraformInstall
    displayName: Terraform
    jobs:
      - job: InstallTerraform
        displayName: Install Terraform
        steps:
          - task: charleszipp.azure-pipelines-tasks-terraform.azure-pipelines-tasks-terraform-installer.TerraformInstaller@0
  - stage: Init
    displayName: Init
    jobs:
      - job: init
        displayName: Terraform init
        steps:
          - task: TerraformTaskV3@3
            inputs:
              provider: 'aws'
              command: 'init'

  - stage: DevStaging
    displayName: Push to Development / Staging
    jobs:
      - job: devstage
        displayName: Push to DevStaging
        steps:
          - task: ms-devlabs.custom-terraform-tasks.custom-terraform-release-task.TerraformTaskV3@3
            inputs:
              provider: aws
              command: custom
              customCommand: 'workspace select devstage'
          - task: ms-devlabs.custom-terraform-tasks.custom-terraform-release-task.TerraformTaskV3@3
            inputs:
              provider: aws
              command: apply
              commandOptions: '-var-file=devstage.tfvars -auto-approve'

Error错误

All other commands:
  console       Try Terraform expressions at an interactive command prompt
  fmt           Reformat your configuration in the standard style
  force-unlock  Release a stuck lock on the current workspace
  get           Install or upgrade remote Terraform modules
  graph         Generate a Graphviz graph of the steps in an operation
  import        Associate existing infrastructure with a Terraform resource
  login         Obtain and save credentials for a remote host
  logout        Remove locally-stored credentials for a remote host
  output        Show output values from your root module
  providers     Show the providers required for this configuration
  refresh       Update the state to match remote systems
  show          Show the current state or a saved plan
  state         Advanced state management
  taint         Mark a resource instance as not fully functional
  test          Experimental support for module integration testing
  untaint       Remove the 'tainted' state from a resource instance
  version       Show the current Terraform version
  workspace     Workspace management

Global options (use these before the subcommand, if any):
  -chdir=DIR    Switch to a different working directory before executing the
                given subcommand.
  -help         Show this help output, or the help for a specified subcommand.
  -version      An alias for the "version" subcommand.
##[error]Error: The process '/usr/local/bin/terraform' failed with exit code 127
Finishing: TerraformTaskV3

customCommand field only takes one keyword. customCommand 字段只需要一个关键字。 in this case it would be 'workspace' 'select devstage' sholud be in the commandOptions在这种情况下,它应该是 'workspace' 'select devstage' 应该在 commandOptions 中

example:例子:

          - task: ms-devlabs.custom-terraform-tasks.custom-terraform-release-task.TerraformTaskV3@3
            inputs:
              provider: aws
              command: custom
              customCommand: 'workspace'
              commandOptions: 'select devstage'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将 Azure DevOps 管道详细信息发送到 SIEM - Send Azure DevOps Pipeline Details to SIEM AssumeRole 在 Azure DevOps 上使用 Terraform 部署到 AWS - AssumeRole when using Terraform on Azure DevOps to deploy to AWS 通过 VPN 和 AD 服务器从 Azure DevOps 到本地域的管道 - Pipeline from Azure DevOps to local domain through a VPN and AD server 从 Azure Devops Pipeline 上传到 AWS s3 存储桶 - Uploading to AWS s3 bucket from Azure Devops Pipeline 是否可以在 Azure DevOps 的构建管道期间下载文件/数据? - Is it possible to download files/data during the build pipeline on Azure DevOps? 具有 Terraform 的 AWS Glue 管道 - AWS Glue pipeline with Terraform 通过无服务器框架在 azure devops 管道 (YAML) 中部署 next.js 应用程序 - Deploying a next.js application, via the serverless framework, within an azure devops pipeline(YAML) 如何构建、package 和部署 AWS SAM lambda function 从 azure Devops CI/CD 管道到 AWS - how to build, package and deploy AWS SAM lambda function of python from azure Devops CI/CD pipeline to AWS 在 Azure devops 管道上运行 cdk synth 出现 ImportError: No module named aws_cdk - Running cdk synth on Azure devops pipeline gives ImportError: No module named aws_cdk 使用 CI/CD 管道将 PHP 应用程序从 Azure DevOps 部署到 AWS - Deploy PHP application from Azure DevOps to AWS using CI/CD pipeline
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM