Merge pull request #988 from hashicorp/b-prov-multi
config: bare splat variables should not be allowed in provisioners
This commit is contained in:
commit
84e72b817c
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
resource "aws_instance" "foo" {
|
||||
count = 3
|
||||
}
|
||||
|
||||
resource "aws_instance" "bar" {
|
||||
provisioner "local-exec" {
|
||||
foo = "${aws_instance.foo.*.id}"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue