Skip to content

Expose more fields from ServerIP in scaleway_instance_server.public_ips #2151

Open
@rutgerbrf

Description

@rutgerbrf

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

The way the schema of scaleway_instance_server.public_ips is currently defined, it currently doesn't export any fields other than id and address:

"public_ips": {
Type: schema.TypeList,
Optional: true,
Computed: true,
Description: "List of public IPs attached to your instance",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": {
Type: schema.TypeString,
Computed: true,
Description: "ID of the IP",
},
"address": {
Type: schema.TypeString,
Computed: true,
Description: "IP Address",
},
},
},
},

However, the ServerIP struct in Scaleway's Go SDK (and therefore the Scaleway API) exposes many more fields, as we can see here: https://github.com/scaleway/scaleway-sdk-go/blob/fc4689b18e372b0135c69a13fc2fe771d32a9d0c/api/instance/v1/instance_sdk.go#L1433-L1451
An example of a useful field would be gateway (personally, I wanted to use this as a Terraform output). I would suggest that all currently unexported fields gateway, netmask, family, dynamic and optionally provisioning_mode are exported.

New or Affected Resource(s)

  • scaleway_instance_server (the schema for the public_ips field would be extended)

Potential Terraform Configuration

resource "scaleway_instance_ip" "example_ipv4" {
  type = "routed_ipv4"
}

resource "scaleway_instance_ip" "example_ipv6" {
  type = "routed_ipv6"
}

resource "scaleway_instance_server" "example" {
  name  = "example"
  zone  = "nl-ams-1"
  type  = "DEV1-S"
  image = "debian-bullseye"

  ip_ids = [scaleway_instance_ip.example_ipv4.id, scaleway_instance_ip.example_ipv6.id]

  routed_ip_enabled = true
}

output "instance_public_ips" {
  value = scaleway_instance_server.example.public_ips
}

This configuration would output all IP's, including respective gateways, netmasks etc. of the attached instance.

References

(none so far)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions