Commit Graph

21 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
Paul Hinze 47b521ebaf Merge pull request #4745 from hashicorp/b-lifecycle-keys
config: validate lifecycle keys [GH-4413]
2016-01-19 18:24:54 -06:00
Mitchell Hashimoto 8e7b0d90e3 config: detect provisioner-only resource in JSON and error [GH-4385] 2016-01-19 12:19:32 -08:00
Mitchell Hashimoto 99fbb91ba2 config: validate lifecycle keys [GH-4413] 2016-01-19 11:28:45 -08:00
Paul Hinze b6626eed57 config: friendlier error message on resource arity mismatch
closes #2072
2015-12-09 18:05:49 -06:00
Mitchell Hashimoto 13c5fdb154 config: remove debug line 2015-11-07 16:55:07 -08:00
Mitchell Hashimoto 02f512d4bd config: new HCL API 2015-11-07 16:53:42 -08:00
Anthony Scalisi 198e1a5186 remove various typos 2015-09-11 11:56:20 -07:00
Mitchell Hashimoto aa1e66c16c config: parse lifecycle block with mapstructure for weak decode 2015-06-07 22:04:23 -07:00
Matt Good 21b0a03d70 Support for multiple providers of the same type
Adds an "alias" field to the provider which allows creating multiple instances
of a provider under different names. This provides support for configurations
such as multiple AWS providers for different regions. In each resource, the
provider can be set with the "provider" field.

(thanks to Cisco Cloud for their support)
2015-04-20 14:14:34 -07:00
Mitchell Hashimoto fdded8ca14 config: allow atlas block 2015-03-24 13:30:22 -07:00
Mitchell Hashimoto 91a3405e88 config: understand provisioner blocks in JSON [GH-807] 2015-01-16 10:14:48 -08:00
Mitchell Hashimoto 101ac636a2 config: add Config method 2014-10-02 11:34:08 -07:00
Mitchell Hashimoto 8e2315599f config: Count can be a string (for interpolation) 2014-10-02 11:14:50 -07:00
Armon Dadgar 1aaddafba0 terraform: Adding lifecycle config block 2014-09-29 15:20:02 -07:00
Armon Dadgar a14ea76c84 config: Support create_before_destroy config 2014-09-29 15:18:49 -07:00
Mitchell Hashimoto 8dc8eac4bf config: change module syntax 2014-09-14 14:43:54 -07:00
Mitchell Hashimoto 2a6990e2b9 config: `module` structures parse 2014-09-11 15:58:30 -07:00
Mitchell Hashimoto 56cf1e6faa Fix go vet complaints 2014-08-24 21:50:35 -07:00
Mitchell Hashimoto 2fd545bca1 config: use new HCL lib and structure 2014-08-11 21:51:24 -07:00
Mitchell Hashimoto 038cca291e config: HCL loader 2014-08-11 09:58:53 -07:00