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

Router interface API Documentation suggests that some attributes are required,But making API calls without these attributes also works

Open AlfatahB opened this issue 2 years ago • 4 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 me too comments, 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.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

Terraform v1.2.8

  • provider registry.terraform.io/hashicorp/google v4.34.0

Affected Resource(s)

  • google_compute_router_interface

Steps to Reproduce

API Documentation suggests that:

Router interfaces. Each interface requires either one linked resource, (for example, linkedVpnTunnel), or IP address and IP address range (for example, ipRange), or both.

google_compute_router_interface in Terraform Provider is behaving correctly as per the above API docs. But, If I create Router and provide a Router interface without providing any of these attributes (i.e. either one linked resource, (for example, linkedVpnTunnel), or IP address and IP address range (for example, ipRange), or both), then it was being created. So, I raised a bug for the same.

References

  • #9688
  • https://cloud.google.com/compute/docs/reference/rest/v1/routers

AlfatahB avatar Sep 07 '22 12:09 AlfatahB

@AlfatahB can you share your debug log that can demo making API calls without these attributes also works?

edwardmedia avatar Sep 07 '22 22:09 edwardmedia

By making Create call (https://compute.googleapis.com/compute/v1/projects/project-name/regions/us-central1/routers) with the following request body, the router is being created along with interface without providing either linkedResources or ipRange Request Body for Post Call:

{
    "name": "test-router",
    "network": "https://www.googleapis.com/compute/v1/projects/project-name/global/networks/test-network",
    "interfaces": [
        {
            "name" : "test-router-interface"
           # Here, I am not providing the linkedResources or ipRange
        }
    ]
}

To confirm this, I have also made Read call (https://compute.googleapis.com/compute/v1/projects/project-name/regions/us-central1/routers) Response Body for Get call:

{
    "kind": "compute#routerList",
    "id": "projects/project-name/regions/us-central1/routers",
    "items": [
        {
            "kind": "compute#router",
            "id": "5155929330873040434",
            "creationTimestamp": "2022-09-08T03:15:57.123-07:00",
            "name": "test-router",
            "region": "https://www.googleapis.com/compute/v1/projects/project-name/regions/us-central1",
            "network": "https://www.googleapis.com/compute/v1/projects/project-name/global/networks/test-network",
            "interfaces": [
                {
                    "name": "test-router-interface"
                }
            ],
            "selfLink": "https://www.googleapis.com/compute/v1/projects/project-name/regions/us-central1/routers/test-router"
        }
    ],
    "selfLink": "https://www.googleapis.com/compute/v1/projects/project-name/regions/us-central1/routers"
}

AlfatahB avatar Sep 08 '22 12:09 AlfatahB

@shuyama1 shouldn't this be an API issue as well, related to b/241976681?

edwardmedia avatar Sep 11 '22 15:09 edwardmedia

This feature is implemented based on the API description. Filed a ticket b/248037977 against the upstream API to confirm if the requirements are still valid

shuyama1 avatar Sep 21 '22 16:09 shuyama1

@shuyama1 Any updates regarding this?

AlfatahB avatar Nov 02 '22 14:11 AlfatahB