cli
cli copied to clipboard
Additional state file detection for terraform state pull cases
Feature Request
Feature description :
While running against state
files instead of plan
files, terraform-compliance
runs if the state file is created via ;
terraform show -json > state.out.json
or
terraform state pull > state.out && terraform show -json state.out > state.out.json
Since the latter could be a functionality within the tool, it would be nice if we just implement it.
The issue is also described in #223
I'm getting an error running against both of these right now.
Macos Catalina terraform-compliance v1.2.7
$ terraform-compliance -p state.out
# ERROR: state.out is not a valid terraform plan json output.
$ terraform-compliance -p state.out.json
# ERROR: state.out.json is not a valid terraform plan json output.
Can I have your state file if possible @kjr247 ?
I believe this and #305 are describing the same issue.
For my use case at least, it would be really helpful if TC could run directly on state files instead of needing to pass them through terraform show
.
Terraform 0.13.5 terrafrom-compliance 1.3.8
For some reason helped to use:
terraform plan -out plan.out
terraform show -json plan.out > plan.out.json
terraform-compliance -f tests -p plan.out.json
instead of terraform state pull > state.out && terraform show -json state.out > state.out.json
in the meantime i think it would help to update the docs here to indicate to use terraform show -json > state.out.json
instead of terraform state pull
https://terraform-compliance.com/pages/usage/#-p--planfile
related here too https://github.com/terraform-compliance/cli/issues/305