config: bare splat variables should not be allowed in provisioners
[GH-636]
This commit is contained in:
parent
72a35cb44a
commit
4bcf6cf6b2
|
@ -465,6 +465,13 @@ func (c *Config) rawConfigs() map[string]*RawConfig {
|
||||||
source := fmt.Sprintf("resource '%s'", rc.Id())
|
source := fmt.Sprintf("resource '%s'", rc.Id())
|
||||||
result[source+" count"] = rc.RawCount
|
result[source+" count"] = rc.RawCount
|
||||||
result[source+" config"] = rc.RawConfig
|
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 {
|
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) {
|
func TestConfigValidate_varMultiFunctionCall(t *testing.T) {
|
||||||
c := testConfig(t, "validate-var-multi-func")
|
c := testConfig(t, "validate-var-multi-func")
|
||||||
if err := c.Validate(); err != nil {
|
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