Skip to content

terraform test: dump the complete state file when a destroy operation fails. #33786

Open
@lorengordon

Description

@lorengordon

Terraform Version

terraform 1.6

Use Cases

I'm interested in using the test command, in the upcoming terraform 1.6 release. We currently have a similar workflow using the tftest pytest library. One thing we've found useful is that tftest leaves the state behind when the destroy action fails. This gives us the opportunity to investigate what happened, update the config or permissions if needed, and re-execute the destroy to cleanup any lingering resources.

Currently, the test command maintains state only in memory. I am curious what this means for destroy-time errors. Do the resources just remain lingering? Is there any way to inspect the failure and cleanup?

Attempted Solutions

n/a

Proposal

Perhaps on error, write the state to a file?

References

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions