config: Append supports `terraform`

This commit is contained in:
Mitchell Hashimoto 2016-12-13 21:53:02 -08:00
parent 3878b8b093
commit c2c5668a8d
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
2 changed files with 36 additions and 0 deletions

View File

@ -35,6 +35,11 @@ func Append(c1, c2 *Config) (*Config, error) {
c.Atlas = c2.Atlas
}
c.Terraform = c1.Terraform
if c2.Terraform != nil {
c.Terraform = c2.Terraform
}
if len(c1.Modules) > 0 || len(c2.Modules) > 0 {
c.Modules = make(
[]*Module, 0, len(c1.Modules)+len(c2.Modules))

View File

@ -87,6 +87,37 @@ func TestAppend(t *testing.T) {
false,
},
// Terraform block
{
&Config{
Terraform: &Terraform{
RequiredVersion: "A",
},
},
&Config{},
&Config{
Terraform: &Terraform{
RequiredVersion: "A",
},
},
false,
},
{
&Config{},
&Config{
Terraform: &Terraform{
RequiredVersion: "A",
},
},
&Config{
Terraform: &Terraform{
RequiredVersion: "A",
},
},
false,
},
}
for i, tc := range cases {