github.com/hugorut/terraform@v1.1.3/website/docs/language/upgrade-guides/0-10.mdx (about)

     1  ---
     2  page_title: Upgrading to Terraform 0.10
     3  description: Upgrading to Terraform v0.10
     4  ---
     5  
     6  # Upgrading to Terraform v0.10
     7  
     8  Terraform v0.10 is a major release and thus includes some changes that
     9  you'll need to consider when upgrading. This guide is intended to help with
    10  that process.
    11  
    12  The goal of this guide is to cover the most common upgrade concerns and
    13  issues that would benefit from more explanation and background. The exhaustive
    14  list of changes will always be the
    15  [Terraform Changelog](https://github.com/hugorut/terraform/blob/main/CHANGELOG.md).
    16  After reviewing this guide, we recommend reviewing the Changelog to check on
    17  specific notes about the resources and providers you use.
    18  
    19  This guide focuses on changes from v0.9 to v0.10. Each previous major release
    20  has its own upgrade guide, so please consult the other guides (available
    21  in the navigation) if you are upgrading directly from an earlier version.
    22  
    23  ## Separated Provider Plugins
    24  
    25  As of v0.10, provider plugins are no longer included in the main Terraform
    26  distribution. Instead, they are distributed separately and installed
    27  automatically by
    28  [the `terraform init` command](/cli/commands/init).
    29  
    30  In the long run, this new approach should be beneficial to anyone who wishes
    31  to upgrade a specific provider to get new functionality without also
    32  upgrading another provider that may have introduced incompatible changes.
    33  In the short term, it just means a smaller distribution package and thus
    34  avoiding the need to download tens of providers that may never be used.
    35  
    36  Provider plugins are now also versioned separately from Terraform itself.
    37  [Version constraints](/language/providers/configuration#provider-versions)
    38  can be specified in configuration to ensure that new major releases
    39  (which may have breaking changes) are not automatically installed.
    40  
    41  **Action:** After upgrading, run `terraform init` in each Terraform
    42  configuration working directory to install the necessary provider plugins.
    43  If running Terraform in automation, this command should be run as the first
    44  step after a Terraform configuration is cloned from version control, and
    45  will also install any necessary modules and configure any remote backend.
    46  
    47  **Action:** For "production" configurations, consider adding
    48  [provider version constraints](/language/providers/configuration#provider-versions),
    49  as suggested by the `terraform init` output, to prevent new major versions
    50  of plugins from being automatically installed in future.
    51  
    52  ### Third-party Provider Plugins
    53  
    54  This initial release of separated provider plugins applies only to the
    55  providers that are packaged and released by Hashicorp. The goal is to
    56  eventually support a similar approach for third-party plugins, but we wish
    57  to ensure the robustness of the installation and versioning mechanisms before
    58  generalizing this feature.
    59  
    60  -> **Note:** As of Terraform 0.13, Terraform can automatically install
    61  third-party providers released on the Terraform Registry.
    62  
    63  In the mean time, third-party providers can be installed by placing them in the
    64  user plugins directory:
    65  
    66  | Operating system  | User plugins directory          |
    67  | ----------------- | ------------------------------- |
    68  | Windows           | `%APPDATA%\terraform.d\plugins` |
    69  | All other systems | `~/.terraform.d/plugins`        |
    70  
    71  Maintainers of third-party providers may optionally
    72  make use of the new versioning mechanism by naming provider binaries
    73  using the scheme `terraform-provider-NAME_v0.0.1`, where "0.0.1" is an
    74  example version. Terraform expects providers to follow the
    75  [semantic versioning](http://semver.org/) methodology.
    76  
    77  Although third-party providers with versions cannot currently be automatically
    78  installed, Terraform 0.10 _will_ verify that the installed version matches the
    79  constraints in configuration and produce an error if an acceptable version
    80  is unavailable.
    81  
    82  **Action:** No immediate action required, but third-party plugin maintainers
    83  may optionally begin using version numbers in their binary distributions to
    84  help users deal with changes over time.
    85  
    86  ## Recursive Module Targeting with `-target`
    87  
    88  It is possible to target all of the resources in a particular module by passing
    89  a module address to the `-target` argument:
    90  
    91  ```
    92  $ terraform plan -out=tfplan -target=module.example
    93  ```
    94  
    95  Prior to 0.10, this command would target only the resources _directly_ in
    96  the given module. As of 0.10, this behavior has changed such that the above
    97  command also targets resources in _descendent_ modules.
    98  
    99  For example, if `module.example` contains a module itself, called
   100  `module.examplechild`, the above command will target resources in both
   101  `module.example` _and_ `module.example.module.examplechild`.
   102  
   103  This also applies to other Terraform features that use
   104  [resource addressing](/cli/state/resource-addressing) syntax.
   105  This includes some of the subcommands of
   106  [`terraform state`](/cli/commands/state).
   107  
   108  **Action:** If running Terraform with `-target` in automation, review usage
   109  to ensure that selecting additional resources in child modules will not have
   110  ill effects. Be sure to review plan output when `-target` is used to verify
   111  that only the desired resources have been targeted for operations. Please
   112  note that it is not recommended to routinely use `-target`; it is provided for
   113  exceptional uses and manual intervention.
   114  
   115  ## Interactive Approval in `terraform apply`
   116  
   117  Starting with Terraform 0.10 `terraform apply` has a new mode where it will
   118  present the plan, pause for interactive confirmation, and then apply the
   119  plan only if confirmed. This is intended to get similar benefits to separately
   120  running `terraform plan`, but to streamline the workflow for interactive
   121  command-line use.
   122  
   123  For 0.10 this feature is disabled by default, to avoid breaking any wrapper
   124  scripts that are expecting the old behavior. To opt-in to this behavior,
   125  pass `-auto-approve=false` when running `terraform apply` without an explicit
   126  plan file.
   127  
   128  It is planned that a future version of Terraform will make this behavior the
   129  default. Although no immediate action is required, we strongly recommend
   130  adjusting any Terraform automation or wrapper scripts to prepare for this
   131  upcoming change in behavior, in the following ways:
   132  
   133  * Non-interative automation around production systems should _always_
   134    separately run `terraform plan -out=tfplan` and then (after approval)
   135    `terraform apply tfplan`, to ensure operators have a chance to review
   136    the plan before applying it.
   137  
   138  * If running `terraform apply` _without_ a plan file in automation for
   139    a _non-production_ system, add `-auto-approve=true` to the command line
   140    soon, to preserve the current 0.10 behavior once auto-approval is no longer
   141    enabled by default.
   142  
   143  We are using a staged deprecation for this change because we are aware that
   144  many teams use Terraform in wrapper scripts and automation, and we wish to
   145  ensure that such teams have an opportunity to update those tools in preparation
   146  for the future change in behavior.
   147  
   148  **Action:** 0.10 preserves the previous behavior as the default, so no
   149  immediate action is required. However, maintainers of tools that wrap
   150  Terraform, either in automation or in alternative command-line UI, should
   151  consider which behavior is appropriate for their use-case and explicitly
   152  set the `-auto-approve=...` flag to ensure that behavior in future versions.