Skip to content

SWP: Add support for value "EXPLICIT_ROUTING_MODE" on field "routing_mode" on resource "google_network_services_gateway" #19826

Open
GoogleCloudPlatform/magic-modules
#14535
@Samir-Cit

Description

@Samir-Cit

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 a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.

Description

Important

This field is working on Beta and GA, but the API docs was not updated yet.

The Gateway API currently says that this new field routingMode supports two values: NEXT_HOP_ROUTING_MODE and EXPLICIT_ROUTING_MODE

During the development of this new fiel on this PR we noticied that the Gateway API doesn't return the value of this new field when the value is EXPLICIT_ROUTING_MODE (this field only return when the value is NEXT_HOP_ROUTING_MODE)
Because of this API behavior the value EXPLICIT_ROUTING_MODE was removed from the Terraform Enum field.
Even though the API says the field is required when type = "SECURE WEB GATEWAY" it accepts empty and set the value EXPLICIT_ROUTING_MODE, which apparently is the default.

We needed to remove the value from provider to make the resource work but we should add once the API changes.
Since the API says that this field is required when the gateway is SWP, it's good to have this value on the Terraform Enum and returning on the API (at least when the type is secure web proxy)

New or Affected Resource(s)

  • google_network_services_gateway

Potential Terraform Configuration

func testAccNetworkServicesGateway_swpAsNextHop(context map[string]interface{}) string {

Terraform code:

resource "google_network_services_gateway" "default" {
  provider = google-beta
  
  name                                 = "swp-test"
  project                              = {PROJECT_ID}
  location                             = "us-east1"
  addresses                            = ["10.128.0.99"]
  type                                 = "SECURE_WEB_GATEWAY"
routing_mode                           = "EXPLICIT_ROUTING_MODE"
  ports                                = [443]
  description                          = "my description"
  scope                                = "test-next-hop"
  certificate_urls                     = [google_certificate_manager_certificate.default.id]
  gateway_security_policy              = google_network_security_gateway_security_policy.default.id
  network                              = google_compute_network.default.id
  subnetwork                           = google_compute_subnetwork.default.id
  delete_swg_autogen_router_on_destroy = true
  depends_on                           = [google_compute_subnetwork.proxyonlysubnet]
}

Terraform output:

swp = {
  "addresses" = tolist([
    "10.128.0.99",
  ])
  "certificate_urls" = tolist([
    "projects/{PROJECT_ID}/locations/us-east1/certificates/sjr77--certificate-4a6ee8b6",
  ])
  "create_time" = "2024-10-04T18:30:48.804211670Z"
  "delete_swg_autogen_router_on_destroy" = true
  "description" = "my description"
  "effective_labels" = tomap({
    "goog-terraform-provisioned" = "true"
  })
  "gateway_security_policy" = "projects/{PROJECT_ID}/locations/us-east1/gatewaySecurityPolicies/sjr77--swpsecpolicy-4a6ee8b6"
  "id" = "projects/{PROJECT_ID}/locations/us-east1/gateways/swp-test"
  "labels" = tomap(null) /* of string */
  "location" = "us-east1"
  "name" = "swp-test"
  "network" = "projects/{PROJECT_ID}/global/networks/sjr77--network-4a6ee8b6"
  "ports" = tolist([
    443,
  ])
  "project" = "{PROJECT_ID}"
  "routing_mode" = ""
  "scope" = "test-next-hop"
  "self_link" = "https://networkservices.googleapis.com/v1alpha1/projects/{PROJECT_ID}/locations/us-east1/gateways/sjr77--swp-4a6ee8b6"
  "server_tls_policy" = ""
  "subnetwork" = "projects/{PROJECT_ID}/regions/us-east1/subnetworks/sjr77--subnet-4a6ee8b6"
  "terraform_labels" = tomap({
    "goog-terraform-provisioned" = "true"
  })
  "timeouts" = null /* object */
  "type" = "SECURE_WEB_GATEWAY"
  "update_time" = "2024-10-04T18:30:59.430175427Z"
}

See: "routing_mode": ""

References

https://cloud.google.com/secure-web-proxy/docs/deploy-next-hop

b/373406338

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions