hashicorp / terraform-provider-tfe

Official HCP Terraform and Terraform Enterprise provider, maintained by HashiCorp. Provision HCP Terraform or Terraform Enterprise - with Terraform!
https://registry.terraform.io/providers/hashicorp/tfe
Mozilla Public License 2.0
165 stars 156 forks source link

provider errors when tfe_workspace_run_task is outside of terraform #1497

Open ausmartway opened 2 weeks ago

ausmartway commented 2 weeks ago

Terraform version

1.9.8

Terraform Configuration Files

data "tfe_workspace_ids" "customerfacing" {
  tag_names    = ["customerfacing"]
  organization = "REMOVED"
}
resource "tfe_workspace_run_task" "snyk" {
  for_each          = data.tfe_workspace_ids.customerfacing.ids
  workspace_id      = each.value
  task_id           = "REMOVED"
  enforcement_level = "advisory"
}

Debug Output

If any workspace associated with "customerfacing" tag is removed outside of terraform, then terraform refresh/plan/apply would fail with :

Error: Error reading Workspace Run Task
with tfe_workspace_run_task.snyk["asb-terraform-enterprise-azure-cdktf"]
on management-settings.tf line 372, in resource "tfe_workspace_run_task" "snyk":
resource "tfe_workspace_run_task" "snyk" {
Could not read Workspace Run Task, unexpected error: resource not found

Expected Behavior

If a previously managed resource was removed outside of terraform, the provider should consider the resource gone, it should then decide what to do based on what's in the code - create the resource if it still exists in code or just do nothing if code no longer exists.

Actual Behavior

the tfe provider erros and could not do refresh/plan and apply.

Additional Context

ausmartway commented 2 weeks ago

I have tested the behaviour using the latest version(v0.59.0)

glennsarti commented 2 weeks ago

This issue will be resolved in the next release (Nov 2024 release)