diff --git a/ovh/resource_savings_plan.go b/ovh/resource_savings_plan.go index 38310058..ed365969 100644 --- a/ovh/resource_savings_plan.go +++ b/ovh/resource_savings_plan.go @@ -120,6 +120,7 @@ func resourceSavingsPlanImport(d *schema.ResourceData, meta interface{}) ([]*sch func resourceSavingsPlanCreate(d *schema.ResourceData, meta interface{}) error { serviceName := d.Get("service_name").(string) + flavor := strings.ToUpper(d.Get("flavor").(string)) config := meta.(*Config) // Retrieve service ID @@ -153,7 +154,7 @@ func resourceSavingsPlanCreate(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("error calling POST %s:\n\t %q", endpoint, err) } - if d.Get("flavor").(string) == resp.Flavor && + if flavor == strings.ToUpper(resp.Flavor) && d.Get("period").(string) == resp.Period && d.Get("size").(int) == resp.Size { // We found the right savings plan, execute subscription diff --git a/ovh/resource_savings_plan_test.go b/ovh/resource_savings_plan_test.go index 8e678331..5b8deffc 100644 --- a/ovh/resource_savings_plan_test.go +++ b/ovh/resource_savings_plan_test.go @@ -17,7 +17,7 @@ func TestAccResourceSavingsPlan_basic(t *testing.T) { config := fmt.Sprintf( `resource "ovh_savings_plan" "sp" { service_name = "%s" - flavor = "Rancher" + flavor = "b3-8" period = "P1M" size = 1 display_name = "%s" @@ -36,7 +36,7 @@ func TestAccResourceSavingsPlan_basic(t *testing.T) { Config: config, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("ovh_savings_plan.sp", "display_name", displayName), - resource.TestCheckResourceAttr("ovh_savings_plan.sp", "flavor", "Rancher"), + resource.TestCheckResourceAttr("ovh_savings_plan.sp", "flavor", "b3-8"), resource.TestCheckResourceAttr("ovh_savings_plan.sp", "size", "1"), resource.TestCheckResourceAttr("ovh_savings_plan.sp", "end_date", endDate), resource.TestCheckResourceAttr("ovh_savings_plan.sp", "period_end_date", endDate), diff --git a/website/docs/r/savings_plan.html.markdown b/website/docs/r/savings_plan.html.markdown index 74dca0a3..5273dfe2 100644 --- a/website/docs/r/savings_plan.html.markdown +++ b/website/docs/r/savings_plan.html.markdown @@ -24,7 +24,7 @@ resource "ovh_savings_plan" "plan" { The following arguments are supported: * `service_name` - (Required) ID of the public cloud project -* `flavor` - (Required) Savings Plan flavor (e.g. Rancher, C3-4, any instance flavor, ...) +* `flavor` - (Required) Savings Plan flavor (e.g. Rancher, C3-4, any instance flavor, ...). * `period` - (Required) Periodicity of the Savings Plan * `size` - (Required) Size of the Savings Plan * `display_name` - (Required) Custom display name, used in invoices