连接到TFE时的地形破坏错误

时间:2019-04-02 15:26:16

标签: terraform terraform-provider-aws terraform-enterprise

我已经在Terraform Enterprise中创建了一个工作区,方法是在本地运行Terraform初始化&& terraform计划,并将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销毁时,会出现此错误:

    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销毁,以销毁我的新Terraform企业工作空间所建立的基础结构。

编辑:日志:

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.

1 个答案:

答案 0 :(得分:0)

尽管希望这个答案有点晚,但将来仍可以帮助其他人。

在使用Terraform Enterprise或Terraform Cloud时,您需要确保在 工作区<内>遵循他们关于 销毁和删除 的指南< / em>

此文档位于here

要排队破坏由工作空间管理的基础架构,您需要确保在工作空间的 变量 中,您已为变量分配了名称{ {1}}的值为CONFIRM_DESTROY

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

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