Skip to content

Commit 4d81a46

Browse files
authored
Merge branch 'master' into tfproviderlintx
2 parents a891fac + 9b77f47 commit 4d81a46

File tree

9 files changed

+584
-531
lines changed

9 files changed

+584
-531
lines changed

.github/workflows/documentation.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,4 @@ jobs:
6565
go-version: ${{ env.GO_VERSION }}
6666
- uses: hashicorp/setup-terraform@v3
6767
- run: go tool tfplugindocs validate
68+
- run: go tool tfplugindocs generate

docs/resources/instance_server.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,13 @@ In addition to all arguments above, the following attributes are exported:
295295
- `private_ip` - The Scaleway internal IP address of the server (Deprecated use [ipam_ip datasource](../data-sources/ipam_ip.md#instance-private-network-ip) instead).
296296
- `public_ip` - The public IP address of the server (Deprecated use `public_ips` instead).
297297
- `public_ips` - The list of public IPs of the server.
298-
- `id` - The ID of the IP
299-
- `address` - The address of the IP
298+
- `id` - The ID of the IP.
299+
- `address` - The address of the IP.
300+
- `gateway` - The IP of the Gateway associated with the IP.
301+
- `netmask` - The CIDR netmask of the IP.
302+
- `family` - The IP address' family.
303+
- `dynamic` - Whether the IP is dynamic.
304+
- `provisioning_mode` - The provisioning mode of the IP
300305
- `ipv6_address` - The default ipv6 address routed to the server. ( Only set when enable_ipv6 is set to true )
301306
Deprecated: Please use a scaleway_instance_ip with a `routed_ipv6` type.
302307
- `ipv6_gateway` - The ipv6 gateway address. ( Only set when enable_ipv6 is set to true )

internal/services/instance/server.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,31 @@ func ResourceServer() *schema.Resource {
352352
Computed: true,
353353
Description: "IP Address",
354354
},
355+
"gateway": {
356+
Type: schema.TypeString,
357+
Computed: true,
358+
Description: "Gateway's IP address",
359+
},
360+
"netmask": {
361+
Type: schema.TypeString,
362+
Computed: true,
363+
Description: "CIDR netmask",
364+
},
365+
"family": {
366+
Type: schema.TypeString,
367+
Computed: true,
368+
Description: "IP address family (inet or inet6)",
369+
},
370+
"dynamic": {
371+
Type: schema.TypeBool,
372+
Computed: true,
373+
Description: "Whether the IP is dynamic",
374+
},
375+
"provisioning_mode": {
376+
Type: schema.TypeString,
377+
Computed: true,
378+
Description: "Provisioning mode of the IP address",
379+
},
355380
},
356381
},
357382
},

internal/services/instance/server_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,6 +1512,12 @@ func TestAccServer_IPs(t *testing.T) {
15121512
arePrivateNICsPresent(tt, "scaleway_instance_server.main"),
15131513
resource.TestCheckResourceAttr("scaleway_instance_server.main", "public_ips.#", "1"),
15141514
resource.TestCheckResourceAttrPair("scaleway_instance_server.main", "public_ips.0.id", "scaleway_instance_ip.ip1", "id"),
1515+
resource.TestCheckResourceAttrSet("scaleway_instance_server.main", "public_ips.0.address"),
1516+
resource.TestCheckResourceAttr("scaleway_instance_server.main", "public_ips.0.gateway", "62.210.0.1"),
1517+
resource.TestCheckResourceAttr("scaleway_instance_server.main", "public_ips.0.netmask", "32"),
1518+
resource.TestCheckResourceAttr("scaleway_instance_server.main", "public_ips.0.family", "inet"),
1519+
resource.TestCheckResourceAttr("scaleway_instance_server.main", "public_ips.0.dynamic", "false"),
1520+
resource.TestCheckResourceAttr("scaleway_instance_server.main", "public_ips.0.provisioning_mode", "dhcp"),
15151521
),
15161522
},
15171523
{

internal/services/instance/testdata/server-ips.cassette.yaml

Lines changed: 527 additions & 527 deletions
Large diffs are not rendered by default.

internal/services/instance/types.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,13 @@ func flattenServerPublicIPs(zone scw.Zone, ips []*instance.ServerIP) []any {
9393

9494
for i, ip := range ips {
9595
flattenedIPs[i] = map[string]any{
96-
"id": zonal.NewIDString(zone, ip.ID),
97-
"address": ip.Address.String(),
96+
"id": zonal.NewIDString(zone, ip.ID),
97+
"address": ip.Address.String(),
98+
"gateway": ip.Gateway.String(),
99+
"netmask": ip.Netmask,
100+
"family": ip.Family.String(),
101+
"dynamic": ip.Dynamic,
102+
"provisioning_mode": ip.ProvisioningMode.String(),
98103
}
99104
}
100105

internal/services/mongodb/instance.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,16 +189,19 @@ func ResourceInstance() *schema.Resource {
189189
Schema: map[string]*schema.Schema{
190190
"id": {
191191
Type: schema.TypeString,
192+
Optional: true,
192193
Computed: true,
193194
Description: "ID of the public network",
194195
},
195196
"port": {
196197
Type: schema.TypeInt,
198+
Optional: true,
197199
Computed: true,
198200
Description: "TCP port of the endpoint",
199201
},
200202
"dns_record": {
201203
Type: schema.TypeString,
204+
Optional: true,
202205
Computed: true,
203206
Description: "The DNS record of your endpoint",
204207
},

internal/services/rdb/read_replica.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,26 +61,31 @@ func ResourceReadReplica() *schema.Resource {
6161
"endpoint_id": {
6262
Type: schema.TypeString,
6363
Description: "UUID of the endpoint (UUID format).",
64+
Optional: true,
6465
Computed: true,
6566
},
6667
"ip": {
6768
Type: schema.TypeString,
6869
Description: "IPv4 address of the endpoint (IP address). Only one of ip and hostname may be set.",
70+
Optional: true,
6971
Computed: true,
7072
},
7173
"port": {
7274
Type: schema.TypeInt,
7375
Description: "TCP port of the endpoint.",
76+
Optional: true,
7477
Computed: true,
7578
},
7679
"name": {
7780
Type: schema.TypeString,
7881
Description: "Name of the endpoint.",
82+
Optional: true,
7983
Computed: true,
8084
},
8185
"hostname": {
8286
Type: schema.TypeString,
8387
Description: "Hostname of the endpoint. Only one of ip and hostname may be set.",
88+
Optional: true,
8489
Computed: true,
8590
},
8691
},

internal/services/redis/cluster.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,12 @@ func ResourceCluster() *schema.Resource {
193193
"id": {
194194
Type: schema.TypeString,
195195
Computed: true,
196+
Optional: true,
196197
Description: "UUID of the public network to be connected to the cluster",
197198
},
198199
"port": {
199200
Type: schema.TypeInt,
201+
Optional: true,
200202
Computed: true,
201203
Description: "TCP port of the endpoint",
202204
},
@@ -206,6 +208,7 @@ func ResourceCluster() *schema.Resource {
206208
Elem: &schema.Schema{
207209
Type: schema.TypeString,
208210
},
211+
Optional: true,
209212
Computed: true,
210213
},
211214
},

0 commit comments

Comments
 (0)