Skip to content

Commit 465372a

Browse files
authored
Merge pull request #144 from yanndegat/fix/iplb/testaccs
Fix/iplb/testaccs
2 parents e9eb04d + 1e2d178 commit 465372a

File tree

743 files changed

+37376
-91254
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

743 files changed

+37376
-91254
lines changed

CHANGELOG.md

+22
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,26 @@
11
## 0.8.0 (Unreleased)
2+
3+
FEATURES:
4+
5+
* __New Datasource:__ `ovh_me_ipxe_script` ([#141](https://github.com/terraform-providers/terraform-provider-ovh/pull/141))
6+
* __New Datasource:__ `ovh_me_ipxe_scripts` ([#141](https://github.com/terraform-providers/terraform-provider-ovh/pull/141))
7+
* __New Resource:__ `ovh_me_ipxe_script` ([#141](https://github.com/terraform-providers/terraform-provider-ovh/pull/141))
8+
9+
IMPROVEMENTS:
10+
11+
* Stop failing sweepers if mandatory env vars are missing. ([#142](https://github.com/terraform-providers/terraform-provider-ovh/pull/142))
12+
* r/iploadbalancing_*: Add importers and tests([#140](https://github.com/terraform-providers/terraform-provider-ovh/pull/140))
13+
* r/iploadbalancing_tcp_farm, r/iploadbalancing_http_farm: Extend read function to get all values ([#140](https://github.com/terraform-providers/terraform-provider-ovh/pull/140))
14+
* r/iploadbalancing_http_route: Extend read function to get action value ([#140](https://github.com/terraform-providers/terraform-provider-ovh/pull/140))
15+
* r/iploadbalancing_http_route_rule: Read all values ([#140](https://github.com/terraform-providers/terraform-provider-ovh/pull/140))
16+
* r/iploadbalancing_tcp_frontend, r/iploadbalancing_http_frontend: Some code refactoring according to linter ([#140](https://github.com/terraform-providers/terraform-provider-ovh/pull/140))
17+
18+
BUG FIXES:
19+
20+
* r/iploadbalancing_vrack_network: fix sweepers ([#142](https://github.com/terraform-providers/terraform-provider-ovh/pull/142))
21+
* r/iploadbalancing_tcp_farm, r/iploadbalancing_http_farm: Fix typo in 'oco' probe type ([#140](https://github.com/terraform-providers/terraform-provider-ovh/pull/140))
22+
* r/iploadbalancing_tcp_farm_server, r/iploadbalancing_http_farm_server: Allow port to have a nil value ([#140](https://github.com/terraform-providers/terraform-provider-ovh/pull/140))
23+
224
## 0.7.0 (March 02, 2020)
325

426
FEATURES:

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/terraform-providers/terraform-provider-ovh
33
require (
44
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect
55
github.com/hashicorp/go-cleanhttp v0.5.1
6-
github.com/hashicorp/terraform-plugin-sdk v1.0.0
6+
github.com/hashicorp/terraform-plugin-sdk v1.12.0
77
github.com/jtolds/gls v4.20.0+incompatible // indirect
88
github.com/mitchellh/go-homedir v1.1.0
99
github.com/ovh/go-ovh v0.0.0-20181109152953-ba5adb4cf014

go.sum

+27-173
Large diffs are not rendered by default.

ovh/data_source_ovh_iploadbalancing_vrack_network.go

-17
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,6 @@ func dataSourceIpLoadbalancingVrackNetwork() *schema.Resource {
2424
},
2525

2626
//Computed
27-
"farm_id": {
28-
Type: schema.TypeList,
29-
Description: "Farm id your vRack network is attached to and their type",
30-
Computed: true,
31-
Elem: &schema.Resource{
32-
Schema: map[string]*schema.Schema{
33-
"type": {
34-
Type: schema.TypeString,
35-
Computed: true,
36-
},
37-
"id": {
38-
Type: schema.TypeInt,
39-
Computed: true,
40-
},
41-
},
42-
},
43-
},
4427
"display_name": {
4528
Type: schema.TypeString,
4629
Description: "Human readable name for your vrack network",

ovh/data_source_ovh_iploadbalancing_vrack_network_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ func TestAccIpLoadbalancingVrackNetworkDataSource_basic(t *testing.T) {
2121
resource.TestCheckResourceAttr("data.ovh_iploadbalancing_vrack_network.network", "vlan", testAccIpLoadbalancingVrackNetworkVlan1001),
2222
resource.TestCheckResourceAttrSet("data.ovh_iploadbalancing_vrack_network.network", "id"),
2323
resource.TestCheckResourceAttr("data.ovh_iploadbalancing_vrack_network.network", "nat_ip", testAccIpLoadbalancingVrackNetworkNatIp),
24-
resource.TestCheckResourceAttrSet("data.ovh_iploadbalancing_vrack_network.network", "farm_id.#"),
2524
),
2625
},
2726
},

ovh/helpers.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func validateFilesystem(value string) error {
152152

153153
func getNilBoolPointerFromData(data interface{}, id string) *bool {
154154
if resourceData, tok := data.(*schema.ResourceData); tok {
155-
if val, ok := resourceData.GetOkExists(id); ok {
155+
if val, ok := resourceData.GetOk(id); ok {
156156
return getNilBoolPointer(val)
157157
}
158158
} else if mapData, tok := data.(map[string]interface{}); tok {
@@ -166,7 +166,7 @@ func getNilBoolPointerFromData(data interface{}, id string) *bool {
166166

167167
func getNilStringPointerFromData(data interface{}, id string) *string {
168168
if resourceData, tok := data.(*schema.ResourceData); tok {
169-
if val, ok := resourceData.GetOkExists(id); ok {
169+
if val, ok := resourceData.GetOk(id); ok {
170170
return getNilStringPointer(val)
171171
}
172172
} else if mapData, tok := data.(map[string]interface{}); tok {
@@ -180,7 +180,7 @@ func getNilStringPointerFromData(data interface{}, id string) *string {
180180

181181
func getNilIntPointerFromData(data interface{}, id string) *int {
182182
if resourceData, tok := data.(*schema.ResourceData); tok {
183-
if val, ok := resourceData.GetOkExists(id); ok {
183+
if val, ok := resourceData.GetOk(id); ok {
184184
return getNilIntPointer(val)
185185
}
186186
} else if mapData, tok := data.(map[string]interface{}); tok {
@@ -194,7 +194,7 @@ func getNilIntPointerFromData(data interface{}, id string) *int {
194194

195195
func getNilInt64PointerFromData(data interface{}, id string) *int64 {
196196
if resourceData, tok := data.(*schema.ResourceData); tok {
197-
if val, ok := resourceData.GetOkExists(id); ok {
197+
if val, ok := resourceData.GetOk(id); ok {
198198
return getNilInt64Pointer(val)
199199
}
200200
} else if mapData, tok := data.(map[string]interface{}); tok {

ovh/import_iploadbalancing_http_farm_server_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ func testAccIpLoadbalancingHttpFarmServerImportId(resourceName string) resource.
7171
}
7272
}
7373

74-
var httpServerAddress = "127.0.0.1" //change it to a proper address in OVH network
74+
// an OVH IPv4 is required for servers
75+
// ping.ovh.net ip is used for test purposes
76+
var httpServerAddress = "198.27.92.1"
7577
var testAccIpLoadbalancingHttpFarmServerConfig_basic = fmt.Sprintf(testAccIpLoadbalancingHttpFarmServerConfig,
7678
os.Getenv("OVH_IPLB_SERVICE"), "testfarm", 12345, "all", "testserver", httpServerAddress)

ovh/import_iploadbalancing_http_farm_test.go

+6-23
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,22 @@ import (
55
"os"
66
"testing"
77

8+
"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
89
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
910
"github.com/hashicorp/terraform-plugin-sdk/terraform"
1011
)
1112

12-
const (
13-
testAccIpLoadbalancingHttpFarmConfig = `
14-
data "ovh_iploadbalancing" "iplb" {
15-
service_name = "%s"
16-
}
17-
resource "ovh_iploadbalancing_http_farm" "testfarm" {
18-
service_name = data.ovh_iploadbalancing.iplb.id
19-
display_name = "%s"
20-
port = "%d"
21-
zone = "%s"
22-
balance = "roundrobin"
23-
probe {
24-
interval = 30
25-
type = "oco"
26-
}
27-
}
28-
`
29-
)
30-
3113
func TestAccIpLoadbalancingHttpFarm_importBasic(t *testing.T) {
14+
displayName := acctest.RandomWithPrefix(test_prefix)
15+
config := fmt.Sprintf(testAccIpLoadbalancingHttpFarmConfig,
16+
os.Getenv("OVH_IPLB_SERVICE"), displayName, 12345, "all")
17+
3218
resource.Test(t, resource.TestCase{
3319
PreCheck: func() { testAccPreCheckIpLoadbalancing(t) },
3420
Providers: testAccProviders,
3521
Steps: []resource.TestStep{
3622
{
37-
Config: testAccIpLoadbalancingHttpFarmConfig_basic,
23+
Config: config,
3824
},
3925
{
4026
ResourceName: "ovh_iploadbalancing_http_farm.testfarm",
@@ -59,6 +45,3 @@ func testAccIpLoadbalancingHttpFarmImportId(resourceName string) resource.Import
5945
), nil
6046
}
6147
}
62-
63-
var testAccIpLoadbalancingHttpFarmConfig_basic = fmt.Sprintf(testAccIpLoadbalancingHttpFarmConfig,
64-
os.Getenv("OVH_IPLB_SERVICE"), "testfarm", 12345, "all")

ovh/import_iploadbalancing_tcp_farm_server_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ func testAccIpLoadbalancingTcpFarmServerImportId(resourceName string) resource.I
7171
}
7272
}
7373

74-
var tcpServerAddress = "127.0.0.1" //change it to a proper address in OVH network
74+
// an OVH IPv4 is required for servers
75+
// ping.ovh.net ip is used for test purposes
76+
var tcpServerAddress = "198.27.92.1"
7577
var testAccIpLoadbalancingTcpFarmServerConfig_basic = fmt.Sprintf(testAccIpLoadbalancingTcpFarmServerConfig,
7678
os.Getenv("OVH_IPLB_SERVICE"), "testfarm", 12345, "all", "testserver", tcpServerAddress)

ovh/import_iploadbalancing_tcp_farm_test.go

+5-24
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,21 @@ import (
55
"os"
66
"testing"
77

8+
"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
89
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
910
"github.com/hashicorp/terraform-plugin-sdk/terraform"
1011
)
1112

12-
const (
13-
testAccIpLoadbalancingTcpFarmConfig = `
14-
data "ovh_iploadbalancing" "iplb" {
15-
service_name = "%s"
16-
}
17-
18-
resource "ovh_iploadbalancing_tcp_farm" "testfarm" {
19-
service_name = data.ovh_iploadbalancing.iplb.id
20-
display_name = "%s"
21-
port = "%d"
22-
zone = "%s"
23-
balance = "roundrobin"
24-
probe {
25-
interval = 30
26-
type = "oco"
27-
}
28-
}
29-
`
30-
)
31-
3213
func TestAccIpLoadbalancingTcpFarm_importBasic(t *testing.T) {
14+
displayName := acctest.RandomWithPrefix(test_prefix)
15+
config := fmt.Sprintf(testAccIpLoadbalancingTcpFarmConfig,
16+
os.Getenv("OVH_IPLB_SERVICE"), displayName, 12345, "all")
3317
resource.Test(t, resource.TestCase{
3418
PreCheck: func() { testAccPreCheckIpLoadbalancing(t) },
3519
Providers: testAccProviders,
3620
Steps: []resource.TestStep{
3721
{
38-
Config: testAccIpLoadbalancingTcpFarmConfig_basic,
22+
Config: config,
3923
},
4024
{
4125
ResourceName: "ovh_iploadbalancing_tcp_farm.testfarm",
@@ -60,6 +44,3 @@ func testAccIpLoadbalancingTcpFarmImportId(resourceName string) resource.ImportS
6044
), nil
6145
}
6246
}
63-
64-
var testAccIpLoadbalancingTcpFarmConfig_basic = fmt.Sprintf(testAccIpLoadbalancingTcpFarmConfig,
65-
os.Getenv("OVH_IPLB_SERVICE"), "testfarm", 12345, "all")

ovh/provider_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,6 @@ func testAccCheckVRackExists(t *testing.T) {
138138
if err != nil {
139139
t.Fatalf("Error: %q\n", err)
140140
}
141-
t.Logf("Read VRack %s -> name:'%s', desc:'%s' ", endpoint, r.Name, r.Description)
142-
143141
}
144142

145143
func testAccCheckCloudExists(t *testing.T) {

ovh/resource_ovh_domain_zone_record_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func testSweepDomainZoneRecord(region string) error {
9393
return nil
9494
}
9595

96-
func TestAccOvhDomainZoneRecord_Basic(t *testing.T) {
96+
func TestAccDomainZoneRecord_Basic(t *testing.T) {
9797
var record OvhDomainZoneRecord
9898
zone := os.Getenv("OVH_ZONE")
9999
subdomain := acctest.RandomWithPrefix(test_prefix)
@@ -121,7 +121,7 @@ func TestAccOvhDomainZoneRecord_Basic(t *testing.T) {
121121
})
122122
}
123123

124-
func TestAccOvhDomainZoneRecord_Updated(t *testing.T) {
124+
func TestAccDomainZoneRecord_Updated(t *testing.T) {
125125
record := OvhDomainZoneRecord{}
126126
zone := os.Getenv("OVH_ZONE")
127127
subdomain := acctest.RandomWithPrefix(test_prefix)
@@ -193,7 +193,7 @@ func TestAccOvhDomainZoneRecord_Updated(t *testing.T) {
193193
})
194194
}
195195

196-
func TestAccOvhDomainZoneRecord_updateType(t *testing.T) {
196+
func TestAccDomainZoneRecord_updateType(t *testing.T) {
197197
record := OvhDomainZoneRecord{}
198198
zone := os.Getenv("OVH_ZONE")
199199
subdomain := acctest.RandomWithPrefix(test_prefix)

ovh/resource_ovh_domain_zone_redirection_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func testSweepDomainZoneRedirection(region string) error {
8989
return nil
9090
}
9191

92-
func TestAccOvhDomainZoneRedirection_Basic(t *testing.T) {
92+
func TestAccDomainZoneRedirection_Basic(t *testing.T) {
9393
var redirection OvhDomainZoneRedirection
9494
zone := os.Getenv("OVH_ZONE")
9595
subdomain := acctest.RandomWithPrefix(test_prefix)
@@ -117,7 +117,7 @@ func TestAccOvhDomainZoneRedirection_Basic(t *testing.T) {
117117
})
118118
}
119119

120-
func TestAccOvhDomainZoneRedirection_Updated(t *testing.T) {
120+
func TestAccDomainZoneRedirection_Updated(t *testing.T) {
121121
redirection := OvhDomainZoneRedirection{}
122122
zone := os.Getenv("OVH_ZONE")
123123
subdomain := acctest.RandomWithPrefix(test_prefix)

0 commit comments

Comments
 (0)