Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Destroy already destroyed workflow environment fails with error #704

Closed
eranelbaz opened this issue Aug 31, 2023 · 0 comments · Fixed by #705
Closed

Destroy already destroyed workflow environment fails with error #704

eranelbaz opened this issue Aug 31, 2023 · 0 comments · Fixed by #705
Assignees
Labels
bug Something isn't working

Comments

@eranelbaz
Copy link
Member

eranelbaz commented Aug 31, 2023

Describe the bug
If I manage env0 environment from type workflow using the provider, and I manually destroy the environment, I cannot run terraform destroy on the managed resource.
it is failing for

╷
│ Error: could not delete environment: 400 Bad Request: Nothing to destroy.
│ 
│ 
╵

But, it shouldn't fail as the resource is destroyed.

To Reproduce

  • Deploy workflow environment using the provider
  • manually destroy that environment
  • execute terraform destroy
terraform {
  required_providers {
    env0 = {
      source = "env0/env0"
    }
  }
}

# Configure the env0 provider
provider "env0" {
  api_key         = var.env0_api_key
  api_secret      = var.env0_api_secret
  organization_id = var.env0_organization_id
}

variable "env0_api_key" {}
variable "env0_api_secret" {}
variable "env0_organization_id" {}
variable "env0_project_id" {}

resource "env0_template" "null_resource" {
  name       = "null resource"
  repository = "https://github.com/env0/templates"
  path       = "misc/null-resource"
}

resource "env0_template" "workflow" {
  name       = "workflow"
  repository = "https://github.com/env0/templates"
  path       = "misc/single-environment-workflow"
  type       = "workflow"
}

resource "env0_template_project_assignment" "assignment" {
  template_id = env0_template.workflow.id
  project_id  = var.env0_project_id
}

resource "env0_environment" "workflow_environment" {
  depends_on    = [env0_template.null_resource, env0_template_project_assignment.assignment]
  force_destroy = true
  name          = "wf"
  project_id    = var.env0_project_id
  template_id   = env0_template.workflow.id
}

Expected behavior
Terraform should finish successfully

Provider Version
1.4.16

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

@eranelbaz eranelbaz added the bug Something isn't working label Aug 31, 2023
@TomerHeber TomerHeber self-assigned this Sep 2, 2023
@TomerHeber TomerHeber added this to To do in Ongoing Issues via automation Sep 2, 2023
@TomerHeber TomerHeber moved this from To do to In progress in Ongoing Issues Sep 2, 2023
Ongoing Issues automation moved this from In progress to Done Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

Successfully merging a pull request may close this issue.

2 participants