Downloading and Uploading the State File
Explore how to use Terraform's state pull and push commands to manage infrastructure state files. Understand the syntax, use cases, and safety checks involved in downloading state from remote backends and uploading local state files, enabling you to handle Terraform state files confidently and securely.
The pull subcommand
The terraform state pull command is used to manually download and output the state from a remote backend. This command also works with the local back-end.
Syntax
The pull subcommand has the following syntax: terraform state pull [options].
This command is equivalent to viewing the contents of the Terraform state directly, in a read-only mode. The output of the command is sent in JSON format. Let’s run the following command to send the output in JSON format:
cp ...