Plan storage backends
Terraform Version
1.6.5
Use Cases
When running Terraform in automation, where plan and apply are run on two different machines (PR -> Merge workflow in Github for example), Hashicorp recommend archiving the plan together with the entire working directory, and staging that in remote storage: https://developer.hashicorp.com/terraform/tutorials/automation/automate-terraform?product_intent=terraform#plan-and-apply-on-different-machines However, there are no native tools available in Terraform to do this, even though, the challenge is very similar to backend state storage. The current approach, if doing this in generic CI/CD such as Github Actions is to write a significant amount of custom scripts to handle plan storage.
Attempted Solutions
N/A. No solution is available in Terraform natively.
Proposal
I propose a couple of new constructs in Terraform, that are not too dissimilar to "backends".
terraform {
plan_backend "s3" {
bucket = "mybucket"
key_prefix = "path/to/my/key"
region = "us-east-1"
dynamodb_table = "TableName"
}
}
terraform plan upload --id <id>
terraform plan download --id <id>
References
No response
Thanks for this feature request! If you are viewing this issue and would like to indicate your interest, please use the 👍 reaction on the issue description to upvote this issue. We also welcome additional use case descriptions. Thanks again!