Skip to content

Commit

Permalink
Merge pull request #130 from asalkeld/target-parsing
Browse files Browse the repository at this point in the history
fix(target): Parsing of extra targets
  • Loading branch information
tjholm authored Mar 1, 2022
2 parents ad846dd + fdad3fc commit a1faea7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/target/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ func AllFromConfig() (map[string]Target, error) {
if err != nil {
return nil, err
}
if len(tMap) > 3 {

if len(tMap) > 2 {
// Decode the "extra" map for provider specific values
delete(tMap, "provider")
delete(tMap, "region")
Expand Down
18 changes: 18 additions & 0 deletions pkg/target/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,24 @@ func TestFromOptions(t *testing.T) {
},
},
},
{
name: "from config with extra 1",
target: "gcp",
config: map[string]map[string]interface{}{
"gcp": {
"provider": "gcp",
"region": "australia-southeast1",
"project": "avid-life-342120",
},
},
want: &Target{
Provider: Gcp,
Region: "australia-southeast1",
Extra: map[string]interface{}{
"project": "avid-life-342120",
},
},
},
{
name: "from args",
provider: "azure",
Expand Down

0 comments on commit a1faea7

Please sign in to comment.