Skip to content

Commit ae36673

Browse files
committed
parent 9871d05
author jaime Bernabe <[email protected]> 1635170228 +0200 committer jaime Bernabe <[email protected]> 1635261729 +0200 parent 9871d05 author jaime Bernabe <[email protected]> 1635170228 +0200 committer jaime Bernabe <[email protected]> 1635261352 +0200 parent 9871d05 author jaime Bernabe <[email protected]> 1635170228 +0200 committer jaime Bernabe <[email protected]> 1635261348 +0200 parent 9871d05 author jaime Bernabe <[email protected]> 1635170228 +0200 committer jaime Bernabe <[email protected]> 1635261337 +0200 parent 9871d05 author jaime Bernabe <[email protected]> 1635170228 +0200 committer jaime Bernabe <[email protected]> 1635261329 +0200 feat(vpcgw): add support for PAT rules (scaleway#864) * feat(gtw-networks): add resource vpc-gateway-network * feat(gtw-networks): test cases and wait management * feat(vpcgw): add support for DHCP (scaleway#865) * feat(vpcgw): add support for DHCP * 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]> feat(pat-rules): add test and rebase * feat(pat-rules): add new test and gateway_network * feat(rdb): docs pat rules and test * feat(rdb): add dependency in test * fix(gw-network): handle mac_address null and change default value masquerade * fix(pat-rules): update cassette pat-rules and test Co-authored-by: scaleway-bot <[email protected]> Co-authored-by: Monitob <[email protected]> fix(pat-rules): remove useless cassette (scaleway#900) remove useless cassette 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]> docs(resources): add missing quotes to examples (scaleway#906) Signed-off-by: Theo Bob Massard <[email protected]> chore(deps): bump github.com/aws/aws-sdk-go from 1.41.8 to 1.41.9 (scaleway#905) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.41.8 to 1.41.9. - [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.8...v1.41.9) --- 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: Rémy Léone <[email protected]> fix(lb-pn): fix lint
1 parent 9871d05 commit ae36673

14 files changed

+1336
-96
lines changed

docs/resources/iot_device.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ Creates and manages Scaleway IoT Hub Instances. For more information, see [the d
1616
### Basic
1717

1818
```hcl
19-
resource scaleway_iot_hub main {
19+
resource "scaleway_iot_hub" "main" {
2020
name = "test-iot"
2121
product_plan = "plan_shared"
2222
}
2323
24-
resource scaleway_iot_device main {
24+
resource "scaleway_iot_device" "main" {
2525
hub_id = scaleway_iot_hub.main.id
2626
name = "test-iot"
2727
}
@@ -30,16 +30,16 @@ resource scaleway_iot_device main {
3030
### With custom certificate
3131

3232
```hcl
33-
resource scaleway_iot_hub main {
33+
resource "scaleway_iot_hub" "main" {
3434
name = "test-iot"
3535
product_plan = "plan_shared"
3636
}
3737
38-
data local_file device_cert {
38+
data "local_file" "device_cert" {
3939
filename = "device-certificate.pem"
4040
}
4141
42-
resource scaleway_iot_device main {
42+
resource "scaleway_iot_device" "main" {
4343
hub_id = scaleway_iot_hub.main.id
4444
name = "test-iot"
4545
certificate {

docs/resources/iot_hub.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Creates and manages Scaleway IoT Hub Instances. For more information, see [the d
1616
### Basic
1717

1818
```hcl
19-
resource scaleway_iot_hub main {
19+
resource "scaleway_iot_hub" "main" {
2020
name = "test-iot"
2121
product_plan = "plan_shared"
2222
}

docs/resources/lb_private_network.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ For more information, see [the documentation](https://developers.scaleway.com/en
1414
### Basic
1515

1616
```hcl
17-
resource scaleway_vpc_private_network pn01 {
17+
resource "scaleway_vpc_private_network" "pn01" {
1818
name = "test-lb-pn"
1919
}
2020
21-
resource scaleway_lb_ip ip01 {}
21+
resource "scaleway_lb_ip" "ip01" {}
2222
23-
resource scaleway_lb lb01 {
23+
resource "scaleway_lb" "lb01" {
2424
ip_id = scaleway_lb_ip.ip01.id
2525
name = "test-lb"
2626
type = "lb-s"
2727
release_ip = true
2828
}
2929
30-
resource scaleway_lb_private_network lb01pn01 {
30+
resource "scaleway_lb_private_network" "lb01pn01" {
3131
lb_id = scaleway_lb.lb01.id
3232
private_network_id = scaleway_vpc_private_network.pn01.id
3333
static_config = ["172.16.0.100", "172.16.0.101"]

docs/resources/rdb_acl.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ For more information, see [the documentation](https://developers.scaleway.com/en
1414
### Basic
1515

1616
```hcl
17-
resource scaleway_rdb_acl main {
17+
resource "scaleway_rdb_acl" "main" {
1818
instance_id = scaleway_rdb_instance.main.id
1919
acl_rules {
2020
ip = "1.2.3.4/32"

docs/resources/vpc_gateway_network.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@ For more information, see [the documentation](https://developers.scaleway.com/en
1313
## Example
1414

1515
```hcl
16-
resource scaleway_vpc_private_network pn01 {
16+
resource "scaleway_vpc_private_network" "pn01" {
1717
name = "pn_test_network"
1818
}
1919
20-
resource scaleway_vpc_public_gateway_ip gw01 {
20+
resource "scaleway_vpc_public_gateway_ip" "gw01" {
2121
}
2222
23-
resource scaleway_vpc_public_gateway_dhcp dhcp01 {
23+
resource "scaleway_vpc_public_gateway_dhcp" "dhcp01" {
2424
subnet = "192.168.1.0/24"
2525
}
2626
27-
resource scaleway_vpc_public_gateway pg01 {
27+
resource "scaleway_vpc_public_gateway" "pg01" {
2828
name = "foobar"
2929
type = "VPC-GW-S"
3030
ip_id = scaleway_vpc_public_gateway_ip.gw01.id
3131
}
3232
33-
resource scaleway_vpc_gateway_network main {
33+
resource "scaleway_vpc_gateway_network" "main" {
3434
gateway_id = scaleway_vpc_public_gateway.pg01.id
3535
private_network_id = scaleway_vpc_private_network.pn01.id
3636
dhcp_id = scaleway_vpc_public_gateway_dhcp.dhcp01.id

docs/resources/vpc_public_gateway_pat_rule.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,26 @@ For more information, see [the documentation](https://developers.scaleway.com/en
1212
## Example
1313

1414
```hcl
15-
resource scaleway_vpc_public_gateway pg01 {
15+
resource "scaleway_vpc_public_gateway" "pg01" {
1616
type = "VPC-GW-S"
1717
}
1818
19-
resource scaleway_vpc_public_gateway_dhcp dhcp01 {
19+
resource "scaleway_vpc_public_gateway_dhcp" "dhcp01" {
2020
subnet = "192.168.1.0/24"
2121
}
2222
23-
resource scaleway_vpc_private_network pn01 {
23+
resource "scaleway_vpc_private_network" "pn01" {
2424
name = "pn_test_network"
2525
}
2626
27-
resource scaleway_vpc_gateway_network gn01 {
27+
resource "scaleway_vpc_gateway_network" "gn01" {
2828
gateway_id = scaleway_vpc_public_gateway.pg01.id
2929
private_network_id = scaleway_vpc_private_network.pn01.id
3030
dhcp_id = scaleway_vpc_public_gateway_dhcp.dhcp01.id
3131
cleanup_dhcp = true
3232
}
3333
34-
resource scaleway_vpc_public_gateway_pat_rule main {
34+
resource "scaleway_vpc_public_gateway_pat_rule" "main" {
3535
gateway_id = scaleway_vpc_public_gateway.pg01.id
3636
private_ip = scaleway_vpc_public_gateway_dhcp.dhcp01.address
3737
private_port = 42

go.mod

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

33
require (
4-
github.com/aws/aws-sdk-go v1.41.8
4+
github.com/aws/aws-sdk-go v1.41.9
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

go.sum

+2-4
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.8 h1:j6imzwVyWQYuQxbkPmg2MdMmLB+Zw+U3Ewi59YF8Rwk=
66-
github.com/aws/aws-sdk-go v1.41.8/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q=
65+
github.com/aws/aws-sdk-go v1.41.9 h1:Xb4gWjA90ju0u6Fr2lMAsMOGuhw1g4sTFOqh9SUHgN0=
66+
github.com/aws/aws-sdk-go v1.41.9/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=
@@ -284,8 +284,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
284284
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
285285
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
286286
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
287-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20211005125957-db499d89a262 h1:ioN4zmp/4AoCJ/BbuwmkpH+bnSSntgWMUN1PkQ46/nI=
288-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20211005125957-db499d89a262/go.mod h1:NnxccdAsg2lS0ng/kfLVLemUQR50FCM/cdZv2gqKDhw=
289287
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20211012131628-5b68cc2973b3 h1:PhWAnBbS6rWqa4A4KVCAda5ry9o2Tk3kOVjBw3DvW9s=
290288
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20211012131628-5b68cc2973b3/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
291289
github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4=

scaleway/helpers_rdb.go

+18-3
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,34 @@ func expandPrivateNetwork(data interface{}, exist bool) []*rdbV1.EndpointSpec {
9292
return res
9393
}
9494

95+
func expandLoadBalancer(data interface{}) []*rdbV1.EndpointSpec {
96+
if data == nil || !data.(bool) {
97+
return nil
98+
}
99+
100+
var res []*rdbV1.EndpointSpec
101+
102+
res = append(res, &rdbV1.EndpointSpec{
103+
LoadBalancer: &rdbV1.EndpointSpecLoadBalancer{}})
104+
105+
return res
106+
}
107+
95108
func flattenInstancePrivateNetwork(readEndpoints []*rdbV1.Endpoint) interface{} {
96-
privateNetworkI := []map[string]interface{}(nil)
97109
if len(readEndpoints) == 0 {
98110
return nil
99111
}
112+
113+
pnI := []map[string]interface{}(nil)
100114
for _, readPN := range readEndpoints {
101115
if readPN.PrivateNetwork != nil {
102116
pn := readPN.PrivateNetwork
103-
privateNetworkI = append(privateNetworkI, map[string]interface{}{
117+
pnI = append(pnI, map[string]interface{}{
104118
"ip": flattenIPNet(pn.ServiceIP),
105119
"pn_id": pn.PrivateNetworkID,
106120
})
107121
}
108122
}
109-
return privateNetworkI
123+
124+
return pnI
110125
}

scaleway/resource_rdb_instance.go

+22-6
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,19 @@ func resourceScalewayRdbInstance() *schema.Resource {
118118
Computed: true,
119119
Description: "Volume size (in GB) when volume_type is not lssd",
120120
},
121+
"load_balancer": {
122+
ConflictsWith: []string{"private_network"},
123+
Type: schema.TypeBool,
124+
Optional: true,
125+
Default: false,
126+
Description: "Expose data base exposed by a load-balancer",
127+
},
121128
"private_network": {
122-
Type: schema.TypeList,
123-
Optional: true,
124-
MaxItems: 1,
125-
Description: "List of private network to expose your database instance",
129+
ConflictsWith: []string{"load_balancer"},
130+
Type: schema.TypeList,
131+
Optional: true,
132+
MaxItems: 1,
133+
Description: "List of private network to expose your database instance",
126134
Elem: &schema.Resource{
127135
Schema: map[string]*schema.Schema{
128136
"ip": {
@@ -213,6 +221,11 @@ func resourceScalewayRdbInstanceCreate(ctx context.Context, d *schema.ResourceDa
213221
createReq.InitEndpoints = expandPrivateNetwork(pn, pnExist)
214222
}
215223

224+
lb, lbExist := d.GetOk("load_balancer")
225+
if lbExist {
226+
createReq.InitEndpoints = expandLoadBalancer(lb)
227+
}
228+
216229
if size, ok := d.GetOk("volume_size_in_gb"); ok {
217230
if createReq.VolumeType != rdbV1.VolumeTypeBssd {
218231
return diag.FromErr(fmt.Errorf("volume_size_in_gb should be used with volume_type %s only", rdbV1.VolumeTypeBssd.String()))
@@ -241,7 +254,7 @@ func resourceScalewayRdbInstanceCreate(ctx context.Context, d *schema.ResourceDa
241254
// Configure Schedule Backup
242255
// BackupScheduleFrequency and BackupScheduleRetention can only configure after instance creation
243256
if !d.Get("disable_backup").(bool) {
244-
updateReq := &rdb.UpdateInstanceRequest{
257+
updateReq := &rdbV1.UpdateInstanceRequest{
245258
Region: region,
246259
InstanceID: res.ID,
247260
}
@@ -332,6 +345,9 @@ func resourceScalewayRdbInstanceRead(ctx context.Context, d *schema.ResourceData
332345
// set settings
333346
_ = d.Set("settings", flattenInstanceSettings(res.Settings))
334347

348+
lbBoolean := *expandBoolPtr(d.Get("load_balancer"))
349+
_ = d.Set("load_balancer", lbBoolean)
350+
335351
// set private_network
336352
_ = d.Set("private_network", flattenInstancePrivateNetwork(res.Endpoints))
337353

@@ -514,7 +530,7 @@ func resourceScalewayRdbInstanceDelete(ctx context.Context, d *schema.ResourceDa
514530
if err != nil && !is404Error(err) {
515531
return diag.FromErr(err)
516532
}
517-
533+
// Lastly wait in case the instance is in a transient state
518534
_, err = rdbAPI.WaitForInstance(&rdbV1.WaitForInstanceRequest{
519535
InstanceID: ID,
520536
Region: region,

scaleway/resource_rdb_instance_test.go

+26-7
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func TestAccScalewayRdbInstance_Settings(t *testing.T) {
150150
})
151151
}
152152

153-
func TestAccScalewayRdbInstance_Endpoints(t *testing.T) {
153+
func TestAccScalewayRdbInstance_LoadBalancer(t *testing.T) {
154154
tt := NewTestTools(t)
155155
defer tt.Cleanup()
156156
resource.ParallelTest(t, resource.TestCase{
@@ -160,7 +160,6 @@ func TestAccScalewayRdbInstance_Endpoints(t *testing.T) {
160160
Steps: []resource.TestStep{
161161
{
162162
Config: `
163-
resource scaleway_lb_ip ip01 {}
164163
resource scaleway_rdb_instance main {
165164
name = "test-rdb"
166165
node_type = "db-dev-s"
@@ -169,19 +168,18 @@ func TestAccScalewayRdbInstance_Endpoints(t *testing.T) {
169168
disable_backup = true
170169
user_name = "my_initial_user"
171170
password = "thiZ_is_v&ry_s3cret"
172-
load_balancer_id = "${scaleway_lb_ip.ip01.id}"
171+
load_balancer = true
173172
}
174173
`,
175174
Check: resource.ComposeTestCheckFunc(
176175
testAccCheckScalewayRdbExists(tt, "scaleway_rdb_instance.main"),
177-
resource.TestCheckResourceAttrSet("scaleway_rdb_instance.main", "load_balancer_id"),
176+
resource.TestCheckResourceAttrSet("scaleway_rdb_instance.main", "load_balancer"),
178177
),
179178
},
180179
},
181180
})
182181
}
183182

184-
185183
func TestAccScalewayRdbInstance_PrivateNetwork(t *testing.T) {
186184
tt := NewTestTools(t)
187185
defer tt.Cleanup()
@@ -190,6 +188,17 @@ func TestAccScalewayRdbInstance_PrivateNetwork(t *testing.T) {
190188
ProviderFactories: tt.ProviderFactories,
191189
CheckDestroy: testAccCheckScalewayRdbInstanceDestroy(tt),
192190
Steps: []resource.TestStep{
191+
{
192+
Config: `
193+
resource scaleway_vpc_private_network pn01 {
194+
name = "my_private_network"
195+
tags = ["tag0", "tag1", "rdb_pn"]
196+
}
197+
`,
198+
Check: resource.ComposeTestCheckFunc(
199+
resource.TestCheckResourceAttr("scaleway_vpc_private_network.pn01", "name", "my_private_network"),
200+
),
201+
},
193202
{
194203
Config: `
195204
resource scaleway_vpc_private_network pn01 {
@@ -217,11 +226,21 @@ func TestAccScalewayRdbInstance_PrivateNetwork(t *testing.T) {
217226
`,
218227
Check: resource.ComposeTestCheckFunc(
219228
testAccCheckScalewayRdbExists(tt, "scaleway_rdb_instance.main"),
220-
resource.TestCheckResourceAttrSet("scaleway_rdb_instance.main", "private_network"),
221-
resource.TestCheckResourceAttrSet("scaleway_rdb_instance.main", "private_network.0.pn_id"),
229+
resource.TestCheckResourceAttr("scaleway_rdb_instance.main", "private_network.#", "1"),
222230
resource.TestCheckResourceAttr("scaleway_rdb_instance.main", "private_network.0.ip", "192.168.1.42/24"),
223231
),
224232
},
233+
{
234+
Config: `
235+
resource scaleway_vpc_private_network pn01 {
236+
name = "my_private_network_without_attachment"
237+
tags = ["tag0", "tag1", "rdb_pn"]
238+
}
239+
`,
240+
Check: resource.ComposeTestCheckFunc(
241+
resource.TestCheckResourceAttr("scaleway_vpc_private_network.pn01", "name", "my_private_network_without_attachment"),
242+
),
243+
},
225244
},
226245
})
227246
}

scaleway/testdata/rdb-instance-endpoints.cassette.yaml

-37
This file was deleted.

0 commit comments

Comments
 (0)