Skip to content

Commit

Permalink
config: Append supports terraform
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Dec 14, 2016
1 parent 3878b8b commit c2c5668
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config/append.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
31 changes: 31 additions & 0 deletions config/append_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c2c5668

Please sign in to comment.