Commit Graph

378 Commits

Author SHA1 Message Date
Mitchell Hashimoto
461f6557c7 config: fix test error 2015-06-23 22:30:41 -07:00
Mitchell Hashimoto
fafc32b183 Merge branch 'b-prevent-destroy-type' 2015-06-23 22:29:54 -07:00
Paul Hinze
c154ef9558 Merge pull request #1790 from TimeIncOSS/combine-func
config: Add support for lists to concat
2015-06-23 15:41:59 -05:00
Sander van Harmelen
c62370f9e9 Add a function to load JSON directly
Without this 12 line function it’s impossible to use any of the
Terraform code without the need for having the files on disk. As more
and more people are using (parts of) Terraform in other software, this
seems to be a very welcome addition. It has no negative impact on
Terraform itself whatsoever (the function is never called), but it
opens up a lot of other use cases.

Next to the single new function, I renamed the existing function (and
related tests) to better reflect what the function does. So now there
is a `LoadDir` function which calls `LoadFile` for each file, which
kind of made sense to me, especially when now adding a `LoadJSON`
function as well.

But of course if the rename is a problem, I can revert that part as
it’s not related to the added `LoadJSON` function.

Thanks!
2015-06-23 16:15:26 +02:00
Radek Simko
6a60fa4bfe config: concat function supports lists (combines more lists into one) 2015-06-13 08:54:01 +01:00
Radek Simko
e9e41dfd05 Improve test error messages 2015-06-13 08:54:01 +01:00
Radek Simko
841a1f08da Sort functions by name alphabetically 2015-06-13 08:54:01 +01:00
Mitchell Hashimoto
aa1e66c16c config: parse lifecycle block with mapstructure for weak decode 2015-06-07 22:04:23 -07:00
Paul Hinze
b781c6c446 core: keys() and values() funcs for map variables
they work on maps with both keys and values that are string types, which
AFAICT are the only types of maps we have right now.

closes #1915
2015-06-02 16:49:51 -05:00
Sam Boyer
b82bd0c280 Condense switch fallthroughs into expr lists 2015-05-26 21:52:36 -04:00
Josh Bleecher Snyder
02e751e356 config: add formatlist
formatlist distributes formatting over lists.
See the docs for details.

As a colleague commented:

"It happens all the time that we want a set of
outputs, but in a slightly different way than
just simple joining or concatting."

formatlist (combined with join)
makes it easy to satisfy those needs.
2015-05-12 16:11:42 -07:00
Josh Bleecher Snyder
a3f79cd790 config: fix minor comment errors 2015-05-12 16:11:19 -07:00
Mitchell Hashimoto
1099e3f59f config: add module raw configs to InterpolatedConfigs [GH-1448] 2015-04-29 17:12:28 -07:00
Mitchell Hashimoto
cca4964552 config: error in validation if module has self variable 2015-04-22 10:39:07 +02:00
Mitchell Hashimoto
d0a6d78b97 config: test that resources reference good providers 2015-04-20 14:47:31 -07:00
Mitchell Hashimoto
8ee18e2e14 config: happy case test for multiple providers 2015-04-20 14:27:44 -07:00
Mitchell Hashimoto
a599d5f224 config: validate that a multi provider is only configured once each 2015-04-20 14:25:33 -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
Paul Hinze
afe4abb637 core: add prevent_destroy lifecycle flag
When the `prevent_destroy` flag is set on a resource, any plan that
would destroy that resource instead returns an error. This has the
effect of preventing the resource from being unexpectedly destroyed by
Terraform until the flag is removed from the config.
2015-04-17 10:40:04 -05:00
Paul Hinze
5874fa06ff Merge pull request #1495 from TimeIncOSS/length-func
config: Add length to built-in functions
2015-04-15 11:54:46 -05:00
Paul Hinze
975a96f271 core: protect against count.index in modules
Modules should get a validation error just like outputs do.

refs #1528
2015-04-15 10:41:56 -05:00
Paul Hinze
347690a73e core: don't crash when count.index is used in the wrong context
It's bad manners! :)

Also adds a validation error up at the configuration layer so the user
sees the case from #1528 as an error message.

fixes #1528
2015-04-15 10:23:53 -05:00
Radek Simko
6a720d087c length added to built-in functions 2015-04-15 16:20:11 +01:00
Mitchell Hashimoto
0ff39a3773 config/lang: support math on variables through implicits 2015-04-14 09:09:18 -07:00
Radek Simko
8eb6984a89 Test helpers to print expected output 2015-04-13 14:12:43 +01:00
Mitchell Hashimoto
6514bf5f25 config: clarify unknown variable error [GH-1480] 2015-04-10 16:45:15 -07:00
Mitchell Hashimoto
06beab6fd8 config: copy the key on Copy 2015-04-09 09:31:04 -07:00
Mitchell Hashimoto
b201983304 terraform: copy RawConfigs 2015-04-09 09:21:38 -07:00
Mitchell Hashimoto
aab7bc0da5 config/module: rename parameters 2015-04-07 17:07:50 -07:00
Mitchell Hashimoto
2378160803 config/module: determine storage folder by path 2015-04-07 16:44:24 -07:00
Mitchell Hashimoto
f084d8d932 config/module: store the path with the module 2015-04-07 16:37:46 -07:00
Paul Hinze
766b4902d4 remove extraneous var declaration
just a go nitpick :)
2015-03-30 19:03:01 -05:00
7heo
a6411626bf config: interprets '~' as the current user home dir in file() 2015-03-31 01:52:39 +02:00
Mitchell Hashimoto
44fce5ce60 config/module: remove debug 2015-03-26 09:31:58 -07:00
Mitchell Hashimoto
2e11ca68df config/module: go back to the original folder when doing parent
references
2015-03-26 09:30:32 -07:00
Mitchell Hashimoto
bd4aaac71a config/module: failing unit test for GH-1232 2015-03-26 09:11:32 -07:00
Mitchell Hashimoto
fdded8ca14 config: allow atlas block 2015-03-24 13:30:22 -07:00
Mitchell Hashimoto
f84ae29cf8 config: isTemporaryFile -> isIgnoredFile 2015-03-19 09:51:14 +01:00
Radek Simko
f794f30b7d Ignore hidden files per Unix conventions 2015-03-18 07:50:33 +00:00
Mitchell Hashimoto
23609a7af5 Merge pull request #1096 from hashicorp/f-sprintf
config: add "format' function [GH-758]
2015-03-04 16:05:25 -08:00
Mitchell Hashimoto
9e50bf76c7 config/lang: test case for multiline lang 2015-03-02 23:31:49 -08:00
Mitchell Hashimoto
b39ddc7d47 config: add format function 2015-03-02 10:26:06 -08:00
Mitchell Hashimoto
63ee4c83ab config: only regexp if at least two characters in replace search 2015-03-02 09:46:46 -08:00
Mitchell Hashimoto
5895494897 config: test bad regexp for replace 2015-03-02 09:44:45 -08:00
Mitchell Hashimoto
2f33a24385 config: add replace function 2015-03-02 09:37:40 -08:00
Mitchell Hashimoto
5e25dc54a7 config: if any var is computed, the entire interpolation is computed 2015-02-27 22:47:43 -08:00
Mitchell Hashimoto
2feaebdca5 config: substring containing computed value replaces element 2015-02-27 21:51:14 -08:00
Mitchell Hashimoto
5848cba6ad config/lang: add modulo 2015-02-26 15:17:37 -08:00
Mitchell Hashimoto
3c4a036fb5 config/lang: add (expr) for order of ops 2015-02-26 14:39:04 -08:00
Mitchell Hashimoto
6750318bb5 config/lang: add test with expressions 2015-02-26 14:34:45 -08:00