OpenStack provider: no way to specify qos_policy_id for openstack_networking_router_v2

When using OpenStack CLI, it is possible to set qos_policy. For instance:

$ openstack router set --qos-policy <my_policy> <my_gateway>

The CLI sends a PUT request with:

{"router": {"external_gateway_info": {"network_id": "xxxxxx", "qos_policy_id": "xxxx-xxxx-xxxx-xxxx"}}}

The OpenStack terraform provider does not provide an option qos_policy or qos_policy_id for openstack_networking_router_v2 as it does for openstack_networking_network_v2.
This could be done using value_specs with something like:

  value_specs = {
    external_gateway_info = [{qos_policy_id = "xxxx-xxxx-xxxx-xxxx"}]

But terraform apply does not accept:

Inappropriate value for attribute "value_specs": element "external_gateway_info": string required

If I set:

  value_specs = {
    external_gateway_info = "{\"qos_policy_id\": \"xxxx-xxxx-xxxx-xxxx\"}"

I get now an error from the provider:

Error: Error creating openstack_networking_router_v2: Bad request with: [POST], error message: {"NeutronError": {"type": "HTTPBadRequest", "message": "Invalid input for external_gateway_info. Reason: '{\"qos_policy_id\": \"xxxx-xxxx-xxxx-xxxx\"}' is not a dictionary.", "detail": ""}}

Is there a way to achieve it?
Is there a plan to add qos_policy_id to openstack_networking_router_v2?

Thanks for your help

Hi !

Gophercloud currently hasn’t implemented the qos_policy_id for the router. I have a PR open for this. Once this will be merged I’ll implement this on the provider side.

Best regard!

Update : Gophercloud accepted the change. I am now waiting for the terraform community (and for my change to be shipped on a future release :slight_smile: )