Skip to content

Terraform 1.3.4 - errors for deleted resources after partial destroy #32185

@kirikors

Description

@kirikors

Terraform Version

Terraform v1.3.4
on windows_amd64
+ provider registry.terraform.io/aliyun/alicloud v1.190.0
+ provider registry.terraform.io/hashicorp/null v3.2.0

Terraform Configuration Files

Sample code to reproduce the issue

Debug Output

TF debug logs for the second destroy run

Expected Behavior

destroy operation doesn't validate references to already deleted resources

Actual Behavior

references to non-existing (already deleted) resources are validated during destroy operation, resulting in an exception

Steps to Reproduce

The issue happens on TF destroy operation after a failure (when previous destroy run managed to delete some of the resources, but not all).

To reproduce:

  1. terraform apply
  2. manually create a resource that will block VPC deletion
  3. run first terraform destroy -> will delete everything except the VPC, VPC deletion will fail (see gist)
  4. run second terraform destroy -> will fail because of references to non-existing resources (those deleted by the previous partial destroy run) - see gist

Additional Context

The issue doesn't happen with Terraform 1.2.9 - second destroy attempt is successful.

The issue is not limited to just outputs validation, we get similar errors in other places (see gist)

References

Same issue as #31975, but happens in Terraform 1.3.4 (that was supposed to fix it)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions