github.com/pulumi/terraform@v1.4.0/website/docs/cli/commands/state/push.mdx (about)

     1  ---
     2  page_title: 'Command: state push'
     3  description: The `terraform state push` command pushes items to the Terraform state.
     4  ---
     5  
     6  # Command: state push
     7  
     8  The `terraform state push` command is used to manually upload a local
     9  state file to [remote state](/language/state/remote). This command also
    10  works with local state.
    11  
    12  This command should rarely be used. It is meant only as a utility in case
    13  manual intervention is necessary with the remote state.
    14  
    15  ## Usage
    16  
    17  Usage: `terraform state push [options] PATH`
    18  
    19  This command pushes the state specified by PATH to the currently
    20  configured [backend](/language/settings/backends/configuration).
    21  
    22  If PATH is "-" then the state data to push is read from stdin. This data
    23  is loaded completely into memory and verified prior to being written to
    24  the destination state.
    25  
    26  -> **Note:** Terraform state files must be in UTF-8 format without a byte order mark (BOM). For PowerShell on Windows, use `Set-Content` to automatically encode files in UTF-8 format. For example, run `terraform state push | sc terraform.tfstate`.
    27  
    28  Terraform will perform a number of safety checks to prevent you from
    29  making changes that appear to be unsafe:
    30  
    31  - **Differing lineage**: If the "lineage" value in the state differs,
    32    Terraform will not allow you to push the state. A differing lineage
    33    suggests that the states are completely different and you may lose
    34    data.
    35  
    36  - **Higher remote serial**: If the "serial" value in the destination state
    37    is higher than the state being pushed, Terraform will prevent the push.
    38    A higher serial suggests that data is in the destination state that isn't
    39    accounted for in the local state being pushed.
    40  
    41  Both of these safety checks can be disabled with the `-force` flag.
    42  **This is not recommended.** If you disable the safety checks and are
    43  pushing state, the destination state will be overwritten.
    44  
    45  For configurations using the [Terraform Cloud CLI integration](/cli/cloud) or the [`remote` backend](/language/settings/backends/remote)
    46  only, `terraform state push`
    47  also accepts the option
    48  [`-ignore-remote-version`](/cli/cloud/command-line-arguments#ignore-remote-version).