From c2c5668a8d8e1925d445e1d2aca1d4f9e7182414 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 13 Dec 2016 21:53:02 -0800 Subject: [PATCH] config: Append supports `terraform` --- config/append.go | 5 +++++ config/append_test.go | 31 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/config/append.go b/config/append.go index bf13534e7..a421df4a0 100644 --- a/config/append.go +++ b/config/append.go @@ -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)) diff --git a/config/append_test.go b/config/append_test.go index 8d6258ecd..aecb80e66 100644 --- a/config/append_test.go +++ b/config/append_test.go @@ -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 {