Merge pull request #988 from hashicorp/b-prov-multi

config: bare splat variables should not be allowed in provisioners
This commit is contained in:
Mitchell Hashimoto 2015-02-17 16:12:52 -08:00
commit 84e72b817c
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}"
}
}