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

google_compute_url_map: support testing headers, and URL redirects/rewrites

Open benkuhn opened this issue 4 years ago • 2 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 the 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 the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.

Description

The Google Cloud REST API for URL maps supports some parameters in the tests block that don't appear to be supported by the current version of the Terraform provider:

  • headers
  • expectedOutputUrl
  • expectedRedirectResponseCode

It would be great to have support for these so I can test some tricky routing on my load balancer.

New or Affected Resource(s)

  • google_compute_url_map

Potential Terraform Configuration

resource "google_compute_url_map" "well-tested-urlmap" {
  # ...
  test {
    description = "example test"
    host = "example.com"
    path = "/a/path"
    header {
      name = "X-Test-Header"
      value = "foo"
    }
    header {
      name = "X-Another-Test-Header"
      value = "bar"
    }
    expected_output_url = "/i-rewrote/a/path"
    expected_redirect_response_code = 302
  }
}

b/359704736

benkuhn avatar Jul 09 '21 14:07 benkuhn

Currently the test block of google_compute_url_map doesn't support these arguments:

  • headers
  • expectedOutputUrl
  • expectedRedirectResponseCode

ggtisc avatar Aug 14 '24 01:08 ggtisc

Does https://github.com/hashicorp/terraform-provider-google/pull/23199 resolve this?

jsok avatar Jun 17 '25 23:06 jsok

It looks like it.

https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_url_map#nested_test

aryehb avatar Jun 18 '25 22:06 aryehb