mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-02-22 05:01:22 -05:00
We previously had only very short descriptions of what -ignore-remote-version does due to having the documentation for it inline on many different command pages and -help output. Instead, we'll now centralize the documentation about this argument on the remote backend page, and link to it or refer to it from all other locations. This then allows us to spend more words on discussing what Terraform normally does _without_ this option and warning about the consequences of using it. This continues earlier precedent for some local-backend-specific options which we also don't recommend for typical use. While this does make these options a little more "buried" than before, that feels justified given that they are all "exceptional use only" sort of options where users ought to learn about various caveats before using them. While there I also took this opportunity to fix some earlier omissions with the local-backend-specific options and a few other minor consistency tweaks.
51 lines
1.9 KiB
Markdown
51 lines
1.9 KiB
Markdown
---
|
|
layout: "docs"
|
|
page_title: "Command: state push"
|
|
sidebar_current: "docs-commands-state-sub-push"
|
|
description: |-
|
|
The `terraform state push` command pushes items to the Terraform state.
|
|
---
|
|
|
|
# Command: state push
|
|
|
|
The `terraform state push` command is used to manually upload a local
|
|
state file to [remote state](/docs/language/state/remote.html). This command also
|
|
works with local state.
|
|
|
|
This command should rarely be used. It is meant only as a utility in case
|
|
manual intervention is necessary with the remote state.
|
|
|
|
## Usage
|
|
|
|
Usage: `terraform state push [options] PATH`
|
|
|
|
This command will push the state specified by PATH to the currently
|
|
configured [backend](/docs/language/settings/backends/index.html).
|
|
|
|
If PATH is "-" then the state data to push is read from stdin. This data
|
|
is loaded completely into memory and verified prior to being written to
|
|
the destination state.
|
|
|
|
Terraform will perform a number of safety checks to prevent you from
|
|
making changes that appear to be unsafe:
|
|
|
|
* **Differing lineage**: If the "lineage" value in the state differs,
|
|
Terraform will not allow you to push the state. A differing lineage
|
|
suggests that the states are completely different and you may lose
|
|
data.
|
|
|
|
* **Higher remote serial**: If the "serial" value in the destination state
|
|
is higher than the state being pushed, Terraform will prevent the push.
|
|
A higher serial suggests that data is in the destination state that isn't
|
|
accounted for in the local state being pushed.
|
|
|
|
Both of these safety checks can be disabled with the `-force` flag.
|
|
**This is not recommended.** If you disable the safety checks and are
|
|
pushing state, the destination state will be overwritten.
|
|
|
|
For configurations using
|
|
[the `remote` backend](/docs/language/settings/backends/remote.html)
|
|
only, `terraform state push`
|
|
also accepts the option
|
|
[`-ignore-remote-version`](/docs/language/settings/backends/remote.html#command-line-arguments).
|