Cleanup of the resources and variables pages

1. Added a heredoc example to the variables page.
2. Tidied up and added headers.
3. Some minor whitespace and grammar edits.
This commit is contained in:
James Turnbull 2016-10-24 20:05:25 +11:00
parent eb20db92cf
commit 0d5f86bd0d
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 resource type in the
[providers section](/docs/providers/index.html). [providers section](/docs/providers/index.html).
### Meta-parameters
There are **meta-parameters** available to all resources: There are **meta-parameters** available to all resources:
* `count` (int) - The number of identical resources to create. * `count` (int) - The number of identical resources to create.
@ -88,7 +90,7 @@ which will match all attribute names. Using a partial string together with a
wildcard (e.g. `"rout*"`) is **not** supported. wildcard (e.g. `"rout*"`) is **not** supported.
------------- ### Connection block
Within a resource, you can optionally have a **connection block**. Within a resource, you can optionally have a **connection block**.
Connection blocks describe to Terraform how to connect to the 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 full list of settings that can be specified are listed on
the [provisioner connection page](/docs/provisioners/connection.html). the [provisioner connection page](/docs/provisioners/connection.html).
------------- ### Provisioners
Within a resource, you can specify zero or more **provisioner Within a resource, you can specify zero or more **provisioner
blocks**. Provisioner blocks configure blocks**. Provisioner blocks configure
@ -129,8 +131,9 @@ You can use the `${count.index}`
[interpolation](/docs/configuration/interpolation.html) along with a map [interpolation](/docs/configuration/interpolation.html) along with a map
[variable](/docs/configuration/variables.html) to accomplish this. [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 For example, here's how you could create three [AWS
address: Instances](/docs/providers/aws/r/instance.html) each with their own
static IP address:
``` ```
variable "instance_ips" { 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 comes from the `alias` field value when configuring the
[provider](/docs/configuration/providers.html). [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 ## 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 **Note**: Default values can be strings, lists, or maps. If a default is
specified, it must match the declared type of the variable. specified, it must match the declared type of the variable.
### Strings
String values are simple and represent a basic key to value String values are simple and represent a basic key to value
mapping where the key is the variable name. An example is: 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 A map allows a key to contain a lookup table. This is useful
for some values that change depending on some external pivot. for some values that change depending on some external pivot.
A common use case for this is mapping cloud images to regions. 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: A list can also be useful to store certain variables. For example:
``` ```