Skip to content

Commit 4088807

Browse files
committed
feat(instance): server: add more fields on public_ips
1 parent 0caa7e6 commit 4088807

File tree

5 files changed

+572
-531
lines changed

5 files changed

+572
-531
lines changed

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
@@ -351,6 +351,31 @@ func ResourceServer() *schema.Resource {
351351
Computed: true,
352352
Description: "IP Address",
353353
},
354+
"gateway": {
355+
Type: schema.TypeString,
356+
Computed: true,
357+
Description: "Gateway's IP address",
358+
},
359+
"netmask": {
360+
Type: schema.TypeString,
361+
Computed: true,
362+
Description: "CIDR netmask",
363+
},
364+
"family": {
365+
Type: schema.TypeString,
366+
Computed: true,
367+
Description: "IP address family (inet or inet6)",
368+
},
369+
"dynamic": {
370+
Type: schema.TypeBool,
371+
Computed: true,
372+
Description: "Whether the IP is dynamic",
373+
},
374+
"provisioning_mode": {
375+
Type: schema.TypeString,
376+
Computed: true,
377+
Description: "Provisioning mode of the IP address",
378+
},
354379
},
355380
},
356381
},

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
{

0 commit comments

Comments
 (0)