terraform-provider-file/examples/use-cases/local_directory_advanced
Matt Trachier a1147e54ec
Add local directory (#201)
* feat: add local directory management
---------

Signed-off-by: matttrach <matt.trachier@suse.com>
2025-10-01 13:16:45 -05:00
..
README.md Add local directory (#201) 2025-10-01 13:16:45 -05:00
backend.tf Add local directory (#201) 2025-10-01 13:16:45 -05:00
main.tf Add local directory (#201) 2025-10-01 13:16:45 -05:00
outputs.tf Add local directory (#201) 2025-10-01 13:16:45 -05:00
variables.tf Add local directory (#201) 2025-10-01 13:16:45 -05:00
versions.tf Add local directory (#201) 2025-10-01 13:16:45 -05:00

README.md

Local Directory Use Case

This is a more advanced use case for adding a directory.

The goal of this use case is to retrieve the files in the directory at a specific point in time. We don't want the live data because we add files that we don't want included in the output.

These are the steps:

  1. we generate a directory
  2. add files to it
  3. get the directory data
  4. save the directory data to a file in the directory
  5. snapshot the directory data
  6. output the snapshot

The resulting output will always be the files we first placed in the directory excluding the directory data file.

On the initial run the directory data will match the snapshot, but on subsequent runs the refresh phase will update the directory data to include the directory data file. Our snapshot data will always exclude this file though, since it only updates when we alter the update trigger.