Merge pull request #9540 from jamtur01/varsres

Cleanup of the resources and variables pages
This commit is contained in:
Paul Stack 2016-10-24 15:53:27 +04:00 committed by GitHub
commit 243c662b09
2 changed files with 35 additions and 7 deletions

View File

@ -41,6 +41,8 @@ configuration is dependent on the type, and is documented for each
resource type in the
[providers section](/docs/providers/index.html).
### Meta-parameters
There are **meta-parameters** available to all resources:
* `count` (int) - The number of identical resources to create.
@ -78,7 +80,7 @@ The `lifecycle` block allows the following keys to be set:
~> **NOTE on create\_before\_destroy and dependencies:** Resources that utilize
the `create_before_destroy` key can only depend on other resources that also
include `create_before_destroy`. Referencing a resource that does not include
`create_before_destroy` will result in a dependency graph cycle.
`create_before_destroy` will result in a dependency graph cycle.
~> **NOTE on ignore\_changes:** Ignored attribute names can be matched by their
name, not state ID. For example, if an `aws_route_table` has two routes defined
@ -88,7 +90,7 @@ which will match all attribute names. Using a partial string together with a
wildcard (e.g. `"rout*"`) is **not** supported.
-------------
### Connection block
Within a resource, you can optionally have a **connection block**.
Connection blocks describe to Terraform how to connect to the
@ -103,7 +105,7 @@ but other data must be specified by the user.
The full list of settings that can be specified are listed on
the [provisioner connection page](/docs/provisioners/connection.html).
-------------
### Provisioners
Within a resource, you can specify zero or more **provisioner
blocks**. Provisioner blocks configure
@ -129,8 +131,9 @@ You can use the `${count.index}`
[interpolation](/docs/configuration/interpolation.html) along with a map
[variable](/docs/configuration/variables.html) to accomplish this.
For example, here's how you could create three [AWS Instances](/docs/providers/aws/r/instance.html) each with their own static IP
address:
For example, here's how you could create three [AWS
Instances](/docs/providers/aws/r/instance.html) each with their own
static IP address:
```
variable "instance_ips" {
@ -171,8 +174,15 @@ The value of the field should be `TYPE` or `TYPE.ALIAS`. The `ALIAS` value
comes from the `alias` field value when configuring the
[provider](/docs/configuration/providers.html).
If no `provider` field is specified, the default (provider with no alias)
provider is used.
```
provider "aws" {
alias = "west"
# ...
}
```
If no `provider` field is specified, the default provider is used.
## Syntax

View File

@ -75,6 +75,8 @@ These are the parameters that can be set:
**Note**: Default values can be strings, lists, or maps. If a default is
specified, it must match the declared type of the variable.
### Strings
String values are simple and represent a basic key to value
mapping where the key is the variable name. An example is:
@ -85,6 +87,20 @@ variable "key" {
}
```
A multi-line string value can be provided using heredoc syntax.
```
variable "long_key" {
type = "string"
default = <<EOF
This is a long key.
Running over several lines.
EOF
}
```
### Maps
A map allows a key to contain a lookup table. This is useful
for some values that change depending on some external pivot.
A common use case for this is mapping cloud images to regions.
@ -100,6 +116,8 @@ variable "images" {
}
```
### Lists
A list can also be useful to store certain variables. For example:
```