github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/website/docs/cli/commands/state/replace-provider.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Command: state replace-provider"
     4  sidebar_current: "docs-commands-state-sub-replace-provider"
     5  description: |-
     6    The `terraform state replace-provider` command replaces the provider for resources in the Terraform state.
     7  ---
     8  
     9  # Command: state replace-provider
    10  
    11  The `terraform state replace-provider` command is used to replace the provider
    12  for resources in a [Terraform state](/docs/language/state/index.html).
    13  
    14  ## Usage
    15  
    16  Usage: `terraform state replace-provider [options] FROM_PROVIDER_FQN TO_PROVIDER_FQN`
    17  
    18  This command will update all resources using the "from" provider, setting the
    19  provider to the specified "to" provider. This allows changing the source of a
    20  provider which currently has resources in state.
    21  
    22  This command will output a backup copy of the state prior to saving any
    23  changes. The backup cannot be disabled. Due to the destructive nature
    24  of this command, backups are required.
    25  
    26  This command also accepts the following options:
    27  
    28  * `-auto-approve` - Skip interactive approval.
    29  
    30  * `-lock=false` - Don't hold a state lock during the operation. This is
    31     dangerous if others might concurrently run commands against the same
    32     workspace.
    33  
    34  * `-lock-timeout=0s` - Duration to retry a state lock.
    35  
    36  For configurations using
    37  [the `remote` backend](/docs/language/settings/backends/remote.html)
    38  only, `terraform state replace-provider`
    39  also accepts the option
    40  [`-ignore-remote-version`](/docs/language/settings/backends/remote.html#command-line-arguments).
    41  
    42  For configurations using
    43  [the `local` state rm](/docs/language/settings/backends/local.html) only,
    44  `terraform state replace-provider` also accepts the legacy options
    45  [`-state`, `-state-out`, and `-backup`](/docs/language/settings/backends/local.html#command-line-arguments).
    46  
    47  
    48  ## Example
    49  
    50  The example below replaces the `hashicorp/aws` provider with a fork by `acme`, hosted at a private registry at `registry.acme.corp`:
    51  
    52  ```shell
    53  $ terraform state replace-provider hashicorp/aws registry.acme.corp/acme/aws
    54  ```