Merge pull request #9677 from hashicorp/b-scaleway-user-agent-config

builder/scaleway: Remove mapstructure configuration for the UserAgent runtime-only field
This commit is contained in:
Megan Marsh 2020-07-31 10:26:36 -07:00 committed by GitHub
commit ea45efc9b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View File

@ -41,6 +41,19 @@ func TestBuilder_Prepare_BadType(t *testing.T) {
}
}
func TestBuilderPrepare(t *testing.T) {
var b Builder
config := testConfig()
_, warnings, err := b.Prepare(config)
if len(warnings) > 0 {
t.Fatalf("bad: %#v", warnings)
}
if err != nil {
t.Fatal("should not have errors")
}
}
func TestBuilderPrepare_InvalidKey(t *testing.T) {
var b Builder
config := testConfig()

View File

@ -67,7 +67,7 @@ type Config struct {
RemoveVolume bool `mapstructure:"remove_volume"`
UserAgent string
UserAgent string `mapstructure-to-hcl2:",skip"`
ctx interpolate.Context
}

View File

@ -74,7 +74,6 @@ type FlatConfig struct {
Bootscript *string `mapstructure:"bootscript" required:"false" cty:"bootscript" hcl:"bootscript"`
BootType *string `mapstructure:"boottype" required:"false" cty:"boottype" hcl:"boottype"`
RemoveVolume *bool `mapstructure:"remove_volume" cty:"remove_volume" hcl:"remove_volume"`
UserAgent *string `cty:"user_agent" hcl:"user_agent"`
}
// FlatMapstructure returns a new FlatConfig.
@ -154,7 +153,6 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec {
"bootscript": &hcldec.AttrSpec{Name: "bootscript", Type: cty.String, Required: false},
"boottype": &hcldec.AttrSpec{Name: "boottype", Type: cty.String, Required: false},
"remove_volume": &hcldec.AttrSpec{Name: "remove_volume", Type: cty.Bool, Required: false},
"user_agent": &hcldec.AttrSpec{Name: "user_agent", Type: cty.String, Required: false},
}
return s
}