terraform-provider-scaleway icon indicating copy to clipboard operation
terraform-provider-scaleway copied to clipboard

Expose more fields from ServerIP in scaleway_instance_server.public_ips

Open rutgerbrf opened this issue 1 year ago • 0 comments

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: https://github.com/scaleway/terraform-provider-scaleway/blob/2f91ca546c65ffa338a9727794be662cc620ae18/scaleway/resource_instance_server.go#L286-L305 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)

rutgerbrf avatar Oct 06 '23 13:10 rutgerbrf