Skip to main content

Terraform save remote state locally

Here is how you can run save current remote state to a local file (for backup mostly):

PowerShell
terraform state pull > backup-$(Get-Date -Format "yyyyMMdd-HHmmss").tfstate
bash
terraform state pull > backup-$(date +"%Y%m%d-%H%M%S").tfstate