terraform-provider-file/examples/use-cases/local_snapshot_multiple
github-actions[bot] 2f47cb2e08
fix: temp file collisions (#235) (#238)
* fix: use temp directory for file conversions
* fix: update doc
---------


(cherry picked from commit 0b40f575e6)

Signed-off-by: matttrach <matt.trachier@suse.com>
Co-authored-by: Matt Trachier <matt.trachier@suse.com>
2025-10-04 00:54:04 -05:00
..
README.md fix: temp file collisions (#235) (#238) 2025-10-04 00:54:04 -05:00
backend.tf fix: temp file collisions (#235) (#238) 2025-10-04 00:54:04 -05:00
main.tf fix: temp file collisions (#235) (#238) 2025-10-04 00:54:04 -05:00
outputs.tf fix: temp file collisions (#235) (#238) 2025-10-04 00:54:04 -05:00
variables.tf fix: temp file collisions (#235) (#238) 2025-10-04 00:54:04 -05:00
versions.tf fix: temp file collisions (#235) (#238) 2025-10-04 00:54:04 -05:00

README.md

Multiple Snapshot Use Case

This is an example of snapshotting the same file multiple times. This show the same operations as the basic example, but it shows that you can have multiple snapshots working in parallel on the same file without collisions.

Updating the snapshot

To get the snapshot to update you can send in the "update" argument and change it. The snapshot will update on that apply and remain static until the update argument is changed again.

Base 64 Decode

Notice that the snapshot outputs use base64decode to return the actual file's value.

Snapshots are Sensitive

You could achieve the goals of this resource using a terraform_data with some life-cycle options, except for this part. The Snapshot resource's "snapshot" attribute is sensitive, this keeps sensitive or long files from being spewed into the logs.