Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sdkv2 #154

Merged
merged 1 commit into from
Aug 26, 2020
Merged

Sdkv2 #154

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 1 addition & 8 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
module github.com/terraform-providers/terraform-provider-ovh

require (
cloud.google.com/go v0.61.0 // indirect
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect
github.com/hashicorp/go-cleanhttp v0.5.1
github.com/hashicorp/go-getter v1.4.2-0.20200106182914-9813cbd4eb02 // indirect
github.com/hashicorp/go-plugin v1.3.0 // indirect
github.com/hashicorp/hcl/v2 v2.3.0 // indirect
github.com/hashicorp/terraform-exec v0.3.0 // indirect
github.com/hashicorp/terraform-plugin-sdk v1.15.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.0.1
github.com/jtolds/gls v4.20.0+incompatible // indirect
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/go-testing-interface v1.0.4 // indirect
github.com/ovh/go-ovh v0.0.0-20181109152953-ba5adb4cf014
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304 // indirect
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c // indirect
github.com/ulikunitz/xz v0.5.7 // indirect
gopkg.in/ini.v1 v1.42.0
)

Expand Down
56 changes: 7 additions & 49 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"github.com/hashicorp/terraform-plugin-sdk/plugin"
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
"github.com/terraform-providers/terraform-provider-ovh/ovh"
)

Expand Down
2 changes: 1 addition & 1 deletion ovh/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"

cleanhttp "github.com/hashicorp/go-cleanhttp"
"github.com/hashicorp/terraform-plugin-sdk/helper/logging"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging"
"github.com/ovh/go-ovh/ovh"
)

Expand Down
4 changes: 2 additions & 2 deletions ovh/data_source_ovh_cloud_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"log"
"net/url"

"github.com/hashicorp/terraform-plugin-sdk/helper/hashcode"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/terraform-providers/terraform-provider-ovh/ovh/helpers/hashcode"

"github.com/ovh/go-ovh/ovh"
)
Expand Down
2 changes: 1 addition & 1 deletion ovh/data_source_ovh_cloud_region_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccCloudRegionDataSource_basic(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion ovh/data_source_ovh_cloud_regions.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"net/url"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func dataSourceCloudRegions() *schema.Resource {
Expand Down
2 changes: 1 addition & 1 deletion ovh/data_source_ovh_cloud_regions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccCloudRegionsDataSource_basic(t *testing.T) {
Expand Down
6 changes: 4 additions & 2 deletions ovh/data_source_ovh_dedicated_ceph.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package ovh

import (
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"log"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/terraform-providers/terraform-provider-ovh/ovh/helpers"
)

func dataSourceDedicatedCeph() *schema.Resource {
Expand Down Expand Up @@ -59,7 +61,7 @@ func dataSourceDedicatedCeph() *schema.Resource {
Optional: true,
Computed: true,
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
err := validateDedicatedCephStatus(v.(string))
err := helpers.ValidateDedicatedCephStatus(v.(string))
if err != nil {
errors = append(errors, err)
}
Expand Down
3 changes: 2 additions & 1 deletion ovh/data_source_ovh_dedicated_ceph_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package ovh

import (
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"os"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccDedicatedCephDatasource(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions ovh/data_source_ovh_dedicated_installation_templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"sort"

"github.com/hashicorp/terraform-plugin-sdk/helper/hashcode"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/terraform-providers/terraform-provider-ovh/ovh/helpers/hashcode"
)

func dataSourceDedicatedInstallationTemplates() *schema.Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package ovh
import (
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccDedicatedInstallationTemplatesDataSource_basic(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion ovh/data_source_ovh_dedicated_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"net/url"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func dataSourceDedicatedServer() *schema.Resource {
Expand Down
7 changes: 4 additions & 3 deletions ovh/data_source_ovh_dedicated_server_boots.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
"sort"
"strconv"

"github.com/hashicorp/terraform-plugin-sdk/helper/hashcode"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/terraform-providers/terraform-provider-ovh/ovh/helpers"
"github.com/terraform-providers/terraform-provider-ovh/ovh/helpers/hashcode"
)

func dataSourceDedicatedServerBoots() *schema.Resource {
Expand All @@ -25,7 +26,7 @@ func dataSourceDedicatedServerBoots() *schema.Resource {
Optional: true,
Description: "Filter the value of bootType property",
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
err := validateBootType(v.(string))
err := helpers.ValidateBootType(v.(string))
if err != nil {
errors = append(errors, err)
}
Expand Down
2 changes: 1 addition & 1 deletion ovh/data_source_ovh_dedicated_server_boots_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccDedicatedServerBootsDataSource_basic(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion ovh/data_source_ovh_dedicated_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccDedicatedServerDataSource_basic(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions ovh/data_source_ovh_dedicated_servers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"sort"

"github.com/hashicorp/terraform-plugin-sdk/helper/hashcode"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/terraform-providers/terraform-provider-ovh/ovh/helpers/hashcode"
)

func dataSourceDedicatedServers() *schema.Resource {
Expand Down
2 changes: 1 addition & 1 deletion ovh/data_source_ovh_dedicated_servers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package ovh
import (
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccDedicatedServersDataSource_basic(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion ovh/data_source_ovh_domain_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package ovh
import (
"fmt"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func dataSourceDomainZone() *schema.Resource {
Expand Down
4 changes: 2 additions & 2 deletions ovh/data_source_ovh_domain_zone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"strconv"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
)

func TestAccDomainZoneDataSource_basic(t *testing.T) {
Expand Down
15 changes: 8 additions & 7 deletions ovh/data_source_ovh_iploadbalancing.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"fmt"
"log"

"github.com/hashicorp/terraform-plugin-sdk/helper/hashcode"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/terraform-providers/terraform-provider-ovh/ovh/helpers"
"github.com/terraform-providers/terraform-provider-ovh/ovh/helpers/hashcode"
)

func dataSourceIpLoadbalancing() *schema.Resource {
Expand All @@ -17,7 +18,7 @@ func dataSourceIpLoadbalancing() *schema.Resource {
Optional: true,
Computed: true,
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
err := validateIpV6(v.(string))
err := helpers.ValidateIpV6(v.(string))
if err != nil {
errors = append(errors, err)
}
Expand All @@ -29,7 +30,7 @@ func dataSourceIpLoadbalancing() *schema.Resource {
Optional: true,
Computed: true,
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
err := validateIpV4(v.(string))
err := helpers.ValidateIpV4(v.(string))
if err != nil {
errors = append(errors, err)
}
Expand Down Expand Up @@ -60,7 +61,7 @@ func dataSourceIpLoadbalancing() *schema.Resource {
Optional: true,
Computed: true,
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
err := validateIp(v.(string))
err := helpers.ValidateIp(v.(string))
if err != nil {
errors = append(errors, err)
}
Expand All @@ -72,7 +73,7 @@ func dataSourceIpLoadbalancing() *schema.Resource {
Optional: true,
Computed: true,
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
err := validateStringEnum(v.(string), []string{"blacklisted", "deleted", "free", "ok", "quarantined", "suspended"})
err := helpers.ValidateStringEnum(v.(string), []string{"blacklisted", "deleted", "free", "ok", "quarantined", "suspended"})
if err != nil {
errors = append(errors, err)
}
Expand Down Expand Up @@ -100,7 +101,7 @@ func dataSourceIpLoadbalancing() *schema.Resource {
Optional: true,
Computed: true,
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
err := validateStringEnum(v.(string), []string{"intermediate", "modern"})
err := helpers.ValidateStringEnum(v.(string), []string{"intermediate", "modern"})
if err != nil {
errors = append(errors, err)
}
Expand Down
2 changes: 1 addition & 1 deletion ovh/data_source_ovh_iploadbalancing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccIpLoadbalancingDataSource_basic(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion ovh/data_source_ovh_iploadbalancing_vrack_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"net/url"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func dataSourceIpLoadbalancingVrackNetwork() *schema.Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccIpLoadbalancingVrackNetworkDataSource_basic(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions ovh/data_source_ovh_iploadbalancing_vrack_networks.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import (
"net/url"
"strconv"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/terraform-providers/terraform-provider-ovh/ovh/helpers"
)

func dataSourceIpLoadbalancingVrackNetworks() *schema.Resource {
Expand All @@ -23,7 +24,7 @@ func dataSourceIpLoadbalancingVrackNetworks() *schema.Resource {
Description: "Filters on subnet",
Optional: true,
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
err := validateIpBlock(v.(string))
err := helpers.ValidateIpBlock(v.(string))
if err != nil {
errors = append(errors, err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccIpLoadbalancingVrackNetworksDataSource_basic(t *testing.T) {
Expand Down
10 changes: 7 additions & 3 deletions ovh/data_source_ovh_me_installation_template.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ovh

import (
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func dataSourceMeInstallationTemplate() *schema.Resource {
Expand All @@ -23,7 +23,6 @@ func dataSourceMeInstallationTemplate() *schema.Resource {
"customization": {
Type: schema.TypeList,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"change_log": {
Expand Down Expand Up @@ -177,7 +176,7 @@ func dataSourceMeInstallationTemplate() *schema.Resource {
Description: "This template bit format (32 or 64)",
},
"category": {
Type: schema.TypeInt,
Type: schema.TypeString,
Computed: true,
Description: "Category of this template (informative only). (basic, customer, hosting, other, readyToUse, virtualisation)",
},
Expand Down Expand Up @@ -219,6 +218,11 @@ func dataSourceMeInstallationTemplate() *schema.Resource {
Computed: true,
Description: "Date of last modification of the base image",
},
"lvm_ready": {
Type: schema.TypeBool,
Computed: true,
Description: "This distribution supports Logical Volumes (Linux LVM)",
},
"supports_distribution_kernel": {
Type: schema.TypeBool,
Computed: true,
Expand Down
7 changes: 4 additions & 3 deletions ovh/data_source_ovh_me_installation_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccMeInstallationTemplateDataSource_basic(t *testing.T) {
Expand Down Expand Up @@ -57,6 +57,7 @@ resource "ovh_me_installation_template" "template" {
}

data "ovh_me_installation_template" "template" {
template_name = ovh_me_installation_template.template.template_name
template_name = ovh_me_installation_template.template.template_name
depends_on = [ovh_me_installation_template.template]
}
`
Loading