hashicorp / hashicorp/terraform-plugin-testing

Consider removal of all files copied from `ConfigDirectory` between sequential test steps

Open
#172 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
68
Forks
22
Avg merge
2d 12h
Merged PRs (30d)
1

Description

### terraform-plugin-testing version

```
v1.4.0
```

### Use cases

The changes in [Add Option to use Terraform Configuration in TestStep](https://github.com/hashicorp/terraform-plugin-testing/pull/153#top) allow for specifying a `ConfigDirectory` which contains Terraform configuration. The contents of the specified directory are copied into the working directory when a test step is executed. Once the test step has been executed, any files with `.tf` or `.json` extensions are removed. However, if there are files within the `ConfigDirectory` that have file extensions other than `.tf` and `.json` then these files will persist between test steps.

### Attempted solutions

N/A

### Proposal

We should be preserving the files necessary between steps in the working directory such as the `terraform.tfstate`, but removing the rest of the working directory files/directories.

### References

- https://github.com/hashicorp/terraform-plugin-testing/pull/153#discussion_r1310548840

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.