# Copyright 2024 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
name: 'ForwardingRule'
api_variant_patterns:
  - 'projects/{project}/regions/{region}/forwardingRules/{forwardingRule}'
kind: 'compute#forwardingRule'
description: |
  A ForwardingRule resource. A ForwardingRule resource specifies which pool
  of target virtual machines to forward a packet to if it matches the given
  [IPAddress, IPProtocol, portRange] tuple.
# Has a separate endpoint for labels
exclude_attribution_label: true
references:
  guides:
    'Official Documentation': 'https://cloud.google.com/compute/docs/load-balancing/network/forwarding-rules'
  api: 'https://cloud.google.com/compute/docs/reference/v1/forwardingRules'
docs:
base_url: 'projects/{{project}}/regions/{{region}}/forwardingRules'
has_self_link: true
immutable: true
timeouts:
  insert_minutes: 20
  update_minutes: 20
  delete_minutes: 20
async:
  actions: ['create', 'delete', 'update']
  type: 'OpAsync'
  operation:
    base_url: '{{op_id}}'
  result:
    resource_inside_response: false
collection_url_key: 'items'
custom_code:
  constants: 'templates/terraform/constants/compute_forwarding_rule.go.tmpl'
  pre_create: 'templates/terraform/pre_create/compute_forwarding_rule.go.tmpl'
  post_create: 'templates/terraform/post_create/labels.tmpl'
custom_diff:
  - 'forwardingRuleCustomizeDiff'
legacy_long_form_project: true
sweeper:
  dependencies:
    - "google_network_connectivity_service_connection_policy"
  url_substitutions:
    - region: "us-west2"
    - region: "us-central1"
    - region: "europe-west4"
    - region: "europe-west1"
    - region: "us-west1"
examples:
  - name: 'internal_http_lb_with_mig_backend'
    primary_resource_id: 'google_compute_forwarding_rule'
    min_version: 'beta'
    vars:
      ilb_network_name: 'l7-ilb-network'
      proxy_subnet_name: 'l7-ilb-proxy-subnet'
      backend_subnet_name: 'l7-ilb-subnet'
      forwarding_rule_name: 'l7-ilb-forwarding-rule'
      target_http_proxy_name: 'l7-ilb-target-http-proxy'
      regional_url_map_name: 'l7-ilb-regional-url-map'
      backend_service_name: 'l7-ilb-backend-subnet'
      mig_template_name: 'l7-ilb-mig-template'
      hc_name: 'l7-ilb-hc'
      mig_name: 'l7-ilb-mig1'
      fw_allow_iap_hc_name: 'l7-ilb-fw-allow-iap-hc'
      fw_allow_ilb_to_backends_name: 'l7-ilb-fw-allow-ilb-to-backends'
      vm_test_name: 'l7-ilb-test-vm'
    ignore_read_extra:
      - 'port_range'
      - 'target'
  - name: 'internal_tcp_udp_lb_with_mig_backend'
    primary_resource_id: 'google_compute_forwarding_rule'
    min_version: 'beta'
    vars:
      ilb_network_name: 'l4-ilb-network'
      backend_subnet_name: 'l4-ilb-subnet'
      forwarding_rule_name: 'l4-ilb-forwarding-rule'
      backend_service_name: 'l4-ilb-backend-subnet'
      mig_template_name: 'l4-ilb-mig-template'
      hc_name: 'l4-ilb-hc'
      mig_name: 'l4-ilb-mig1'
      fw_allow_hc_name: 'l4-ilb-fw-allow-hc'
      fw_allow_ilb_to_backends_name: 'l4-ilb-fw-allow-ilb-to-backends'
      fw_allow_ilb_ssh_name: 'l4-ilb-fw-ssh'
      vm_test_name: 'l4-ilb-test-vm'
  - name: 'forwarding_rule_externallb'
    primary_resource_id: 'default'
    min_version: 'beta'
    vars:
      forwarding_rule_name: 'website-forwarding-rule'
      backend_name: 'website-backend'
      network_name: 'website-net'
    ignore_read_extra:
      - 'port_range'
  - name: 'forwarding_rule_externallb_byoipv6'
    primary_resource_id: 'default'
    vars:
      forwarding_rule_name: 'byoipv6-forwarding-rule'
      backend_name: 'website-backend'
      network_name: 'website-net'
      ip_address: '"2600:1901:4457:1::/96"'
      ip_collection_url: '"projects/tf-static-byoip/regions/us-central1/publicDelegatedPrefixes/tf-test-forwarding-rule-mode-pdp"'
    test_vars_overrides:
      ip_address: 'fmt.Sprintf("2600:1901:4457:1:%d:%d::/96", acctest.RandIntRange(t, 0, 9999), acctest.RandIntRange(t, 0, 9999))'
      ip_collection_url: '"projects/tf-static-byoip/regions/us-central1/publicDelegatedPrefixes/tf-test-forwarding-rule-mode-pdp"'
    ignore_read_extra:
      - 'port_range'
  - name: 'forwarding_rule_global_internallb'
    primary_resource_id: 'default'
    vars:
      forwarding_rule_name: 'website-forwarding-rule'
      backend_name: 'website-backend'
      network_name: 'website-net'
  - name: 'forwarding_rule_basic'
    primary_resource_id: 'default'
    vars:
      forwarding_rule_name: 'website-forwarding-rule'
      target_pool_name: 'website-target-pool'
    ignore_read_extra:
      - 'port_range'
      - 'target'
  - name: 'forwarding_rule_l3_default'
    primary_resource_id: 'fwd_rule'
    min_version: 'beta'
    vars:
      forwarding_rule_name: 'l3-forwarding-rule'
      service_name: 'service'
      health_check_name: 'health-check'
  - name: 'forwarding_rule_internallb'
    primary_resource_id: 'default'
    vars:
      forwarding_rule_name: 'website-forwarding-rule'
      backend_name: 'website-backend'
      network_name: 'website-net'
    ignore_read_extra:
      - 'port_range'
      - 'target'
  - name: 'forwarding_rule_http_lb'
    primary_resource_id: 'default'
    min_version: 'beta'
    vars:
      forwarding_rule_name: 'website-forwarding-rule'
      region_target_http_proxy_name: 'website-proxy'
      region_url_map_name: 'website-map'
      region_backend_service_name: 'website-backend'
      region_health_check_name: 'website-hc'
      rigm_name: 'website-rigm'
      network_name: 'website-net'
      fw_name: 'website-fw'
    ignore_read_extra:
      - 'port_range'
      - 'target'
  - name: 'forwarding_rule_regional_http_xlb'
    primary_resource_id: 'default'
    min_version: 'beta'
    vars:
      forwarding_rule_name: 'website-forwarding-rule'
      region_target_http_proxy_name: 'website-proxy'
      region_url_map_name: 'website-map'
      region_backend_service_name: 'website-backend'
      region_health_check_name: 'website-hc'
      rigm_name: 'website-rigm'
      network_name: 'website-net'
      fw_name: 'website-fw'
      ip_name: 'website-ip'
    ignore_read_extra:
      - 'port_range'
      - 'target'
      - 'ip_address'
  - name: 'forwarding_rule_vpc_psc'
    primary_resource_id: 'default'
    vars:
      forwarding_rule_name: 'psc-endpoint'
      consumer_network_name: 'consumer-net'
      ip_name: 'website-ip'
      producer_network_name: 'producer-net'
      producer_psc_network_name: 'producer-psc-net'
      service_attachment_name: 'producer-service'
      producer_forwarding_rule_name: 'producer-forwarding-rule'
      producer_backend_name: 'producer-service-backend'
      producer_healthcheck_name: 'producer-service-health-check'
    ignore_read_extra:
      - 'port_range'
      - 'target'
      - 'ip_address'
  - name: 'forwarding_rule_vpc_psc_no_automate_dns'
    primary_resource_id: 'default'
    vars:
      forwarding_rule_name: 'psc-endpoint'
      consumer_network_name: 'consumer-net'
      ip_name: 'website-ip'
      producer_network_name: 'producer-net'
      producer_psc_network_name: 'producer-psc-net'
      service_attachment_name: 'producer-service'
      producer_forwarding_rule_name: 'producer-forwarding-rule'
      producer_backend_name: 'producer-service-backend'
      producer_healthcheck_name: 'producer-service-health-check'
    ignore_read_extra:
      - 'port_range'
      - 'target'
      - 'ip_address'
  - name: 'forwarding_rule_regional_steering'
    primary_resource_id: 'steering'
    vars:
      forwarding_rule_name: 'steering-rule'
      ip_name: 'website-ip'
      backend_name: 'service-backend'
      external_forwarding_rule_name: 'external-forwarding-rule'
  - name: 'forwarding_rule_internallb_ipv6'
    primary_resource_id: 'default'
    vars:
      forwarding_rule_name: 'ilb-ipv6-forwarding-rule'
      backend_name: 'ilb-ipv6-backend'
      network_name: 'net-ipv6'
      subnet_name: 'subnet-internal-ipv6'
    ignore_read_extra:
      - 'port_range'
      - 'target'
virtual_fields:
  - name: 'recreate_closed_psc'
    description:
      This is used in PSC consumer ForwardingRule to make terraform recreate the ForwardingRule when the status is closed
    type: Boolean
    default_value: false
parameters:
  - name: 'region'
    type: ResourceRef
    description: |
      A reference to the region where the regional forwarding rule resides.

      This field is not applicable to global forwarding rules.
    required: false
    default_from_api: true
    custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.tmpl'
    custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.tmpl'
    resource: 'Region'
    imports: 'name'
properties:
  - name: 'creationTimestamp'
    type: Time
    description: 'Creation timestamp in RFC3339 text format.'
    output: true
  - name: 'isMirroringCollector'
    type: Boolean
    description: |
      Indicates whether or not this load balancer can be used as a collector for
      packet mirroring. To prevent mirroring loops, instances behind this
      load balancer will not have their traffic mirrored even if a
      `PacketMirroring` rule applies to them.

      This can only be set to true for load balancers that have their
      `loadBalancingScheme` set to `INTERNAL`.
  - name: 'forwardingRuleId'
    type: Integer
    description: |
      The unique identifier number for the resource. This identifier is defined by the server.
    api_name: id
    output: true
  - name: 'pscConnectionId'
    type: String
    description: 'The PSC connection id of the PSC Forwarding Rule.'
    output: true
  - name: 'pscConnectionStatus'
    type: String
    description:
      'The PSC connection status of the PSC Forwarding Rule. Possible values:
      `STATUS_UNSPECIFIED`, `PENDING`, `ACCEPTED`, `REJECTED`, `CLOSED`'
    output: true
  - name: 'description'
    type: String
    description: |
      An optional description of this resource. Provide this property when
      you create the resource.
  # This is a multi-resource resource reference (Address, GlobalAddress)
  - name: 'IPAddress'
    type: String
    description: |
      IP address for which this forwarding rule accepts traffic. When a client
      sends traffic to this IP address, the forwarding rule directs the traffic
      to the referenced `target` or `backendService`.

      While creating a forwarding rule, specifying an `IPAddress` is
      required under the following circumstances:

      * When the `target` is set to `targetGrpcProxy` and
      `validateForProxyless` is set to `true`, the
      `IPAddress` should be set to `0.0.0.0`.
      * When the `target` is a Private Service Connect Google APIs
      bundle, you must specify an `IPAddress`.

      Otherwise, you can optionally specify an IP address that references an
      existing static (reserved) IP address resource. When omitted, Google Cloud
      assigns an ephemeral IP address.

      Use one of the following formats to specify an IP address while creating a
      forwarding rule:

      * IP address number, as in `100.1.2.3`
      * IPv6 address range, as in `2600:1234::/96`
      * Full resource URL, as in
      `https://www.googleapis.com/compute/v1/projects/project_id/regions/region/addresses/address-name`
      * Partial URL or by name, as in:
        * `projects/project_id/regions/region/addresses/address-name`
        * `regions/region/addresses/address-name`
        * `global/addresses/address-name`
        * `address-name`

      The forwarding rule's `target` or `backendService`,
      and in most cases, also the `loadBalancingScheme`, determine the
      type of IP address that you can use. For detailed information, see
      [IP address
      specifications](https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts#ip_address_specifications).

      When reading an `IPAddress`, the API always returns the IP
      address number.
    default_from_api: true
    diff_suppress_func: 'InternalIpDiffSuppress'
  - name: 'IPProtocol'
    type: Enum
    description: |
      The IP protocol to which this rule applies.

      For protocol forwarding, valid
      options are `TCP`, `UDP`, `ESP`,
      `AH`, `SCTP`, `ICMP` and
      `L3_DEFAULT`.

      The valid IP protocols are different for different load balancing products
      as described in [Load balancing
      features](https://cloud.google.com/load-balancing/docs/features#protocols_from_the_load_balancer_to_the_backends).

      A Forwarding Rule with protocol L3_DEFAULT can attach with target instance or
      backend service with UNSPECIFIED protocol.
      A forwarding rule with "L3_DEFAULT" IPProtocal cannot be attached to a backend service with TCP or UDP.
    default_from_api: true
    diff_suppress_func: 'tpgresource.CaseDiffSuppress'
    enum_values:
      - 'TCP'
      - 'UDP'
      - 'ESP'
      - 'AH'
      - 'SCTP'
      - 'ICMP'
      - 'L3_DEFAULT'
  # This is a multi-resource resource reference (BackendService (global), RegionBackendService)
  # We have custom expands that manage this.
  - name: 'backendService'
    type: ResourceRef
    description: |
      Identifies the backend service to which the forwarding rule sends traffic.

      Required for Internal TCP/UDP Load Balancing and Network Load Balancing;
      must be omitted for all other load balancer types.
    custom_expand: 'templates/terraform/custom_expand/self_link_from_name.tmpl'
    resource: 'BackendService'
    imports: 'selfLink'
  - name: 'loadBalancingScheme'
    type: Enum
    description: |
      Specifies the forwarding rule type.

      Note that an empty string value (`""`) is also supported for some use
      cases, for example PSC (private service connection) regional forwarding
      rules.

      For more information about forwarding rules, refer to
      [Forwarding rule concepts](https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts).
    default_value: "EXTERNAL"
    enum_values:
      - 'EXTERNAL'
      - 'EXTERNAL_MANAGED'
      - 'INTERNAL'
      - 'INTERNAL_MANAGED'
  - name: 'name'
    type: String
    description: |
      Name of the resource; provided by the client when the resource is created.
      The name must be 1-63 characters long, and comply with
      [RFC1035](https://www.ietf.org/rfc/rfc1035.txt).

      Specifically, the name must be 1-63 characters long and match the regular
      expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first
      character must be a lowercase letter, and all following characters must
      be a dash, lowercase letter, or digit, except the last character, which
      cannot be a dash.

      For Private Service Connect forwarding rules that forward traffic to Google
      APIs, the forwarding rule name must be a 1-20 characters string with
      lowercase letters and numbers and must start with a letter.
    required: true
  - name: 'network'
    type: ResourceRef
    description: |
      This field is not used for external load balancing.

      For Internal TCP/UDP Load Balancing, this field identifies the network that
      the load balanced IP should belong to for this Forwarding Rule.
      If the subnetwork is specified, the network of the subnetwork will be used.
      If neither subnetwork nor this field is specified, the default network will
      be used.

      For Private Service Connect forwarding rules that forward traffic to Google
      APIs, a network must be provided.
    default_from_api: true
    # TODO(nelsonjr): When implementing new types enable converting the
    # manifest input from a single value to a range of form NN-NN. The API
    # accepts a single value, e.g. '80', but the API stores and returns
    # '80-80'. This causes idempotency false positive.
    custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.tmpl'
    resource: 'Network'
    imports: 'selfLink'
  - name: 'portRange'
    type: String
    description: |
      The `ports`, `portRange`, and `allPorts` fields are mutually exclusive.
      Only packets addressed to ports in the specified range will be forwarded
      to the backends configured with this forwarding rule.

      The `portRange` field has the following limitations:
      * It requires that the forwarding rule `IPProtocol` be TCP, UDP, or SCTP,
      and
      * It's applicable only to the following products: external passthrough
      Network Load Balancers, internal and external proxy Network Load
      Balancers, internal and external Application Load Balancers, external
      protocol forwarding, and Classic VPN.
      * Some products have restrictions on what ports can be used. See
      [port specifications](https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts#port_specifications)
      for details.

      For external forwarding rules, two or more forwarding rules cannot use the
      same `[IPAddress, IPProtocol]` pair, and cannot have overlapping
      `portRange`s.

      For internal forwarding rules within the same VPC network, two or more
      forwarding rules cannot use the same `[IPAddress, IPProtocol]` pair, and
      cannot have overlapping `portRange`s.

      @pattern: \d+(?:-\d+)?
    default_from_api: true
    diff_suppress_func: 'PortRangeDiffSuppress'
  - name: 'ports'
    type: Array
    description: |
      The `ports`, `portRange`, and `allPorts` fields are mutually exclusive.
      Only packets addressed to ports in the specified range will be forwarded
      to the backends configured with this forwarding rule.

      The `ports` field has the following limitations:
      * It requires that the forwarding rule `IPProtocol` be TCP, UDP, or SCTP,
      and
      * It's applicable only to the following products: internal passthrough
      Network Load Balancers, backend service-based external passthrough Network
      Load Balancers, and internal protocol forwarding.
      * You can specify a list of up to five ports by number, separated by
      commas. The ports can be contiguous or discontiguous.

      For external forwarding rules, two or more forwarding rules cannot use the
      same `[IPAddress, IPProtocol]` pair if they share at least one port
      number.

      For internal forwarding rules within the same VPC network, two or more
      forwarding rules cannot use the same `[IPAddress, IPProtocol]` pair if
      they share at least one port number.

      @pattern: \d+(?:-\d+)?
    is_set: true
    custom_expand: 'templates/terraform/custom_expand/set_to_list.tmpl'
    item_type:
      type: String
    max_size: 5
  - name: 'subnetwork'
    type: ResourceRef
    description: |
      This field identifies the subnetwork that the load balanced IP should
      belong to for this Forwarding Rule, used in internal load balancing and
      network load balancing with IPv6.

      If the network specified is in auto subnet mode, this field is optional.
      However, a subnetwork must be specified if the network is in custom subnet
      mode or when creating external forwarding rule with IPv6.
    # This is a multi-resource resource reference (TargetHttp(s)Proxy,
    # TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool,
    # TargetInstance)
    default_from_api: true
    custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.tmpl'
    resource: 'Subnetwork'
    imports: 'selfLink'
  - name: 'target'
    type: String
    description: |
      The URL of the target resource to receive the matched traffic.  For
      regional forwarding rules, this target must be in the same region as the
      forwarding rule. For global forwarding rules, this target must be a global
      load balancing resource.

      The forwarded traffic must be of a type appropriate to the target object.
      *  For load balancers, see the "Target" column in [Port specifications](https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts#ip_address_specifications).
      *  For Private Service Connect forwarding rules that forward traffic to Google APIs, provide the name of a supported Google API bundle:
        *  `vpc-sc` - [ APIs that support VPC Service Controls](https://cloud.google.com/vpc-service-controls/docs/supported-products).
        *  `all-apis` - [All supported Google APIs](https://cloud.google.com/vpc/docs/private-service-connect#supported-apis).

      For Private Service Connect forwarding rules that forward traffic to managed services, the target must be a service attachment.
    update_url: 'projects/{{project}}/regions/{{region}}/forwardingRules/{{name}}/setTarget'
    update_verb: 'POST'
    diff_suppress_func: 'tpgresource.CompareSelfLinkRelativePathsIgnoreProjectId'
    custom_expand: 'templates/terraform/custom_expand/self_link_from_name.tmpl'
  - name: 'labelFingerprint'
    type: Fingerprint
    description: |
      The fingerprint used for optimistic locking of this resource.  Used
      internally during updates.
    output: true
    update_url: 'projects/{{project}}/regions/{{region}}/forwardingRules/{{name}}/setLabels'
    update_verb: 'POST'
    key_expander: ''
  - name: 'allowGlobalAccess'
    type: Boolean
    description: |
      This field is used along with the `backend_service` field for
      internal load balancing or with the `target` field for internal
      TargetInstance.

      If the field is set to `TRUE`, clients can access ILB from all
      regions.

      Otherwise only allows access from clients in the same region as the
      internal load balancer.
    send_empty_value: true
    update_url: 'projects/{{project}}/regions/{{region}}/forwardingRules/{{name}}'
    update_verb: 'PATCH'
  - name: 'labels'
    type: KeyValueLabels
    description: |
      Labels to apply to this forwarding rule.  A list of key->value pairs.
    update_url: 'projects/{{project}}/regions/{{region}}/forwardingRules/{{name}}/setLabels'
    update_verb: 'POST'
  - name: 'allPorts'
    type: Boolean
    description: |
      The `ports`, `portRange`, and `allPorts` fields are mutually exclusive.
      Only packets addressed to ports in the specified range will be forwarded
      to the backends configured with this forwarding rule.

      The `allPorts` field has the following limitations:
      * It requires that the forwarding rule `IPProtocol` be TCP, UDP, SCTP, or
      L3_DEFAULT.
      * It's applicable only to the following products: internal passthrough
      Network Load Balancers, backend service-based external passthrough Network
      Load Balancers, and internal and external protocol forwarding.
      * Set this field to true to allow packets addressed to any port or packets
      lacking destination port information (for example, UDP fragments after the
      first fragment) to be forwarded to the backends configured with this
      forwarding rule. The L3_DEFAULT protocol requires `allPorts` be set to
      true.
  - name: 'networkTier'
    type: Enum
    description: |
      This signifies the networking tier used for configuring
      this load balancer and can only take the following values:
      `PREMIUM`, `STANDARD`.

      For regional ForwardingRule, the valid values are `PREMIUM` and
      `STANDARD`. For GlobalForwardingRule, the valid value is
      `PREMIUM`.

      If this field is not specified, it is assumed to be `PREMIUM`.
      If `IPAddress` is specified, this value must be equal to the
      networkTier of the Address.
    immutable: true
    default_from_api: true
    enum_values:
      - 'PREMIUM'
      - 'STANDARD'
  - name: 'serviceDirectoryRegistrations'
    type: Array
    description: |
      Service Directory resources to register this forwarding rule with.

      Currently, only supports a single Service Directory resource.
    immutable: true
    default_from_api: true
    item_type:
      type: NestedObject
      properties:
        - name: 'namespace'
          type: String
          description: |
            Service Directory namespace to register the forwarding rule under.
          immutable: true
          default_from_api: true
        - name: 'service'
          type: String
          description: |
            Service Directory service to register the forwarding rule under.
          immutable: true
    min_size: 0
    max_size: 1
  - name: 'serviceLabel'
    type: String
    description: |
      An optional prefix to the service name for this Forwarding Rule.
      If specified, will be the first label of the fully qualified service
      name.

      The label must be 1-63 characters long, and comply with RFC1035.
      Specifically, the label must be 1-63 characters long and match the
      regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first
      character must be a lowercase letter, and all following characters
      must be a dash, lowercase letter, or digit, except the last
      character, which cannot be a dash.

      This field is only used for INTERNAL load balancing.
    validation:
      function: 'verify.ValidateGCEName'
  - name: 'serviceName'
    type: String
    description: |
      The internal fully qualified service name for this Forwarding Rule.

      This field is only used for INTERNAL load balancing.
    output: true
  - name: 'sourceIpRanges'
    type: Array
    description:
      If not empty, this Forwarding Rule will only forward the traffic when the
      source IP address matches one of the IP addresses or CIDR ranges set here.
      Note that a Forwarding Rule can only have up to 64 source IP ranges, and
      this field can only be used with a regional Forwarding Rule whose scheme
      is EXTERNAL. Each sourceIpRange entry should be either an IP address (for
      example, 1.2.3.4) or a CIDR range (for example, 1.2.3.0/24).
    immutable: true
    item_type:
      type: String
  - name: 'baseForwardingRule'
    type: String
    description:
      '[Output Only] The URL for the corresponding base Forwarding Rule. By base
      Forwarding Rule, we mean the Forwarding Rule that has the same IP address,
      protocol, and port settings with the current Forwarding Rule, but without
      sourceIPRanges specified. Always empty if the current Forwarding Rule does
      not have sourceIPRanges specified.'
    output: true
  - name: 'allowPscGlobalAccess'
    type: Boolean
    description:
      This is used in PSC consumer ForwardingRule to control whether the PSC
      endpoint can be accessed from another region.
    send_empty_value: true
    update_url: 'projects/{{project}}/regions/{{region}}/forwardingRules/{{name}}'
    update_verb: 'PATCH'
    update_id: 'allowPscGlobalAccess'
    fingerprint_name: 'fingerprint'
  - name: 'noAutomateDnsZone'
    type: Boolean
    description:
      This is used in PSC consumer ForwardingRule to control whether it should try to auto-generate a DNS zone or not.
      Non-PSC forwarding rules do not use this field.
    immutable: true
    ignore_read: true
    send_empty_value: true
  - name: 'ipVersion'
    type: Enum
    description: |
      The IP address version that will be used by this forwarding rule.
      Valid options are IPV4 and IPV6.

      If not set, the IPv4 address will be used by default.
    immutable: true
    default_from_api: true
    enum_values:
      - 'IPV4'
      - 'IPV6'
  - name: ipCollection
    type: String
    diff_suppress_func: 'IpCollectionDiffSuppress'
    description: |
      Resource reference of a PublicDelegatedPrefix. The PDP must be a sub-PDP
      in EXTERNAL_IPV6_FORWARDING_RULE_CREATION mode.
      Use one of the following formats to specify a sub-PDP when creating an
      IPv6 NetLB forwarding rule using BYOIP:
      Full resource URL, as in:
        * `https://www.googleapis.com/compute/v1/projects/{{projectId}}/regions/{{region}}/publicDelegatedPrefixes/{{sub-pdp-name}}`
      Partial URL, as in:
        * `projects/{{projectId}}/regions/region/publicDelegatedPrefixes/{{sub-pdp-name}}`
        * `regions/{{region}}/publicDelegatedPrefixes/{{sub-pdp-name}}`
