Skip to content

Commit c9e3f5f

Browse files
committed
fix(pat-rules): remove useless cassette (scaleway#900)
remove useless cassette chore(deps): bump github.com/aws/aws-sdk-go from 1.41.4 to 1.41.5 (scaleway#901) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.41.4 to 1.41.5. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md) - [Commits](aws/aws-sdk-go@v1.41.4...v1.41.5) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Add support for LB Private Networks and LB Routes (scaleway#867) * feat(lb): Add LB Private Network support * feat(lb): Add LB Route support * fixup! feat(lb): Add LB Private Network support * fix: increase rdb instance creation timeout to 15m (scaleway#868) Co-authored-by: Antoine Barbare <[email protected]> * doc: fix broken links following the release of the LB Zoned API (scaleway#871) * fix(docs) wrong name for resource iot_device (scaleway#869) Replace "scaleway_iot_hub_device" with "scaleway_iot_device" Co-authored-by: Rémy Léone <[email protected]> * chore: add a SECURITY.md (scaleway#872) * feat(domain): add record resource (scaleway#854) Co-authored-by: Jeremy JACQUEMIN <[email protected]> * doc: fix default runtime on k8s_pool (scaleway#873) * feat(iot): Add ability to set user device certificate (scaleway#859) * feat(iot): add ability to set user device certificate * test(iot): add test for user device certificate * test(iot): use unique resource names in tests to prevent conflict between tests set * test(iot): update cassettes for iot-device-minimal * chore: add a SECURITY.md (scaleway#872) * feat(domain): add record resource (scaleway#854) Co-authored-by: Jeremy JACQUEMIN <[email protected]> * doc: fix default runtime on k8s_pool (scaleway#873) Co-authored-by: Jerome Malinge <[email protected]> Co-authored-by: Rémy Léone <[email protected]> Co-authored-by: jerjako <[email protected]> Co-authored-by: Jeremy JACQUEMIN <[email protected]> Co-authored-by: Jérémy THERIN <[email protected]> Co-authored-by: jaime Bernabe <[email protected]> * feat(instance): Adding the datasource for instance ip (scaleway#870) * feat(instance): Adding the datasource for instance ip * refactoring: using ParseIP to validate the IP * fix: use proper validation * minor fixes * style(tfproviderlint): S019: schema should omit Computed, Optional, or Required set to false * fix: avoiding one api call if the ID is passed Co-authored-by: Rémy Léone <[email protected]> Co-authored-by: jaime Bernabe <[email protected]> * feat(lb): add data source for lb (scaleway#760) * feat(lb): add data source for lb * Fix * Update scaleway/data_source_lb.go Co-authored-by: Jerome Quere <[email protected]> * Update scaleway/data_source_lb.go Co-authored-by: Jerome Quere <[email protected]> * Update docs/data-sources/lb.md Co-authored-by: Quentin Brosse <[email protected]> * Fix * Fix * Fix * feat(lb): remove repeated explanation * feat(lb): update lb datasource reader with zone * feat(lb): update lb datasource reader with zone and test Co-authored-by: Jerome Quere <[email protected]> Co-authored-by: Quentin Brosse <[email protected]> Co-authored-by: jaime Bernabe <[email protected]> Co-authored-by: Jaime BERNABE <[email protected]> * feat(vpcgw): add support for DHCP (scaleway#865) * feat(vpcgw): add support for DHCP * Fix * Fix * Fix * Fix * feat(lb): update vpc gw dhcp and small corrections * feat(vpc_public_gateway_dhcp): fix doc and test Co-authored-by: jaime Bernabe <[email protected]> Co-authored-by: Jaime BERNABE <[email protected]> * feat(domain): Add domain record data source (scaleway#874) * feat(domain): Add domain record data source * fix tests Co-authored-by: Jeremy JACQUEMIN <[email protected]> Co-authored-by: jaime Bernabe <[email protected]> * chore: add support for dependabot (scaleway#877) * chore(deps): bump github.com/aws/aws-sdk-go from 1.39.3 to 1.40.53 (scaleway#878) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.39.3 to 1.40.53. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md) - [Commits](aws/aws-sdk-go@v1.39.3...v1.40.53) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump github.com/hashicorp/terraform-plugin-sdk/v2 (scaleway#880) Bumps [github.com/hashicorp/terraform-plugin-sdk/v2](https://github.com/hashicorp/terraform-plugin-sdk) from 2.7.0 to 2.8.0. - [Release notes](https://github.com/hashicorp/terraform-plugin-sdk/releases) - [Changelog](https://github.com/hashicorp/terraform-plugin-sdk/blob/main/CHANGELOG.md) - [Commits](hashicorp/terraform-plugin-sdk@v2.7.0...v2.8.0) --- updated-dependencies: - dependency-name: github.com/hashicorp/terraform-plugin-sdk/v2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Rémy Léone <[email protected]> * chore(deps): bump github.com/dnaeon/go-vcr from 1.1.0 to 1.2.0 (scaleway#879) Bumps [github.com/dnaeon/go-vcr](https://github.com/dnaeon/go-vcr) from 1.1.0 to 1.2.0. - [Release notes](https://github.com/dnaeon/go-vcr/releases) - [Commits](dnaeon/go-vcr@v1.1.0...v1.2.0) --- updated-dependencies: - dependency-name: github.com/dnaeon/go-vcr dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Rémy Léone <[email protected]> * chore(deps): bump github.com/aws/aws-sdk-go from 1.40.53 to 1.40.54 (scaleway#881) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.40.53 to 1.40.54. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md) - [Commits](aws/aws-sdk-go@v1.40.53...v1.40.54) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * feat(provider): add profile name from configuration file support (scaleway#875) * feat(provider): add profile name from configuration file support * feat(provider): enhance error handling * chore(provider): add section about new profile feature usage * fix(provider): fix condition * Apply suggestions from code review Co-authored-by: jaime Bernabe <[email protected]> * feat(lb): test for private network * fix(lb): linter correction * fix(lb): lint correction * fix(lb): lint correction * chore(deps): bump github.com/aws/aws-sdk-go from 1.40.54 to 1.40.55 (scaleway#883) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.40.54 to 1.40.55. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md) - [Commits](aws/aws-sdk-go@v1.40.54...v1.40.55) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore: bump go version (scaleway#882) * k8s: add type on cluster (scaleway#886) * fix(vpc): reverse issue (scaleway#887) * fix(vpc): reverse issue * fix(vpc): add test to check reverse and address * fix(vpc): double retry interval Co-authored-by: scaleway-bot <[email protected]> * chore(deps): bump github.com/aws/aws-sdk-go from 1.40.55 to 1.40.56 (scaleway#888) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.40.55 to 1.40.56. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md) - [Commits](aws/aws-sdk-go@v1.40.55...v1.40.56) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: jaime Bernabe <[email protected]> * fix(instance): security group rule read from api and acl database not statefull (scaleway#892) * Convert acl_rules from list to set * Fix read security group rules, removed from api * fix update typeSet for acl_rules * change order Co-authored-by: Rémy Léone <[email protected]> * chore(deps): bump github.com/aws/aws-sdk-go from 1.40.56 to 1.40.59 (scaleway#893) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.40.56 to 1.40.59. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md) - [Commits](aws/aws-sdk-go@v1.40.56...v1.40.59) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: jaime Bernabe <[email protected]> * feat(vpcgw): add gateway network resource (scaleway#891) Co-authored-by: scaleway-bot <[email protected]> * chore(deps): bump github.com/aws/aws-sdk-go from 1.40.59 to 1.41.0 (scaleway#894) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.40.59 to 1.41.0. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md) - [Commits](aws/aws-sdk-go@v1.40.59...v1.41.0) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * feat(lb): add wait lb in every resource * fix(lb): add test steps * feat(lb): add test and change schema * feat(lb): add test for dhcp * feat(lb): add cassette * feat(lb): add cassette basic and dhcp. add doc. add test dhcp * fix(lb_pn): lint * Remove trailing spaces * fix(lb_certificate): remove wait on lb_certificate * feat(lb): add release_ip to data_source * fix(lbacl): fix test lb acl * fix(lb-acl): update cassettes lb acl * fix(lb-pn): fix cassette * fix(lb-route): cassette Co-authored-by: abarbare <[email protected]> Co-authored-by: Antoine Barbare <[email protected]> Co-authored-by: Jean-Sébastien Hedde <[email protected]> Co-authored-by: jerousseau <[email protected]> Co-authored-by: Rémy Léone <[email protected]> Co-authored-by: jerjako <[email protected]> Co-authored-by: Jeremy JACQUEMIN <[email protected]> Co-authored-by: Jérémy THERIN <[email protected]> Co-authored-by: grom-42 <[email protected]> Co-authored-by: Jerome Malinge <[email protected]> Co-authored-by: jaime Bernabe <[email protected]> Co-authored-by: Jerome Quere <[email protected]> Co-authored-by: Quentin Brosse <[email protected]> Co-authored-by: Jaime BERNABE <[email protected]> Co-authored-by: jaime Bernabe <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alexandre Bouthinon <[email protected]> Co-authored-by: scaleway-bot <[email protected]> Co-authored-by: LucasBoisserie <[email protected]> chore(deps): bump github.com/aws/aws-sdk-go from 1.41.5 to 1.41.8 (scaleway#904) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.41.5 to 1.41.8. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md) - [Commits](aws/aws-sdk-go@v1.41.5...v1.41.8) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: jaime Bernabe <[email protected]> feat(rdb): add support for private networks feat(rdb): add support for private networks in rdb and remove lb feat(rdb): add support for private networks in rdb and remove lb fix(lint): lint return fix(lint): markdown feat(rdb): private_network test
1 parent 6dde405 commit c9e3f5f

30 files changed

+6067
-859
lines changed

docs/resources/lb.md

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ resource "scaleway_lb" "base" {
2121
ip_id = scaleway_lb_ip.ip.id
2222
zone = "fr-par-1"
2323
type = "LB-S"
24+
release_ip = true
2425
}
2526
```
2627

@@ -40,6 +41,8 @@ The following arguments are supported:
4041

4142
- `tags` - (Optional) The tags associated with the load-balancers.
4243

44+
- `release_ip` - (Defaults to false) The release_ip allow release the ip address associated with the load-balancers.
45+
4346
- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the IP should be reserved.
4447

4548
- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the load-balancer is associated with.
@@ -77,6 +80,7 @@ resource "scaleway_lb" "base" {
7780
ip_id = scaleway_lb_ip.ip.id
7881
zone = "fr-par-1"
7982
type = "LB-S"
83+
release_ip = true
8084
}
8185
```
8286

docs/resources/lb_private_network.md

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
page_title: "Scaleway: scaleway_lb_private_network"
3+
description: |-
4+
Manages Scaleway Load-Balancers private networks
5+
---
6+
7+
# scaleway_lb_private_network
8+
9+
Creates and manages Scaleway attach/detach private networks to Load-Balancers.
10+
For more information, see [the documentation](https://developers.scaleway.com/en/products/lb/zoned_api/#post-d4b30).
11+
12+
## Examples
13+
14+
### Basic
15+
16+
```hcl
17+
resource scaleway_vpc_private_network pn01 {
18+
name = "test-lb-pn"
19+
}
20+
21+
resource scaleway_lb_ip ip01 {}
22+
23+
resource scaleway_lb lb01 {
24+
ip_id = scaleway_lb_ip.ip01.id
25+
name = "test-lb"
26+
type = "lb-s"
27+
release_ip = true
28+
}
29+
30+
resource scaleway_lb_private_network lb01pn01 {
31+
lb_id = scaleway_lb.lb01.id
32+
private_network_id = scaleway_vpc_private_network.pn01.id
33+
static_config = ["172.16.0.100", "172.16.0.101"]
34+
}
35+
```
36+
37+
## Arguments Reference
38+
39+
The following arguments are supported:
40+
41+
- `lb_id` - (Required) The ID of the load-balancer to associate.
42+
43+
- `private_network_id` - (Required) The ID of the Private Network to associate.
44+
45+
- `static_config` - (Required) Define two local ip address of your choice for each load balancer instance. See below.
46+
47+
- `dhcp_config` - (Required) Set to true if you want to let DHCP assign IP addresses. See below.
48+
49+
~> **Important:** Only one of static_config and dhcp_config may be set.
50+
51+
- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the IP should be reserved.
52+
53+
- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the load-balancer is associated with.
54+
55+
## Attributes Reference
56+
57+
In addition to all arguments above, the following attributes are exported:
58+
59+
- `status` - The Private Network attachment status
60+
61+
## Import
62+
63+
Load-Balancer private network can be imported using the `{zone}/{id}`, e.g.
64+
65+
```bash
66+
$ terraform import scaleway_lb_private_network.lb01pn01 fr-par/11111111-1111-1111-1111-111111111111
67+
```
68+
69+
The attachments can either be found in the console

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
module github.com/scaleway/terraform-provider-scaleway
22

33
require (
4-
github.com/aws/aws-sdk-go v1.41.4
4+
github.com/aws/aws-sdk-go v1.41.8
55
github.com/dnaeon/go-vcr v1.2.0
66
github.com/dustin/go-humanize v1.0.0
77
github.com/google/go-cmp v0.5.6
88
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
99
github.com/hashicorp/go-retryablehttp v0.7.0
1010
github.com/hashicorp/terraform-plugin-sdk/v2 v2.8.0
11-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20211005125957-db499d89a262
11+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20211012131628-5b68cc2973b3
1212
github.com/stretchr/testify v1.7.0
1313
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
1414

go.sum

+4-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj
6262
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
6363
github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM=
6464
github.com/aws/aws-sdk-go v1.25.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
65-
github.com/aws/aws-sdk-go v1.41.4 h1:5xRzZp8LfBFfowMPxmoNsxLBZOY/NTH4EeI7q2F5eWE=
66-
github.com/aws/aws-sdk-go v1.41.4/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q=
65+
github.com/aws/aws-sdk-go v1.41.8 h1:j6imzwVyWQYuQxbkPmg2MdMmLB+Zw+U3Ewi59YF8Rwk=
66+
github.com/aws/aws-sdk-go v1.41.8/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q=
6767
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas=
6868
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4=
6969
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
@@ -286,6 +286,8 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:
286286
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
287287
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20211005125957-db499d89a262 h1:ioN4zmp/4AoCJ/BbuwmkpH+bnSSntgWMUN1PkQ46/nI=
288288
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20211005125957-db499d89a262/go.mod h1:NnxccdAsg2lS0ng/kfLVLemUQR50FCM/cdZv2gqKDhw=
289+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20211012131628-5b68cc2973b3 h1:PhWAnBbS6rWqa4A4KVCAda5ry9o2Tk3kOVjBw3DvW9s=
290+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20211012131628-5b68cc2973b3/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
289291
github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4=
290292
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
291293
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=

scaleway/data_source_lb.go

+16
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ func dataSourceScalewayLb() *schema.Resource {
2525
ValidateFunc: validationUUIDorUUIDWithLocality(),
2626
ConflictsWith: []string{"name"},
2727
}
28+
dsSchema["release_ip"] = &schema.Schema{
29+
Type: schema.TypeBool,
30+
Optional: true,
31+
Default: false,
32+
Description: "Release the IPs related to this load-balancer",
33+
}
2834

2935
return &schema.Resource{
3036
ReadContext: dataSourceScalewayLbRead,
@@ -57,6 +63,16 @@ func dataSourceScalewayLbRead(ctx context.Context, d *schema.ResourceData, meta
5763
lbID = res.LBs[0].ID
5864
}
5965

66+
var relaseIPValue bool
67+
releaseIPAddress, releaseIPExist := d.GetOk("release_ip")
68+
if releaseIPExist {
69+
relaseIPValue = *expandBoolPtr(releaseIPAddress)
70+
}
71+
72+
err = d.Set("release_ip", relaseIPValue)
73+
if err != nil {
74+
return diag.FromErr(err)
75+
}
6076
zonedID := datasourceNewZonedID(lbID, zone)
6177
d.SetId(zonedID)
6278
err = d.Set("lb_id", zonedID)

scaleway/helpers_lb.go

+24
Original file line numberDiff line numberDiff line change
@@ -293,3 +293,27 @@ func lbUpgradeV1RegionalToZonedID(element string) (string, error) {
293293
// append zone 1 as default: e.g. fr-par-1
294294
return fmt.Sprintf("%s-1/%s", locality, id), nil
295295
}
296+
297+
func expandLbPrivateNetworkStaticConfig(raw interface{}) *lb.PrivateNetworkStaticConfig {
298+
if raw == nil || len(raw.([]interface{})) < 1 {
299+
return nil
300+
}
301+
return &lb.PrivateNetworkStaticConfig{
302+
IPAddress: expandStrings(raw),
303+
}
304+
}
305+
306+
func flattenLbPrivateNetworkStaticConfig(cfg *lb.PrivateNetworkStaticConfig) []string {
307+
if cfg == nil {
308+
return nil
309+
}
310+
311+
return cfg.IPAddress
312+
}
313+
314+
func expandLbPrivateNetworkDHCPConfig(raw interface{}) *lb.PrivateNetworkDHCPConfig {
315+
if raw == nil || !raw.(bool) {
316+
return nil
317+
}
318+
return &lb.PrivateNetworkDHCPConfig{}
319+
}

scaleway/helpers_rdb.go

+16-16
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"time"
55

66
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
7-
"github.com/scaleway/scaleway-sdk-go/api/rdb/v1"
7+
rdbV1 "github.com/scaleway/scaleway-sdk-go/api/rdb/v1"
88
"github.com/scaleway/scaleway-sdk-go/scw"
99
)
1010

@@ -13,13 +13,13 @@ const (
1313
)
1414

1515
// newRdbAPI returns a new RDB API
16-
func newRdbAPI(m interface{}) *rdb.API {
16+
func newRdbAPI(m interface{}) *rdbV1.API {
1717
meta := m.(*Meta)
18-
return rdb.NewAPI(meta.scwClient)
18+
return rdbV1.NewAPI(meta.scwClient)
1919
}
2020

2121
// rdbAPIWithRegion returns a new lb API and the region for a Create request
22-
func rdbAPIWithRegion(d *schema.ResourceData, m interface{}) (*rdb.API, scw.Region, error) {
22+
func rdbAPIWithRegion(d *schema.ResourceData, m interface{}) (*rdbV1.API, scw.Region, error) {
2323
meta := m.(*Meta)
2424

2525
region, err := extractRegion(d, meta)
@@ -30,15 +30,15 @@ func rdbAPIWithRegion(d *schema.ResourceData, m interface{}) (*rdb.API, scw.Regi
3030
}
3131

3232
// rdbAPIWithRegionAndID returns an lb API with region and ID extracted from the state
33-
func rdbAPIWithRegionAndID(m interface{}, id string) (*rdb.API, scw.Region, string, error) {
33+
func rdbAPIWithRegionAndID(m interface{}, id string) (*rdbV1.API, scw.Region, string, error) {
3434
region, ID, err := parseRegionalID(id)
3535
if err != nil {
3636
return nil, "", "", err
3737
}
3838
return newRdbAPI(m), region, ID, nil
3939
}
4040

41-
func flattenRdbInstanceReadReplicas(readReplicas []*rdb.Endpoint) interface{} {
41+
func flattenRdbInstanceReadReplicas(readReplicas []*rdbV1.Endpoint) interface{} {
4242
replicasI := []map[string]interface{}(nil)
4343
for _, readReplica := range readReplicas {
4444
replicasI = append(replicasI, map[string]interface{}{
@@ -50,7 +50,7 @@ func flattenRdbInstanceReadReplicas(readReplicas []*rdb.Endpoint) interface{} {
5050
return replicasI
5151
}
5252

53-
func flattenInstanceSettings(settings []*rdb.InstanceSetting) interface{} {
53+
func flattenInstanceSettings(settings []*rdbV1.InstanceSetting) interface{} {
5454
res := make(map[string]string)
5555
for _, value := range settings {
5656
res[value.Name] = value.Value
@@ -59,11 +59,11 @@ func flattenInstanceSettings(settings []*rdb.InstanceSetting) interface{} {
5959
return res
6060
}
6161

62-
func expandInstanceSettings(i interface{}) []*rdb.InstanceSetting {
62+
func expandInstanceSettings(i interface{}) []*rdbV1.InstanceSetting {
6363
rawRule := i.(map[string]interface{})
64-
var res []*rdb.InstanceSetting
64+
var res []*rdbV1.InstanceSetting
6565
for key, value := range rawRule {
66-
res = append(res, &rdb.InstanceSetting{
66+
res = append(res, &rdbV1.InstanceSetting{
6767
Name: key,
6868
Value: value.(string),
6969
})
@@ -72,16 +72,16 @@ func expandInstanceSettings(i interface{}) []*rdb.InstanceSetting {
7272
return res
7373
}
7474

75-
func expandPrivateNetwork(data interface{}, exist bool) []*rdb.EndpointSpec {
75+
func expandPrivateNetwork(data interface{}, exist bool) []*rdbV1.EndpointSpec {
7676
if data == nil || !exist {
7777
return nil
7878
}
7979

80-
var res []*rdb.EndpointSpec
80+
var res []*rdbV1.EndpointSpec
8181
for _, pn := range data.([]interface{}) {
8282
r := pn.(map[string]interface{})
83-
spec := &rdb.EndpointSpec{
84-
PrivateNetwork: &rdb.EndpointSpecPrivateNetwork{
83+
spec := &rdbV1.EndpointSpec{
84+
PrivateNetwork: &rdbV1.EndpointSpecPrivateNetwork{
8585
PrivateNetworkID: expandID(r["pn_id"].(string)),
8686
ServiceIP: expandIPNet(r["ip"].(string)),
8787
},
@@ -92,7 +92,7 @@ func expandPrivateNetwork(data interface{}, exist bool) []*rdb.EndpointSpec {
9292
return res
9393
}
9494

95-
func flattenInstancePrivateNetwork(readEndpoints []*rdb.Endpoint) interface{} {
95+
func flattenInstancePrivateNetwork(readEndpoints []*rdbV1.Endpoint) interface{} {
9696
privateNetworkI := []map[string]interface{}(nil)
9797
if len(readEndpoints) == 0 {
9898
return nil
@@ -101,7 +101,7 @@ func flattenInstancePrivateNetwork(readEndpoints []*rdb.Endpoint) interface{} {
101101
if readPN.PrivateNetwork != nil {
102102
pn := readPN.PrivateNetwork
103103
privateNetworkI = append(privateNetworkI, map[string]interface{}{
104-
//"ip": flattenIPNet(pn.ServiceIP),
104+
"ip": flattenIPNet(pn.ServiceIP),
105105
"pn_id": pn.PrivateNetworkID,
106106
})
107107
}

scaleway/provider.go

+2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ func Provider(config *ProviderConfig) plugin.ProviderFunc {
8484
"scaleway_lb_backend": resourceScalewayLbBackend(),
8585
"scaleway_lb_certificate": resourceScalewayLbCertificate(),
8686
"scaleway_lb_frontend": resourceScalewayLbFrontend(),
87+
"scaleway_lb_private_network": resourceScalewayLbPrivateNetwork(),
88+
"scaleway_lb_route": resourceScalewayLbRoute(),
8789
"scaleway_registry_namespace": resourceScalewayRegistryNamespace(),
8890
"scaleway_rdb_acl": resourceScalewayRdbACL(),
8991
"scaleway_rdb_database": resourceScalewayRdbDatabase(),

scaleway/provider_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ type TestTools struct {
8484
}
8585

8686
func NewTestTools(t *testing.T) *TestTools {
87-
// Create an http client with recording capabilities
87+
// Create a http client with recording capabilities
8888
httpClient, cleanup, err := getHTTPRecoder(t, *UpdateCassettes)
8989
require.NoError(t, err)
9090

0 commit comments

Comments
 (0)