Skip to content

Commit d1ed700

Browse files
committed
Add new resource RegionCompositeHealthCheck to terraform-beta provider.
1 parent 1f3c249 commit d1ed700

File tree

3 files changed

+429
-0
lines changed

3 files changed

+429
-0
lines changed
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# Copyright 2025 Google Inc.
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
---
15+
# API resource name
16+
name: 'RegionCompositeHealthCheck'
17+
# Resource description for the provider documentation.
18+
description: |
19+
A composite health check resource specifies the health source resources and
20+
the health destination resource to which the aggregated health result from
21+
the health source resources is delivered.
22+
references:
23+
guides:
24+
'Health checks overview': 'https://cloud.google.com/load-balancing/docs/health-check-concepts'
25+
api: 'https://cloud.google.com/compute/docs/reference/rest/v1/regionCompositeHealthChecks'
26+
min_version: beta
27+
28+
# URL for the resource's standard List method. https://google.aip.dev/132
29+
# Terraform field names enclosed in double curly braces are replaced with
30+
# the field values from the resource at runtime.
31+
base_url: 'projects/{{project}}/regions/{{region}}/compositeHealthChecks'
32+
# URL for the resource's standard Get method. https://google.aip.dev/131
33+
# Terraform field names enclosed in double curly braces are replaced with
34+
# the field values from the resource at runtime.
35+
self_link: 'projects/{{project}}/regions/{{region}}/compositeHealthChecks/{{name}}'
36+
37+
# URL for the resource's standard Create method, including query parameters.
38+
# https://google.aip.dev/133
39+
# Terraform field names enclosed in double curly braces are replaced with
40+
# the field values from the resource at runtime.
41+
create_url: 'projects/{{project}}/regions/{{region}}/compositeHealthChecks'
42+
43+
# Overrides the URL for the resource's standard Update method. (If unset, the
44+
# self_link URL is used by default.) https://google.aip.dev/134
45+
# Terraform field names enclosed in double curly braces are replaced with
46+
# the field values from the resource at runtime.
47+
update_url: 'projects/{{project}}/regions/{{region}}/compositeHealthChecks/{{name}}'
48+
# The HTTP verb used to update a resource. Allowed values: :POST, :PUT, :PATCH. Default: :PUT.
49+
update_verb: 'PATCH'
50+
# If true, the resource sets an `updateMask` query parameter listing modified
51+
# fields when updating the resource. If false, it does not.
52+
update_mask: true
53+
54+
# If true, code for handling long-running operations is generated along with
55+
# the resource. If false, that code is not generated.
56+
autogen_async: true
57+
# Sets parameters for handling operations returned by the API.
58+
async:
59+
# Overrides which API calls return operations. Default: ['create',
60+
# 'update', 'delete']
61+
# actions: ['create', 'update', 'delete']
62+
operation:
63+
base_url: 'projects/{{project}}/regions/{{region}}/operations/{{op_id}}'
64+
65+
parameters:
66+
- name: 'region'
67+
type: String
68+
required: true
69+
immutable: true
70+
url_param_only: true
71+
description: |
72+
URL of the region where the composite health check resides.
73+
- name: 'name'
74+
type: String
75+
required: true
76+
immutable: true
77+
description: |
78+
Name of the resource. Provided by the client when the resource is created.
79+
The name must be 1-63 characters long, and comply with RFC1035.
80+
Specifically, the name must be 1-63 characters long and match the regular
81+
expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first
82+
character must be a lowercase letter, and all following characters must
83+
be a dash, lowercase letter, or digit, except the last character, which
84+
cannot be a dash.
85+
86+
properties:
87+
- name: 'description'
88+
type: String
89+
description: |
90+
An optional description of this resource. Provide this property when you
91+
create the resource.
92+
- name: 'healthSources'
93+
type: Array
94+
item_type:
95+
name: 'healthSource'
96+
type: ResourceRef
97+
resource: 'RegionHealthSource'
98+
imports: 'selfLink'
99+
description: |
100+
URLs to the HealthSource resources whose results are AND'ed.
101+
I.e. he aggregated result is is HEALTHY only if all sources
102+
are HEALTHY. Must have at least 1. Must not have more than 10.
103+
Must be regional and in the same region as the
104+
CompositeHealthCheck. Can be mutated.
105+
min_size: 1
106+
max_size: 10
107+
- name: 'healthDestination'
108+
type: ResourceRef
109+
resource: 'ForwardingRule'
110+
imports: 'selfLink'
111+
description: |
112+
URL to the destination resource. Must be set. Must be a
113+
ForwardingRule. The ForwardingRule must have
114+
load balancing scheme INTERNAL or
115+
INTERNAL_MANAGED and must be regional and in the same region
116+
as the CompositeHealthCheck (cross-region deployment for
117+
INTERNAL_MANAGED is not supported). Can be mutated.
118+
- name: 'id'
119+
type: String
120+
description: 'The unique identifier for the resource. This identifier is defined by the server.'
121+
output: true
122+
- name: 'creationTimestamp'
123+
type: String
124+
description: 'Creation timestamp in RFC3339 text format.'
125+
output: true
126+
- name: 'selfLinkWithId'
127+
type: String
128+
description: 'Server-defined URL with id for the resource.'
129+
output: true
130+
- name: 'fingerprint'
131+
type: Fingerprint
132+
description: |
133+
Fingerprint of this resource. A hash of the contents stored in this object.
134+
This field is used in optimistic locking. This field will be ignored when
135+
inserting a `CompositeHealthCheck`. An up-to-date fingerprint
136+
must be provided in order to patch the CompositeHealthCheck; Otherwise,
137+
the request will fail with error `412 conditionNotMet`. To see
138+
the latest fingerprint, make a `get()` request to retrieve the
139+
CompositeHealthCheck.
140+
output: true
141+
142+
examples:
143+
- name: "compute_region_composite_health_check_basic"
144+
primary_resource_id: "example_test_composite_health_check"
145+
vars:
146+
name: "test-composite-health-check"
147+
description: "Example composite health check basic"
148+
min_version: 'beta'
149+
test_env_vars:
150+
project: 'PROJECT_NAME'
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
resource "google_compute_region_composite_health_check" "{{$.PrimaryResourceId}}" {
2+
provider = google-beta
3+
name = "{{index $.Vars "name"}}"
4+
description = "{{index $.Vars "description"}}"
5+
region = "us-central1"
6+
health_sources = [google_compute_region_health_source.default.id]
7+
health_destination = google_compute_forwarding_rule.default.id
8+
}
9+
10+
resource "google_compute_region_health_source" "default" {
11+
provider = google-beta
12+
name = "{{index $.Vars "name"}}-hs"
13+
region = "us-central1"
14+
source_type = "BACKEND_SERVICE"
15+
sources = [google_compute_region_backend_service.default.id]
16+
health_aggregation_policy = google_compute_region_health_aggregation_policy.hap.id
17+
}
18+
19+
resource "google_compute_region_health_aggregation_policy" "hap" {
20+
provider = google-beta
21+
name = "{{index $.Vars "name"}}-hap"
22+
description = "health aggregation policy for health source"
23+
region = "us-central1"
24+
}
25+
26+
resource "google_compute_health_check" "default" {
27+
provider = google-beta
28+
name = "{{index $.Vars "name"}}-hc"
29+
http_health_check {
30+
port = 80
31+
}
32+
}
33+
34+
resource "google_compute_region_backend_service" "default" {
35+
provider = google-beta
36+
name = "{{index $.Vars "name"}}-bs"
37+
region = "us-central1"
38+
health_checks = [google_compute_health_check.default.id]
39+
load_balancing_scheme = "INTERNAL"
40+
}
41+
42+
resource "google_compute_forwarding_rule" "default" {
43+
provider = google-beta
44+
name = "{{index $.Vars "name"}}-fr"
45+
region = "us-central1"
46+
load_balancing_scheme = "INTERNAL"
47+
backend_service = google_compute_region_backend_service.default.id
48+
network = google_compute_network.default.id
49+
subnetwork = google_compute_subnetwork.default.id
50+
ip_protocol = "TCP"
51+
all_ports = true
52+
}
53+
54+
resource "google_compute_network" "default" {
55+
provider = google-beta
56+
name = "{{index $.Vars "name"}}-net"
57+
auto_create_subnetworks = false
58+
}
59+
60+
resource "google_compute_subnetwork" "default" {
61+
provider = google-beta
62+
name = "{{index $.Vars "name"}}-sub"
63+
ip_cidr_range = "10.2.0.0/16"
64+
region = "us-central1"
65+
network = google_compute_network.default.id
66+
}

0 commit comments

Comments
 (0)