Commit Graph

8 Commits

Author SHA1 Message Date
James Nugent cb6cb8b96a core: Support explicit variable type declaration
This commit adds support for declaring variable types in Terraform
configuration. Historically, the type has been inferred from the default
value, defaulting to string if no default was supplied. This has caused
users to devise workarounds if they wanted to declare a map but provide
values from a .tfvars file (for example).

The new syntax adds the "type" key to variable blocks:

```
variable "i_am_a_string" {
    type = "string"
}

variable "i_am_a_map" {
    type = "map"
}
```

This commit does _not_ extend the type system to include bools, integers
or floats - the only two types available are maps and strings.

Validation is performed if a default value is provided in order to
ensure that the default value type matches the declared type.

In the case that a type is not declared, the old logic is used for
determining the type. This allows backwards compatiblity with previous
Terraform configuration.
2016-01-24 11:40:02 -06:00
Mitchell Hashimoto 316afd8964 website: update docs with environment variables for vars 2015-04-22 06:37:03 +02:00
Seth Vargo 073a0f76c5 Add meta descriptions to all pages 2014-10-21 23:21:56 -04:00
Mitchell Hashimoto 3cf4f57fe8 website: update docs for new mappings format 2014-08-30 16:20:45 -07:00
Mitchell Hashimoto f7022711c0 website: fix syntax of variables 2014-08-28 09:17:27 -07:00
Alex Gaynor 46154ca1d3 Fixed a ton of typos in docs and comments 2014-08-07 00:19:56 -07:00
Mitchell Hashimoto d28e5a1638 dos2unix 2014-07-28 10:43:00 -07:00
Mitchell Hashimoto c27b2cd9b9 website: providers and variables 2014-07-25 14:51:26 -07:00