github.com/iaas-resource-provision/iaas-rpc@v1.0.7-0.20211021023331-ed21f798c408/website/docs/cli/commands/0.13upgrade.html.md (about) 1 --- 2 layout: "docs" 3 page_title: "Command: 0.13upgrade" 4 sidebar_current: "docs-commands-013upgrade" 5 description: |- 6 The 0.13upgrade subcommand updates existing configurations to use the new provider source features from Terraform 0.13. 7 --- 8 9 # Command: 0.13upgrade 10 11 The `terraform 0.13upgrade` command updates existing configuration to add an 12 explicit `source` attribute for each provider used in a given module. The 13 provider source settings are stored in a `required_providers` block. 14 15 -> **This command is available only in Terraform v0.13 releases.** For more information, see [the Terraform v0.13 upgrade guide](https://www.terraform.io/upgrade-guides/0-13.html). 16 17 ## Usage 18 19 Usage: `terraform 0.13upgrade [options] [dir]` 20 21 The primary purpose of the `0.13upgrade` command is to determine which 22 providers are in use for a module, detect the source address for those 23 providers where possible, and record this information in a 24 [`required_providers` block][required-providers]. 25 26 [required-providers]: /docs/language/providers/requirements.html 27 28 ~> Note: the command ignores `.tf.json` files and override files in the module. 29 30 If the module already has a `required_providers` block, the command updates it 31 in-place. Otherwise, a new block is added to the `versions.tf` file. 32 33 By default, `0.13upgrade` changes configuration files in the current working 34 directory. However, you can provide an explicit path to another directory if 35 desired, which may be useful for automating migrations of several modules in 36 the same repository. 37 38 When run with no other options, the command will first explain what it is 39 going to do and prompt for confirmation: 40 41 ``` 42 $ terraform 0.13upgrade 43 44 This command will update the configuration files in the given directory to use 45 the new provider source features from Terraform v0.13. It will also highlight 46 any providers for which the source cannot be detected, and advise how to 47 proceed. 48 49 We recommend using this command in a clean version control work tree, so that 50 you can easily see the proposed changes as a diff against the latest commit. 51 If you have uncommited changes already present, we recommend aborting this 52 command and dealing with them before running this command again. 53 54 Would you like to upgrade the module in the current directory? 55 Only 'yes' will be accepted to confirm. 56 57 Enter a value: yes 58 ``` 59 60 We recommend running this command with a clean version control work tree so 61 that you can use VCS tools to review the proposed changes, including any 62 `TF-UPGRADE-TODO` comments, and make any revisions required before committing 63 the change. 64 65 There is one command-line option: 66 67 * `-yes` - Skip the initial introduction messages and interactive confirmation. 68 Use this when running the command in batch from a script. 69 70 ## Batch Usage 71 72 After you've experimented with the `0.13upgrade` command in some confined 73 situations, if you have a repository containing multiple modules you may 74 wish to batch-upgrade them all and review them together. Recursive upgrades 75 are not supported by the tool itself, but if you are on a Unix-style system 76 you can achieve this using the `find` command as follows: 77 78 ``` 79 $ find . -name '*.tf' | xargs -n1 dirname | uniq | xargs -n1 terraform 0.13upgrade -yes 80 ``` 81 82 On a Windows system with PowerShell, you can use this command: 83 84 ``` 85 Get-Childitem -Recurse -Include *.tf | Split-Path | ` 86 Select-Object -Unique | ForEach-Object { terraform 0.13upgrade -yes $_.FullName } 87 ``` 88 89 Note that the above commands include the `-yes` option to override the 90 interactive prompt, so be sure you have a clean work tree before running it.