Skip to content

Commit

Permalink
Merge pull request #45 from mercari/fix-deprecated-provider-schema
Browse files Browse the repository at this point in the history
add(spinnaker): deprecated server attr in provider schema
  • Loading branch information
KeisukeYamashita committed Jul 22, 2020
2 parents f79ace3 + 33194cb commit 83c9476
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions spinnaker/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@ import (
func Provider() *schema.Provider {
return &schema.Provider{
Schema: map[string]*schema.Schema{
"server": {
Type: schema.TypeString,
Description: "URL for Spinnaker Gate",
Deprecated: "use `gate_endpoint` instead",
Optional: true,
ConflictsWith: []string{"gate_endpoint"},
},
"gate_endpoint": {
Type: schema.TypeString,
Required: true,
Optional: true,
Description: "URL for Spinnaker Gate",
DefaultFunc: schema.EnvDefaultFunc("GATE_ENDPOINT", nil),
},
Expand Down Expand Up @@ -54,7 +61,13 @@ type gateConfig struct {
}

func providerConfigureFunc(data *schema.ResourceData) (interface{}, error) {
gateEndpoint := data.Get("gate_endpoint").(string)
var gateEndpoint string
if v, deprecated := data.Get("server").(string); deprecated {
gateEndpoint = v
} else {
gateEndpoint = data.Get("gate_endpoint").(string)
}

config := data.Get("config").(string)
ignoreCertErrors := data.Get("ignore_cert_errors").(bool)
defaultHeaders := data.Get("default_headers").(string)
Expand Down

0 comments on commit 83c9476

Please sign in to comment.