连接到TFE时Terraform销毁错误

连接到TFE时Terraform销毁错误,terraform,terraform-provider-aws,terraform-enterprise,Terraform,Terraform Provider Aws,Terraform Enterprise,我已经在Terraform Enterprise中创建了一个工作区,通过在本地运行Terraform init&&Terraform plan,将Terraform Enterprise设置为我的后端: # Using a single workspace: terraform { backend "remote" { hostname = "dep.app.example.io" organization = "nnnn" wor

我已经在Terraform Enterprise中创建了一个工作区,通过在本地运行Terraform init&&Terraform plan,将Terraform Enterprise设置为我的后端:

    # Using a single workspace:
    terraform {
     backend "remote" {
      hostname = "dep.app.example.io"
      organization = "nnnn"

      workspaces {
       name = "create-workspace"
      }
     }
    }
Terraform Apply可以工作,我可以通过Terraform Enterprise使用以下代码启动ec2:

    provider "aws" {
     region = "${var.region}"
    }

    resource "aws_instance" "feature" {
     count = 1
     ami = "${var.ami}"
     availability_zone = "${var.availability_zone}"
     instance_type = "${var.instance_type}"
     tags = {
      Name = "${var.name_tag}"
     }
    }
现在,当我运行terraform destroy时,出现以下错误:

    Error: error creating run: Invalid Attribute Infrastructure is 
    not destroyable

    The configured "remote" backend encountered an unexpected 
    error. Sometimes this is caused by network connection problems, 
    in which case you could retry the command. If the issue 
    persists please open a support ticket to get help resolving the 
    problem.
我做错了什么?我希望能够运行一个terraform destroy,它会破坏我的新terraform enterprise workspace启动的基础设施

编辑:日志:

2019/04/03 09:11:54 [INFO] Terraform version: 0.11.11  ac4fff416318bf0915a0ab80e062a99ef3724334
2019/04/03 09:11:54 [INFO] Go runtime version: go1.11.1
2019/04/03 09:11:54 [INFO] CLI args: []string{"/usr/local/bin/terraform", "destroy"}
2019/04/03 09:11:54 [DEBUG] Attempting to open CLI config file: /Users/nlegorrec/.terraformrc
2019/04/03 09:11:54 Loading CLI configuration from /Users/nlegorrec/.terraformrc
2019/04/03 09:11:54 [INFO] CLI command args: []string{"destroy"}
2019/04/03 09:11:54 [TRACE] Preserving existing state lineage "f7abdc54-236c-c906-e701-049f3e2cc00c"
2019/04/03 09:11:54 [TRACE] Preserving existing state lineage "f7abdc54-236c-c906-e701-049f3e2cc00c"
2019/04/03 09:11:54 [DEBUG] Service discovery for dep.app.redbull.com at https://dep.app.redbull.com/.well-known/terraform.json
2019/04/03 09:11:56 [DEBUG] Retrieve version constraints for service tfe.v2 and product terraform
2019/04/03 09:11:57 [INFO] command: backend initialized: *remote.Remote
2019/04/03 09:11:57 [DEBUG] checking for provider in "."
2019/04/03 09:11:57 [DEBUG] checking for provider in "/usr/local/bin"
2019/04/03 09:11:57 [DEBUG] checking for provider in ".terraform/plugins/darwin_amd64"
2019/04/03 09:11:57 [DEBUG] found provider "terraform-provider-aws_v2.4.0_x4"
2019/04/03 09:11:57 [DEBUG] found valid plugin: "aws", "2.4.0", "/Users/nlegorrec/dev/Software Engineering/emp-kpi-tracker_web/dep/.terraform/plugins/darwin_amd64/terraform-provider-aws_v2.4.0_x4"
2019/04/03 09:11:57 [DEBUG] checking for provisioner in "."
2019/04/03 09:11:57 [DEBUG] checking for provisioner in "/usr/local/bin"
2019/04/03 09:11:57 [DEBUG] checking for provisioner in ".terraform/plugins/darwin_amd64"
2019/04/03 09:11:57 [INFO] backend/remote: starting Apply operation

2019/04/03 09:12:00 [DEBUG] plugin: waiting for all plugin processes to complete...
Error: error creating run: Invalid Attribute Infrastructure is not destroyable

The configured "remote" backend encountered an unexpected error. Sometimes
this is caused by network connection problems, in which case you could retry
the command. If the issue persists please open a support ticket to get help
resolving the problem.

尽管有点晚了,希望这个答案能在将来帮助别人

在使用Terraform Enterprise或Terraform Cloud时,您需要确保遵循工作区内的销毁和删除指南

这方面的文档位于

要对由工作区管理的基础结构的销毁进行排队,您需要确保在工作区的变量中,您已分配了一个名为CONFIRM_DESTROY的变量,该变量的值为1

重要的是,对工作区的任何更改都需要管理员权限


完成后,您应该能够像在Terraform中本地一样使用CLI工作流。

在运行Terraform destroy时,您可以启用日志记录并共享日志吗?@SushantSonker添加了日志。对于我出差后的延迟响应,我深表歉意。我不确定您是如何在模块中引用后端的,但您可以尝试使用terraform init重新初始化后端,如下所示,然后尝试运行terraform destroy。terraform init \-后端配置=地址=demo.consu.io \-后端配置=路径=示例\应用程序/terraform\状态\-后端配置=方案=https@NickLeGorrec我的回答有用吗?