config: bare splat variables should not be allowed in provisioners

[GH-636]
This commit is contained in:
Mitchell Hashimoto 2015-02-17 13:32:45 -08:00
parent 72a35cb44a
commit 4bcf6cf6b2
3 changed files with 23 additions and 0 deletions

View File

@ -465,6 +465,13 @@ func (c *Config) rawConfigs() map[string]*RawConfig {
source := fmt.Sprintf("resource '%s'", rc.Id())
result[source+" count"] = rc.RawCount
result[source+" config"] = rc.RawConfig
for i, p := range rc.Provisioners {
subsource := fmt.Sprintf(
"%s provisioner %s (#%d)",
source, p.Type, i+1)
result[subsource] = p.RawConfig
}
}
for _, o := range c.Outputs {

View File

@ -249,6 +249,13 @@ func TestConfigValidate_varMultiNonSlice(t *testing.T) {
}
}
func TestConfigValidate_varMultiNonSliceProvisioner(t *testing.T) {
c := testConfig(t, "validate-var-multi-non-slice-provisioner")
if err := c.Validate(); err == nil {
t.Fatal("should not be valid")
}
}
func TestConfigValidate_varMultiFunctionCall(t *testing.T) {
c := testConfig(t, "validate-var-multi-func")
if err := c.Validate(); err != nil {

View File

@ -0,0 +1,9 @@
resource "aws_instance" "foo" {
count = 3
}
resource "aws_instance" "bar" {
provisioner "local-exec" {
foo = "${aws_instance.foo.*.id}"
}
}