github.com/kcburge/terraform@v0.11.12-beta1/website/upgrade-guides/0-10.html.markdown (about)

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