diff --git a/CHANGELOG.md b/CHANGELOG.md index c1858cda9..b52388145 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ BUG FIXES: * core: Variables are validated to not contain interpolations. [GH-180] * core: Key files for provisioning can now contain `~` and will be expanded to the user's home directory. [GH-179] + * core: The `file()` function can load files in sub-directories. [GH-213] * providers/aws: Fix issues around failing to read EIPs. [GH-122] * providers/aws: Autoscaling groups now register and export load balancers. [GH-207] diff --git a/config/interpolate_walk.go b/config/interpolate_walk.go index 8e3831740..adc656b75 100644 --- a/config/interpolate_walk.go +++ b/config/interpolate_walk.go @@ -11,7 +11,7 @@ import ( // interpRegexp is a regexp that matches interpolations such as ${foo.bar} var interpRegexp *regexp.Regexp = regexp.MustCompile( - `(?i)(\$+)\{([\s*-.,\(\)a-z0-9_"]+)\}`) + `(?i)(\$+)\{([\s*-.,\\/\(\)a-z0-9_"]+)\}`) // interpolationWalker implements interfaces for the reflectwalk package // (github.com/mitchellh/reflectwalk) that can be used to automatically diff --git a/config/interpolate_walk_test.go b/config/interpolate_walk_test.go index ca733c709..53c1659d5 100644 --- a/config/interpolate_walk_test.go +++ b/config/interpolate_walk_test.go @@ -87,6 +87,22 @@ func TestInterpolationWalker_detect(t *testing.T) { }, }, }, + + { + Input: map[string]interface{}{ + "foo": `${file("foo/bar.txt")}`, + }, + Result: []Interpolation{ + &FunctionInterpolation{ + Func: nil, + Args: []Interpolation{ + &LiteralInterpolation{ + Literal: "foo/bar.txt", + }, + }, + }, + }, + }, } for i, tc := range cases {