github.com/jaredpalmer/terraform@v1.1.0-alpha20210908.0.20210911170307-88705c943a03/website/docs/cli/commands/add.html.md (about) 1 --- 2 layout: "docs" 3 page_title: "Command: add" 4 sidebar_current: "docs-commands-add" 5 description: |- 6 The `terraform add` command generates resource configuration templates. 7 --- 8 9 # Command: add 10 11 The `terraform add` command generates a starting point for the configuration 12 of a particular resource. 13 14 ~> **Warning:** This command is currently experimental. Its exact behavior and 15 command line arguments are likely to change in future releases based on 16 feedback. We don't recommend building automation around the current design of 17 this command, but it's safe to use directly in a development environment 18 setting. 19 20 By default, Terraform will include only the subset of arguments that are marked 21 by the provider as being required, and will use `null` as a placeholder for 22 their values. You can then replace `null` with suitable expressions in order 23 to make the arguments valid. 24 25 If you use the `-optional` option then Terraform will also include arguments 26 that the provider declares as optional. You can then either write a suitable 27 expression for each argument or remove the arguments you wish to leave unset. 28 29 If you use the `-from-state` option then Terraform will instead generate a 30 configuration containing expressions which will produce the same values as 31 the corresponding resource instance object already tracked in the Terraform 32 state, if for example you've previously imported the object using 33 [`terraform import`](import.html). 34 35 -> **Note:** If you use `-from-state`, the result will not include expressions 36 for any values which are marked as sensitive in the state. If you want to 37 see those, you can inspect the state data directly using 38 `terraform state show ADDRESS`. 39 40 ## Usage 41 42 Usage: `terraform add [options] ADDRESS` 43 44 This command requires an address that points to a resource which does not 45 already exist in the configuration. Addresses are in 46 [resource addressing format](/docs/cli/state/resource-addressing.html). 47 48 This command accepts the following options: 49 50 * `-from-state` - Fill the template with values from an existing resource 51 instance already tracked in the state. By default, Terraform will emit only 52 placeholder values based on the resource type. 53 54 * `-optional` - Include optional arguments. By default, the result will 55 include only required arguments. 56 57 * `-out=FILENAME` - Write the template to a file, instead of to standard 58 output. 59 60 * `-provider=provider` - Override the provider configuration for the resource, 61 using the absolute provider configuration address syntax. 62 63 Absolute provider configuration syntax uses the full source address of 64 the provider, rather than a local name declared in the relevant module. 65 For example, to select the aliased provider configuration "us-east-1" 66 of the official AWS provider, use: 67 68 ``` 69 -provider='provider["hashicorp/aws"].us-east-1' 70 ``` 71 72 or, if you are using the Windows command prompt, use Windows-style escaping 73 for the quotes inside the address: 74 75 ``` 76 -provider=provider[\"hashicorp/aws\"].us-east-1 77 ``` 78 79 This is incompatible with `-from-state`, because in that case Terraform 80 will use the provider configuration already selected in the state, which 81 is the provider configuration that most recently managed the object.