Commit Graph

337 Commits

Author SHA1 Message Date
Mitchell Hashimoto 9e50bf76c7 config/lang: test case for multiline lang 2015-03-02 23:31:49 -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
Mitchell Hashimoto 9ddcaf15eb config/lang: fix shift/reduce conflict 2015-02-26 14:33:56 -08:00
Mitchell Hashimoto 07b78fdf84 config/lang: math operations 2015-02-26 14:26:14 -08:00
Mitchell Hashimoto 684228e371 config/lang: add math operations for ints 2015-02-26 11:32:39 -08:00
Mitchell Hashimoto cab2e408d2 config/module: retry bitbucket test a few times [GH-1027] 2015-02-23 15:24:24 -08:00
Mitchell Hashimoto 965fe45b9e config: self var validation 2015-02-23 14:43:14 -08:00
Mitchell Hashimoto 9c612964d8 config: self variables 2015-02-23 14:34:25 -08:00
Mitchell Hashimoto a31f2a276b Merge pull request #1015 from hashicorp/b-depends-on-var
config: depends on cannot contain interpolations [GH-985]
2015-02-23 13:49:34 -08:00
Mitchell Hashimoto 87ecf4f40d Merge pull request #1016 from hashicorp/b-splat-validate
config: provisioner splat vars can only reference other resources
2015-02-23 13:48:40 -08:00
Mitchell Hashimoto 45a267111b Merge pull request #885 from brycekahle/split-func
config: add split function
2015-02-20 13:45:01 -08:00
Mitchell Hashimoto c14e84a657 config: validate provisioner splats can only reference others 2015-02-20 09:21:29 -08:00
Mitchell Hashimoto f156d0d1bd config: test we can ref splat of other resources 2015-02-20 09:19:13 -08:00
Mitchell Hashimoto 90a6a627ed config: validate configuration doens't contain splats to ourselves 2015-02-20 09:18:08 -08:00
Mitchell Hashimoto 0e7b150c5b config: depends on cannot contain interpolations [GH-985] 2015-02-20 09:07:41 -08:00
Mitchell Hashimoto 0a68576746 config: add RawConfig.Merge 2015-02-19 12:07:59 -08:00
Mitchell Hashimoto 4bcf6cf6b2 config: bare splat variables should not be allowed in provisioners
[GH-636]
2015-02-17 13:32:45 -08:00
Emil Hessman e7bbbfb098 helper/url: add Windows 'safe' URL Parse wrapper
Pull out the urlParse function, which was introduced in config/module,
into a helper package.
2015-02-05 11:16:54 +01:00
Emil Hessman a8db835a44 config/module: fix HgGetter test failures on Windows
HgGetter tests failed on windows/amd64 using Mercurial version 3.2.4:

--- FAIL: TestHgGetter (0.11s)
        get_hg_test.go:35: err: C:\Program Files\Mercurial\hg.exe exited with 255: abort: file:// URLs can only refer to localhost
--- FAIL: TestHgGetter_branch (0.11s)
        get_hg_test.go:62: err: C:\Program Files\Mercurial\hg.exe exited with 255: abort: file:// URLs can only refer to localhost
FAIL
FAIL    github.com/hashicorp/terraform/config/module    5.615s

This commit fixes the failures by adjusting the file:// URL to a form that
Mercurial expects.
2015-02-02 19:49:57 +01:00
Emil Hessman 5bbfc0d4e2 config/module: fix URL file path handling on Windows
Only adjust the URL Scheme when parsing drive letter file paths on
Windows, don't add a file scheme prefix.
FileDetector is responsible for adding the file scheme prefix.
2015-02-02 12:19:34 +01:00
Mitchell Hashimoto 2d9dd25493 config/module: fix regression of ignoring forced type if valid URL
/cc @ceh - Does this break Windows at all? This regressed with your
commit (we didn't have test coverage on it). I added a test now, though.
2015-02-01 20:17:56 +01:00
Bryce Kahle adccaad252 Add split function 2015-01-28 16:59:16 -05:00
Emil Hessman 97227a5c70 config/module: fix detection of file paths on Windows
Absolute file paths were not correctly detected by module.Detect
when using url.Parse to parse the source URL. Wrap the detection
with urlParse to properly handle file path detections on Windows.

Fixes command test failures on Windows.
2015-01-28 10:40:32 +01:00
Emil Hessman 65177edd1e config/module: fix test failures on Windows
When parsing URLs on Windows, assume it is a drive letter path
if the second element is a ':' character. Format the drive letter
path as a "file:///"-path prior to parsing the URL.

Fixes test failures of the following form in command on Windows:

=== RUN TestApply_plan
--- FAIL: TestApply_plan (0.00s)
        apply_test.go:379: bad: 1

		module download not supported for scheme 'c'
2015-01-28 08:19:04 +01:00
Emil Hessman d5a49363d7 config/module: handle absolute file paths on Windows
Using url.Parse to parse an absolute file path on Windows yields
a URL type where the Path element is prefixed by a slash.

For example, parsing "file:///C:/Users/user" gives a URL type
with Path:"/C:/Users/user".

According to golang.org/issue/6027, the parsing is correct as is.

The leading slash on the Path must be eliminated before any file
operations.

This commit introduces a urlParse function which wraps the url.Parse
functionality and removes the leading slash in Path for absolute file
paths on Windows.

Fixes config/module test failures on Windows.
2015-01-27 23:18:47 +01:00
Emil Hessman 78d1fc742f config/module: adjust HttpGetter test to fix Windows test failure
Specify laddr on the form host:port in the call to net.Listen as
documented for net.Dial, see godoc.org/net#Dial

Fixes the following test failures on Windows:

> go test -run=TestHttpGetter
--- FAIL: TestHttpGetter_header (0.00s)
        get_http_test.go:31: err: Get http://[::]:52101/header?terraform-get=1: dial tcp [::]:52101: ConnectEx tcp: The requested address is not valid in its context.
--- FAIL: TestHttpGetter_meta (0.00s)
        get_http_test.go:55: err: Get http://[::]:52103/meta?terraform-get=1: dial tcp [::]:52103: ConnectEx tcp: The requested address is not valid in its context.
--- FAIL: TestHttpGetter_metaSubdir (0.00s)
        get_http_test.go:79: err: Get http://[::]:52105/meta-subdir?terraform-get=1: dial tcp [::]:52105: ConnectEx tcp: The requested address is not valid in its context.
FAIL
exit status 1
FAIL github.com/hashicorp/terraform/config/module    0.054s
2015-01-27 23:18:46 +01:00
Emil Hessman 74cf8fcabd config/module: adjust FileDetector tests for Windows
"/foo" is not an absolute path on Windows. Adjust the FileDetector
tests to take that into account when verifying the results.

Fixes FileDetector test failures on Windows.
2015-01-27 23:18:46 +01:00
Emil Hessman 160e4f926e config/module: fix panic on Windows when running tests
On Windows, Go returns paths with the `\` path separator.
Make sure we are using `/` even on Windows since URLs are `/`-based.
2015-01-27 07:52:51 +01:00
Mitchell Hashimoto 63344a37c6 config/lang: verify single quotes syntax error [GH-613] 2015-01-16 10:28:00 -08:00
Mitchell Hashimoto 91a3405e88 config: understand provisioner blocks in JSON [GH-807] 2015-01-16 10:14:48 -08:00
Mitchell Hashimoto 7f9abbb99c config/lang; missed file 2015-01-15 09:40:36 -08:00
Mitchell Hashimoto a2e40ad731 config: multi-variable access in slice validation fixed [GH-798] 2015-01-15 09:40:13 -08:00
Mitchell Hashimoto 2abeb2d9ac config: use new API 2015-01-14 22:03:15 -08:00
Mitchell Hashimoto 61ee63d842 config/lang/ast: remove unused Eval 2015-01-14 21:49:39 -08:00
Mitchell Hashimoto 8d2c60a8af config/lang: eval 2015-01-14 21:48:20 -08:00
Mitchell Hashimoto 4302dbaf2a config/lang: make TypeCheck implementable by other nodes 2015-01-14 21:18:22 -08:00
Mitchell Hashimoto 57adfe53f6 config/lang: use the new AST stuff 2015-01-14 20:58:46 -08:00
Mitchell Hashimoto c96b3b9ddc config/lang/ast: Eval 2015-01-14 20:37:16 -08:00
Mitchell Hashimoto c4273974de config/lang/ast: introduce Type 2015-01-14 20:13:35 -08:00
Mitchell Hashimoto 342b4d2d9f config/lang: proper filename 2015-01-14 16:36:42 -08:00
Mitchell Hashimoto 1e79861b84 config/lang/ast: AST transforms are built-in 2015-01-14 16:36:01 -08:00
Mitchell Hashimoto d3c0543bf3 Merge pull request #797 from hashicorp/f-stronger-types
Force variables to be typed (internally)
2015-01-14 15:30:38 -08:00
Emil Hessman 482460c4c8 config/lang: address vet reports
Fixes the following vet reports:

config/lang/check_types.go:98: arg n for printf verb %d of wrong type: *github.com/hashicorp/terraform/config/lang/ast.Concat
config/lang/lex.go:80: arg x.mode for printf verb %s of wrong type: lang.parserMode
2015-01-14 22:04:28 +01:00