Explain list-type variables, and their use
This commit is contained in:
parent
f1f3c1d040
commit
ccb07f6e52
|
@ -56,7 +56,8 @@ the AWS provider with the given variables.
|
|||
## Assigning Variables
|
||||
|
||||
There are multiple ways to assign variables. Below is also the order
|
||||
in which variable values are chosen. The following is the descending order of precedence in which variables are considered.
|
||||
in which variable values are chosen. The following is the descending order
|
||||
of precedence in which variables are considered.
|
||||
|
||||
#### Command-line flags
|
||||
|
||||
|
@ -109,6 +110,8 @@ $ terraform plan \
|
|||
-var-file="secret.tfvars" \
|
||||
-var-file="production.tfvars"
|
||||
```
|
||||
-> **Note**: Environment variables can only populate string-type variables.
|
||||
List and map type variables must be populated via one of the other mechanisms.
|
||||
|
||||
#### UI Input
|
||||
|
||||
|
@ -126,6 +129,23 @@ If no value is assigned to a variable via any of these methods and the
|
|||
variable has a `default` key in its declaration, that value will be used
|
||||
for the variable.
|
||||
|
||||
<a id="lists"></a>
|
||||
## Lists
|
||||
|
||||
Lists are defined either explicitly or implicity
|
||||
```
|
||||
# implicitly by using brackets [...]
|
||||
variable "cidrs" { default = [] }
|
||||
|
||||
# explicitly
|
||||
variable "cidrs" { type = "list" }
|
||||
```
|
||||
|
||||
You can specify lists in a `terraform.tfvars` file:
|
||||
```
|
||||
cidrs = [ "10.0.0.0/16", "10.1.0.0/16" ]
|
||||
```
|
||||
|
||||
<a id="mappings"></a>
|
||||
<a id="maps"></a>
|
||||
## Maps
|
||||
|
|
Loading…
Reference in New Issue