Skip to content

Commit 3edb536

Browse files
authored
Add IAP for global forwarding rule (#14947)
1 parent 43cd12a commit 3edb536

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
name: 'WebForwardingRuleService'
16+
description: |
17+
Only used to generate IAM resources
18+
# This resource is only used to generate IAM resources. They do not correspond to real
19+
# GCP resources, and should not be used to generate anything other than IAM support.
20+
exclude_resource: true
21+
docs:
22+
id_format: 'projects/{{project}}/iap_web/forwarding_rule/services/{{name}}'
23+
base_url: 'projects/{{project}}/iap_web/forwarding_rule/services/{{name}}'
24+
self_link: 'projects/{{project}}/iap_web/forwarding_rule/services/{{name}}'
25+
import_format:
26+
- 'projects/{{project}}/iap_web/forwarding_rule/services/{{name}}'
27+
timeouts:
28+
insert_minutes: 20
29+
update_minutes: 20
30+
delete_minutes: 20
31+
iam_policy:
32+
method_name_separator: ':'
33+
parent_resource_type: 'google_compute_global_forwarding_rule'
34+
fetch_iam_policy_verb: 'POST'
35+
allowed_iam_role: 'roles/iap.httpsResourceAccessor'
36+
parent_resource_attribute: 'forwarding_rule_service_name'
37+
iam_conditions_request_type: 'REQUEST_BODY'
38+
example_config_body: 'templates/terraform/iam/iam_attributes.go.tmpl'
39+
custom_code:
40+
exclude_tgc: true
41+
examples:
42+
- name: 'forwarding_rule_service_basic'
43+
primary_resource_id: 'default'
44+
primary_resource_name: 'fmt.Sprintf("tf-test-forwarding-rule-service%s", context["random_suffix"])'
45+
vars:
46+
forwarding_rule_service_name: 'forwarding-rule-service'
47+
target_http_proxy_name: 'target-http-proxy-name'
48+
url_map_name: 'url-map-name'
49+
backend_service_name: 'backend-service-name'
50+
health_check_name: 'health-check-name'
51+
parameters:
52+
properties:
53+
- name: 'name'
54+
type: String
55+
description: Name or self link of a forwarding rule service.
56+
required: true
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
resource "google_compute_health_check" "default" {
2+
name = "{{index $.Vars "health_check_name"}}"
3+
http_health_check {
4+
port = 80
5+
request_path = "/"
6+
}
7+
}
8+
9+
10+
resource "google_compute_backend_service" "default" {
11+
name = "{{index $.Vars "backend_service_name"}}"
12+
protocol = "HTTP"
13+
port_name = "http"
14+
timeout_sec = 10
15+
health_checks = [google_compute_health_check.default.id]
16+
load_balancing_scheme = "EXTERNAL_MANAGED"
17+
}
18+
19+
20+
resource "google_compute_url_map" "default" {
21+
name = "{{index $.Vars "url_map_name"}}"
22+
default_service = google_compute_backend_service.default.id
23+
}
24+
25+
26+
resource "google_compute_target_http_proxy" "default" {
27+
name = "{{index $.Vars "target_http_proxy_name"}}"
28+
url_map = google_compute_url_map.default.id
29+
}
30+
31+
32+
resource "google_compute_global_forwarding_rule" "{{$.PrimaryResourceId}}" {
33+
name = "{{index $.Vars "forwarding_rule_service_name"}}"
34+
target = google_compute_target_http_proxy.default.id
35+
port_range = "80"
36+
load_balancing_scheme = "EXTERNAL_MANAGED"
37+
}
38+

0 commit comments

Comments
 (0)