Auto discovery of the state file from terraform backend block
Description
As suggested by @Gary-Armstrong, to be able to specify a --from tfstate is good enough, but by reading the right terraform file we could get the same information and build the option automatically for the user:
terraform {
backend "s3" {
bucket = "the-bucket-name"
key = "some-directory-name"
region = "us-east-1"
dynamodb_table = "some-statelock"
}
}
Sidenote: it should also work dynamically for people with different workspaces.
⚠️ this feature breaks the initial assumption that driftctl runs without any need to access the TF HCL code.
⚠️ this feature may make the multi-state feature less obvious
Example
We should dig into this and think about it with terraform code as a potential IaC source in mind. This is something potentially bigger than it looks
Consider also the same configurations can be given via terraform Environment variables too. Which is how I mainly use terraform (backend bucket config is an env var)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This was done in #1555