-
Notifications
You must be signed in to change notification settings - Fork 10k
Description
Terraform Version
Terraform v1.11.0
on linux_amd64
Use Cases
Replacing the legacy/deprecated -state
flag: The new Data Source requires an existing .tfstate
file.
Let me explain: I'm making a script that deploys multiple vms, do some tests on them and destroy's them, I have multi threaded it so I'm using multiple .tfstates
to avoid one thread applying a destroy on everything.
-state
works as I can give each thread a separate state file, however this is deprecated
Per the docs (see References) there are 2 new ways to define the path of the .tfstate
to use:
- Inside the terraform block specifying your backend, however "Variables may not be used here."
- Inside a data block ("terraform_remote_state"), however "No stored state was found for the given workspace in the given backend." as it currently requires an already existing .tfstate file to be present in the specified path
Please also read this comment for further clarification.
Attempted Solutions
Using the legacy/deprecated -state
Proposal
A new way to dynamically assign a state path file. Like a local_state_path
data block or smth.
References
https://developer.hashicorp.com/terraform/language/backend/local (btw the deprecated warning outputs a wrong non-existing link)