From f26915b135b1710a97c277837d86d30555d53598 Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Tue, 4 Oct 2022 16:30:24 +0000 Subject: [PATCH] Added support for regional target TCP proxy and removed some unused fields from target regional HTTP/HTTPS proxy. (#6622) Signed-off-by: Modular Magician --- .changelog/6622.txt | 3 + ...e_region_target_http_proxy_sweeper_test.go | 2 +- ..._region_target_https_proxy_sweeper_test.go | 2 +- ...ce_compute_region_target_tcp_proxy_test.go | 1 + ...pute_region_target_tcp_proxy.html.markdown | 162 ++++++++++++++++++ 5 files changed, 168 insertions(+), 2 deletions(-) create mode 100644 .changelog/6622.txt create mode 100644 google/resource_compute_region_target_tcp_proxy_test.go create mode 100644 website/docs/r/compute_region_target_tcp_proxy.html.markdown diff --git a/.changelog/6622.txt b/.changelog/6622.txt new file mode 100644 index 0000000000..77dcd74e36 --- /dev/null +++ b/.changelog/6622.txt @@ -0,0 +1,3 @@ +```release-note:new-resource +`google_compute_region_target_tcp_proxy` +``` diff --git a/google/resource_compute_region_target_http_proxy_sweeper_test.go b/google/resource_compute_region_target_http_proxy_sweeper_test.go index 6f6ae33fe4..1e9aaf6f83 100644 --- a/google/resource_compute_region_target_http_proxy_sweeper_test.go +++ b/google/resource_compute_region_target_http_proxy_sweeper_test.go @@ -74,7 +74,7 @@ func testSweepComputeRegionTargetHttpProxy(region string) error { return nil } - resourceList, ok := res["items"] + resourceList, ok := res["regionTargetHttpProxies"] if !ok { log.Printf("[INFO][SWEEPER_LOG] Nothing found in response.") return nil diff --git a/google/resource_compute_region_target_https_proxy_sweeper_test.go b/google/resource_compute_region_target_https_proxy_sweeper_test.go index 38a5a66b54..450fa3a733 100644 --- a/google/resource_compute_region_target_https_proxy_sweeper_test.go +++ b/google/resource_compute_region_target_https_proxy_sweeper_test.go @@ -74,7 +74,7 @@ func testSweepComputeRegionTargetHttpsProxy(region string) error { return nil } - resourceList, ok := res["items"] + resourceList, ok := res["regionTargetHttpsProxies"] if !ok { log.Printf("[INFO][SWEEPER_LOG] Nothing found in response.") return nil diff --git a/google/resource_compute_region_target_tcp_proxy_test.go b/google/resource_compute_region_target_tcp_proxy_test.go new file mode 100644 index 0000000000..71664db3c8 --- /dev/null +++ b/google/resource_compute_region_target_tcp_proxy_test.go @@ -0,0 +1 @@ +package google diff --git a/website/docs/r/compute_region_target_tcp_proxy.html.markdown b/website/docs/r/compute_region_target_tcp_proxy.html.markdown new file mode 100644 index 0000000000..8d30ccc0f4 --- /dev/null +++ b/website/docs/r/compute_region_target_tcp_proxy.html.markdown @@ -0,0 +1,162 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in +# .github/CONTRIBUTING.md. +# +# ---------------------------------------------------------------------------- +subcategory: "Compute Engine" +page_title: "Google: google_compute_region_target_tcp_proxy" +description: |- + Represents a RegionTargetTcpProxy resource, which is used by one or more + forwarding rules to route incoming TCP requests to a regional TCP proxy load + balancer. +--- + +# google\_compute\_region\_target\_tcp\_proxy + +Represents a RegionTargetTcpProxy resource, which is used by one or more +forwarding rules to route incoming TCP requests to a regional TCP proxy load +balancer. + +~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider. +See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources. + +To get more information about RegionTargetTcpProxy, see: + +* [API documentation](https://cloud.google.com/compute/docs/reference/rest/beta/targetTcpProxies) +* How-to Guides + * [Official Documentation](https://cloud.google.com/load-balancing/docs/tcp/internal-proxy) + + +## Example Usage - Region Target Tcp Proxy Basic + + +```hcl +resource "google_compute_region_target_tcp_proxy" "default" { + provider = google-beta + name = "test-proxy" + region = "europe-west4" + backend_service = google_compute_region_backend_service.default.id +} + +resource "google_compute_region_backend_service" "default" { + provider = google-beta + name = "backend-service" + protocol = "TCP" + timeout_sec = 10 + region = "europe-west4" + + health_checks = [google_compute_region_health_check.default.id] + load_balancing_scheme = "INTERNAL_MANAGED" +} + +resource "google_compute_region_health_check" "default" { + provider = google-beta + name = "health-check" + region = "europe-west4" + timeout_sec = 1 + check_interval_sec = 1 + + tcp_health_check { + port = "80" + } +} +``` + +## Argument Reference + +The following arguments are supported: + + +* `name` - + (Required) + 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. 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. + +* `backend_service` - + (Required) + A reference to the BackendService resource. + + +- - - + + +* `description` - + (Optional) + An optional description of this resource. + +* `proxy_header` - + (Optional) + Specifies the type of proxy header to append before sending data to + the backend. + Default value is `NONE`. + Possible values are `NONE` and `PROXY_V1`. + +* `proxy_bind` - + (Optional) + This field only applies when the forwarding rule that references + this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED. + +* `region` - + (Optional) + The Region in which the created target TCP proxy should reside. + If it is not provided, the provider region is used. + +* `project` - (Optional) The ID of the project in which the resource belongs. + If it is not provided, the provider project is used. + + +## Attributes Reference + +In addition to the arguments listed above, the following computed attributes are exported: + +* `id` - an identifier for the resource with format `projects/{{project}}/regions/{{region}}/targetTcpProxies/{{name}}` + +* `creation_timestamp` - + Creation timestamp in RFC3339 text format. + +* `proxy_id` - + The unique identifier for the resource. +* `self_link` - The URI of the created resource. + + +## Timeouts + +This resource provides the following +[Timeouts](/docs/configuration/resources.html#timeouts) configuration options: + +- `create` - Default is 20 minutes. +- `delete` - Default is 20 minutes. + +## Import + + +RegionTargetTcpProxy can be imported using any of these accepted formats: + +``` +$ terraform import google_compute_region_target_tcp_proxy.default projects/{{project}}/regions/{{region}}/targetTcpProxies/{{name}} +$ terraform import google_compute_region_target_tcp_proxy.default {{project}}/{{region}}/{{name}} +$ terraform import google_compute_region_target_tcp_proxy.default {{region}}/{{name}} +$ terraform import google_compute_region_target_tcp_proxy.default {{name}} +``` + +## User Project Overrides + +This resource supports [User Project Overrides](https://www.terraform.io/docs/providers/google/guides/provider_reference.html#user_project_override).