|
| 1 | +--- |
| 2 | +# ---------------------------------------------------------------------------- |
| 3 | +# |
| 4 | +# *** AUTO GENERATED CODE *** Type: MMv1 *** |
| 5 | +# |
| 6 | +# ---------------------------------------------------------------------------- |
| 7 | +# |
| 8 | +# This file is automatically generated by Magic Modules and manual |
| 9 | +# changes will be clobbered when the file is regenerated. |
| 10 | +# |
| 11 | +# Please read more about how to change this file in |
| 12 | +# .github/CONTRIBUTING.md. |
| 13 | +# |
| 14 | +# ---------------------------------------------------------------------------- |
| 15 | +subcategory: "Network services" |
| 16 | +description: |- |
| 17 | + ServiceLbPolicy holds global load balancing and traffic distribution configuration that can be applied to a BackendService. |
| 18 | +--- |
| 19 | + |
| 20 | +# google_network_services_service_lb_policies |
| 21 | + |
| 22 | +ServiceLbPolicy holds global load balancing and traffic distribution configuration that can be applied to a BackendService. |
| 23 | + |
| 24 | +~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider. |
| 25 | +See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources. |
| 26 | + |
| 27 | + |
| 28 | +<div class = "oics-button" style="float: right; margin: 0 0 -15px"> |
| 29 | + <a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.jpy.wang%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md&cloudshell_working_dir=network_services_service_lb_policies_basic&open_in_editor=main.tf" target="_blank"> |
| 30 | + <img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> |
| 31 | + </a> |
| 32 | +</div> |
| 33 | +## Example Usage - Network Services Service Lb Policies Basic |
| 34 | + |
| 35 | + |
| 36 | +```hcl |
| 37 | +resource "google_network_services_service_lb_policies" "default" { |
| 38 | + provider = google-beta |
| 39 | + |
| 40 | + name = "my-lb-policy" |
| 41 | + location = "global" |
| 42 | +} |
| 43 | +``` |
| 44 | +<div class = "oics-button" style="float: right; margin: 0 0 -15px"> |
| 45 | + <a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.jpy.wang%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md&cloudshell_working_dir=network_services_service_lb_policies_advanced&open_in_editor=main.tf" target="_blank"> |
| 46 | + <img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> |
| 47 | + </a> |
| 48 | +</div> |
| 49 | +## Example Usage - Network Services Service Lb Policies Advanced |
| 50 | + |
| 51 | + |
| 52 | +```hcl |
| 53 | +resource "google_network_services_service_lb_policies" "default" { |
| 54 | + provider = google-beta |
| 55 | +
|
| 56 | + name = "my-lb-policy" |
| 57 | + location = "global" |
| 58 | + description = "my description" |
| 59 | + load_balancing_algorithm = "SPRAY_TO_REGION" |
| 60 | +
|
| 61 | + auto_capacity_drain { |
| 62 | + enable = true |
| 63 | + } |
| 64 | +
|
| 65 | + failover_config { |
| 66 | + failover_health_threshold = 70 |
| 67 | + } |
| 68 | + |
| 69 | + labels = { |
| 70 | + foo = "bar" |
| 71 | + } |
| 72 | +} |
| 73 | +
|
| 74 | +resource "google_compute_backend_service" "default" { |
| 75 | + provider = google-beta |
| 76 | + |
| 77 | + name = "my-lb-backend" |
| 78 | + description = "my description" |
| 79 | + load_balancing_scheme = "INTERNAL_SELF_MANAGED" |
| 80 | + protocol = "HTTP" |
| 81 | + service_lb_policy = "//networkservices.googleapis.com/${google_network_services_service_lb_policies.default.id}" |
| 82 | +} |
| 83 | +``` |
| 84 | + |
| 85 | +## Argument Reference |
| 86 | + |
| 87 | +The following arguments are supported: |
| 88 | + |
| 89 | + |
| 90 | +* `name` - |
| 91 | + (Required) |
| 92 | + Name of the ServiceLbPolicy resource. It matches pattern `projects/{project}/locations/{location}/serviceLbPolicies/{service_lb_policy_name}`. |
| 93 | + |
| 94 | +* `location` - |
| 95 | + (Required) |
| 96 | + The location of the service lb policy. |
| 97 | + |
| 98 | + |
| 99 | +- - - |
| 100 | + |
| 101 | + |
| 102 | +* `labels` - |
| 103 | + (Optional) |
| 104 | + Set of label tags associated with the ServiceLbPolicy resource. |
| 105 | + **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. |
| 106 | + Please refer to the field `effective_labels` for all of the labels present on the resource. |
| 107 | + |
| 108 | +* `description` - |
| 109 | + (Optional) |
| 110 | + A free-text description of the resource. Max length 1024 characters. |
| 111 | + |
| 112 | +* `load_balancing_algorithm` - |
| 113 | + (Optional) |
| 114 | + The type of load balancing algorithm to be used. The default behavior is WATERFALL_BY_REGION. |
| 115 | + Possible values are: `SPRAY_TO_REGION`, `SPRAY_TO_WORLD`, `WATERFALL_BY_REGION`, `WATERFALL_BY_ZONE`. |
| 116 | + |
| 117 | +* `auto_capacity_drain` - |
| 118 | + (Optional) |
| 119 | + Option to specify if an unhealthy MIG/NEG should be considered for global load balancing and traffic routing. |
| 120 | + Structure is [documented below](#nested_auto_capacity_drain). |
| 121 | + |
| 122 | +* `failover_config` - |
| 123 | + (Optional) |
| 124 | + Option to specify health based failover behavior. This is not related to Network load balancer FailoverPolicy. |
| 125 | + Structure is [documented below](#nested_failover_config). |
| 126 | + |
| 127 | +* `project` - (Optional) The ID of the project in which the resource belongs. |
| 128 | + If it is not provided, the provider project is used. |
| 129 | + |
| 130 | + |
| 131 | +<a name="nested_auto_capacity_drain"></a>The `auto_capacity_drain` block supports: |
| 132 | + |
| 133 | +* `enable` - |
| 134 | + (Optional) |
| 135 | + Optional. If set to 'True', an unhealthy MIG/NEG will be set as drained. - An MIG/NEG is considered unhealthy if less than 25% of the instances/endpoints in the MIG/NEG are healthy. - This option will never result in draining more than 50% of the configured IGs/NEGs for the Backend Service. |
| 136 | + |
| 137 | +<a name="nested_failover_config"></a>The `failover_config` block supports: |
| 138 | + |
| 139 | +* `failover_health_threshold` - |
| 140 | + (Required) |
| 141 | + Optional. The percentage threshold that a load balancer will begin to send traffic to failover backends. If the percentage of endpoints in a MIG/NEG is smaller than this value, traffic would be sent to failover backends if possible. This field should be set to a value between 1 and 99. The default value is 50 for Global external HTTP(S) load balancer (classic) and Proxyless service mesh, and 70 for others. |
| 142 | + |
| 143 | +## Attributes Reference |
| 144 | + |
| 145 | +In addition to the arguments listed above, the following computed attributes are exported: |
| 146 | + |
| 147 | +* `id` - an identifier for the resource with format `projects/{{project}}/locations/{{location}}/serviceLbPolicies/{{name}}` |
| 148 | + |
| 149 | +* `create_time` - |
| 150 | + Time the ServiceLbPolicy was created in UTC. |
| 151 | + |
| 152 | +* `update_time` - |
| 153 | + Time the ServiceLbPolicy was updated in UTC. |
| 154 | + |
| 155 | +* `terraform_labels` - |
| 156 | + The combination of labels configured directly on the resource |
| 157 | + and default labels configured on the provider. |
| 158 | + |
| 159 | +* `effective_labels` - |
| 160 | + All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services. |
| 161 | + |
| 162 | + |
| 163 | +## Timeouts |
| 164 | + |
| 165 | +This resource provides the following |
| 166 | +[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options: |
| 167 | + |
| 168 | +- `create` - Default is 30 minutes. |
| 169 | +- `update` - Default is 30 minutes. |
| 170 | +- `delete` - Default is 30 minutes. |
| 171 | + |
| 172 | +## Import |
| 173 | + |
| 174 | + |
| 175 | +ServiceLbPolicies can be imported using any of these accepted formats: |
| 176 | + |
| 177 | +* `projects/{{project}}/locations/{{location}}/serviceLbPolicies/{{name}}` |
| 178 | +* `{{project}}/{{location}}/{{name}}` |
| 179 | +* `{{location}}/{{name}}` |
| 180 | + |
| 181 | + |
| 182 | +In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import ServiceLbPolicies using one of the formats above. For example: |
| 183 | + |
| 184 | +```tf |
| 185 | +import { |
| 186 | + id = "projects/{{project}}/locations/{{location}}/serviceLbPolicies/{{name}}" |
| 187 | + to = google_network_services_service_lb_policies.default |
| 188 | +} |
| 189 | +``` |
| 190 | + |
| 191 | +When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), ServiceLbPolicies can be imported using one of the formats above. For example: |
| 192 | + |
| 193 | +``` |
| 194 | +$ terraform import google_network_services_service_lb_policies.default projects/{{project}}/locations/{{location}}/serviceLbPolicies/{{name}} |
| 195 | +$ terraform import google_network_services_service_lb_policies.default {{project}}/{{location}}/{{name}} |
| 196 | +$ terraform import google_network_services_service_lb_policies.default {{location}}/{{name}} |
| 197 | +``` |
| 198 | + |
| 199 | +## User Project Overrides |
| 200 | + |
| 201 | +This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override). |
0 commit comments