pulumi-gcp 7.21.0a1714565535__py3-none-any.whl → 7.21.0a1714596856__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pulumi_gcp/__init__.py +40 -0
- pulumi_gcp/alloydb/_inputs.py +74 -0
- pulumi_gcp/alloydb/instance.py +90 -0
- pulumi_gcp/alloydb/outputs.py +98 -0
- pulumi_gcp/apigee/environment.py +47 -0
- pulumi_gcp/applicationintegration/__init__.py +1 -0
- pulumi_gcp/applicationintegration/_inputs.py +843 -0
- pulumi_gcp/applicationintegration/auth_config.py +998 -0
- pulumi_gcp/applicationintegration/outputs.py +891 -0
- pulumi_gcp/bigquerydatapolicy/_inputs.py +21 -4
- pulumi_gcp/bigquerydatapolicy/data_policy.py +78 -0
- pulumi_gcp/bigquerydatapolicy/outputs.py +16 -3
- pulumi_gcp/certificateauthority/_inputs.py +92 -12
- pulumi_gcp/certificateauthority/authority.py +110 -0
- pulumi_gcp/certificateauthority/certificate.py +176 -0
- pulumi_gcp/certificateauthority/outputs.py +144 -12
- pulumi_gcp/composer/__init__.py +1 -0
- pulumi_gcp/composer/user_workloads_secret.py +441 -0
- pulumi_gcp/compute/__init__.py +1 -0
- pulumi_gcp/compute/_inputs.py +121 -58
- pulumi_gcp/compute/global_forwarding_rule.py +0 -282
- pulumi_gcp/compute/outputs.py +120 -57
- pulumi_gcp/compute/region_target_https_proxy.py +257 -0
- pulumi_gcp/compute/region_url_map.py +0 -470
- pulumi_gcp/compute/security_policy_rule.py +850 -0
- pulumi_gcp/dataloss/__init__.py +1 -0
- pulumi_gcp/dataloss/_inputs.py +1040 -0
- pulumi_gcp/dataloss/outputs.py +1123 -0
- pulumi_gcp/dataloss/prevention_discovery_config.py +737 -0
- pulumi_gcp/dns/_inputs.py +2 -2
- pulumi_gcp/dns/outputs.py +2 -2
- pulumi_gcp/dns/record_set.py +2 -2
- pulumi_gcp/filestore/get_instance.py +11 -1
- pulumi_gcp/filestore/instance.py +101 -0
- pulumi_gcp/firebase/_inputs.py +16 -0
- pulumi_gcp/firebase/app_check_play_integrity_config.py +20 -0
- pulumi_gcp/firebase/app_check_recaptcha_enterprise_config.py +10 -0
- pulumi_gcp/firebase/hosting_version.py +44 -0
- pulumi_gcp/firebase/outputs.py +12 -0
- pulumi_gcp/logging/folder_sink.py +54 -0
- pulumi_gcp/logging/organization_sink.py +54 -0
- pulumi_gcp/monitoring/_inputs.py +46 -2
- pulumi_gcp/monitoring/outputs.py +40 -2
- pulumi_gcp/monitoring/uptime_check_config.py +6 -0
- pulumi_gcp/networkconnectivity/__init__.py +1 -0
- pulumi_gcp/networkconnectivity/internal_range.py +1024 -0
- pulumi_gcp/secretmanager/get_secret.py +13 -3
- pulumi_gcp/secretmanager/outputs.py +20 -1
- pulumi_gcp/secretmanager/secret.py +90 -3
- pulumi_gcp/storage/__init__.py +1 -0
- pulumi_gcp/storage/get_bucket_objects.py +153 -0
- pulumi_gcp/storage/outputs.py +63 -0
- {pulumi_gcp-7.21.0a1714565535.dist-info → pulumi_gcp-7.21.0a1714596856.dist-info}/METADATA +1 -1
- {pulumi_gcp-7.21.0a1714565535.dist-info → pulumi_gcp-7.21.0a1714596856.dist-info}/RECORD +56 -50
- {pulumi_gcp-7.21.0a1714565535.dist-info → pulumi_gcp-7.21.0a1714596856.dist-info}/WHEEL +0 -0
- {pulumi_gcp-7.21.0a1714565535.dist-info → pulumi_gcp-7.21.0a1714596856.dist-info}/top_level.txt +0 -0
@@ -1072,241 +1072,6 @@ class RegionUrlMap(pulumi.CustomResource):
|
|
1072
1072
|
path="/home",
|
1073
1073
|
)])
|
1074
1074
|
```
|
1075
|
-
### Int Https Lb Https Redirect
|
1076
|
-
|
1077
|
-
```python
|
1078
|
-
import pulumi
|
1079
|
-
import pulumi_gcp as gcp
|
1080
|
-
import pulumi_tls as tls
|
1081
|
-
|
1082
|
-
# Internal HTTPS load balancer with HTTP-to-HTTPS redirect
|
1083
|
-
# VPC network
|
1084
|
-
default = gcp.compute.Network("default",
|
1085
|
-
name="l7-ilb-network",
|
1086
|
-
auto_create_subnetworks=False)
|
1087
|
-
# Proxy-only subnet
|
1088
|
-
proxy_subnet = gcp.compute.Subnetwork("proxy_subnet",
|
1089
|
-
name="l7-ilb-proxy-subnet",
|
1090
|
-
ip_cidr_range="10.0.0.0/24",
|
1091
|
-
region="europe-west1",
|
1092
|
-
purpose="REGIONAL_MANAGED_PROXY",
|
1093
|
-
role="ACTIVE",
|
1094
|
-
network=default.id)
|
1095
|
-
# Backend subnet
|
1096
|
-
default_subnetwork = gcp.compute.Subnetwork("default",
|
1097
|
-
name="l7-ilb-subnet",
|
1098
|
-
ip_cidr_range="10.0.1.0/24",
|
1099
|
-
region="europe-west1",
|
1100
|
-
network=default.id)
|
1101
|
-
# Reserved internal address
|
1102
|
-
default_address = gcp.compute.Address("default",
|
1103
|
-
name="l7-ilb-ip",
|
1104
|
-
subnetwork=default_subnetwork.id,
|
1105
|
-
address_type="INTERNAL",
|
1106
|
-
address="10.0.1.5",
|
1107
|
-
region="europe-west1",
|
1108
|
-
purpose="SHARED_LOADBALANCER_VIP")
|
1109
|
-
# Self-signed regional SSL certificate for testing
|
1110
|
-
default_private_key = tls.PrivateKey("default",
|
1111
|
-
algorithm="RSA",
|
1112
|
-
rsa_bits=2048)
|
1113
|
-
default_self_signed_cert = tls.SelfSignedCert("default",
|
1114
|
-
key_algorithm=default_private_key.algorithm,
|
1115
|
-
private_key_pem=default_private_key.private_key_pem,
|
1116
|
-
validity_period_hours=12,
|
1117
|
-
early_renewal_hours=3,
|
1118
|
-
allowed_uses=[
|
1119
|
-
"key_encipherment",
|
1120
|
-
"digital_signature",
|
1121
|
-
"server_auth",
|
1122
|
-
],
|
1123
|
-
dns_names=["example.com"],
|
1124
|
-
subject=tls.SelfSignedCertSubjectArgs(
|
1125
|
-
common_name="example.com",
|
1126
|
-
organization="ACME Examples, Inc",
|
1127
|
-
))
|
1128
|
-
default_region_ssl_certificate = gcp.compute.RegionSslCertificate("default",
|
1129
|
-
name_prefix="my-certificate-",
|
1130
|
-
private_key=default_private_key.private_key_pem,
|
1131
|
-
certificate=default_self_signed_cert.cert_pem,
|
1132
|
-
region="europe-west1")
|
1133
|
-
# Regional health check
|
1134
|
-
default_region_health_check = gcp.compute.RegionHealthCheck("default",
|
1135
|
-
name="l7-ilb-hc",
|
1136
|
-
region="europe-west1",
|
1137
|
-
http_health_check=gcp.compute.RegionHealthCheckHttpHealthCheckArgs(
|
1138
|
-
port_specification="USE_SERVING_PORT",
|
1139
|
-
))
|
1140
|
-
# Instance template
|
1141
|
-
default_instance_template = gcp.compute.InstanceTemplate("default",
|
1142
|
-
network_interfaces=[gcp.compute.InstanceTemplateNetworkInterfaceArgs(
|
1143
|
-
access_configs=[gcp.compute.InstanceTemplateNetworkInterfaceAccessConfigArgs()],
|
1144
|
-
network=default.id,
|
1145
|
-
subnetwork=default_subnetwork.id,
|
1146
|
-
)],
|
1147
|
-
name="l7-ilb-mig-template",
|
1148
|
-
machine_type="e2-small",
|
1149
|
-
tags=["http-server"],
|
1150
|
-
disks=[gcp.compute.InstanceTemplateDiskArgs(
|
1151
|
-
source_image="debian-cloud/debian-10",
|
1152
|
-
auto_delete=True,
|
1153
|
-
boot=True,
|
1154
|
-
)],
|
1155
|
-
metadata={
|
1156
|
-
"startup-script": \"\"\"#! /bin/bash
|
1157
|
-
set -euo pipefail
|
1158
|
-
|
1159
|
-
export DEBIAN_FRONTEND=noninteractive
|
1160
|
-
apt-get update
|
1161
|
-
apt-get install -y nginx-light jq
|
1162
|
-
|
1163
|
-
NAME=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/hostname")
|
1164
|
-
IP=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip")
|
1165
|
-
METADATA=$(curl -f -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=True" | jq 'del(.["startup-script"])')
|
1166
|
-
|
1167
|
-
cat <<EOF > /var/www/html/index.html
|
1168
|
-
<pre>
|
1169
|
-
Name: $NAME
|
1170
|
-
IP: $IP
|
1171
|
-
Metadata: $METADATA
|
1172
|
-
</pre>
|
1173
|
-
EOF
|
1174
|
-
\"\"\",
|
1175
|
-
})
|
1176
|
-
# Regional MIG
|
1177
|
-
default_region_instance_group_manager = gcp.compute.RegionInstanceGroupManager("default",
|
1178
|
-
name="l7-ilb-mig1",
|
1179
|
-
region="europe-west1",
|
1180
|
-
versions=[gcp.compute.RegionInstanceGroupManagerVersionArgs(
|
1181
|
-
instance_template=default_instance_template.id,
|
1182
|
-
name="primary",
|
1183
|
-
)],
|
1184
|
-
named_ports=[gcp.compute.RegionInstanceGroupManagerNamedPortArgs(
|
1185
|
-
name="http-server",
|
1186
|
-
port=80,
|
1187
|
-
)],
|
1188
|
-
base_instance_name="vm",
|
1189
|
-
target_size=2)
|
1190
|
-
# Regional backend service
|
1191
|
-
default_region_backend_service = gcp.compute.RegionBackendService("default",
|
1192
|
-
name="l7-ilb-backend-service",
|
1193
|
-
region="europe-west1",
|
1194
|
-
protocol="HTTP",
|
1195
|
-
port_name="http-server",
|
1196
|
-
load_balancing_scheme="INTERNAL_MANAGED",
|
1197
|
-
timeout_sec=10,
|
1198
|
-
health_checks=default_region_health_check.id,
|
1199
|
-
backends=[gcp.compute.RegionBackendServiceBackendArgs(
|
1200
|
-
group=default_region_instance_group_manager.instance_group,
|
1201
|
-
balancing_mode="UTILIZATION",
|
1202
|
-
capacity_scaler=1,
|
1203
|
-
)])
|
1204
|
-
# Regional URL map
|
1205
|
-
https_lb = gcp.compute.RegionUrlMap("https_lb",
|
1206
|
-
name="l7-ilb-regional-url-map",
|
1207
|
-
region="europe-west1",
|
1208
|
-
default_service=default_region_backend_service.id)
|
1209
|
-
# Regional target HTTPS proxy
|
1210
|
-
default_region_target_https_proxy = gcp.compute.RegionTargetHttpsProxy("default",
|
1211
|
-
name="l7-ilb-target-https-proxy",
|
1212
|
-
region="europe-west1",
|
1213
|
-
url_map=https_lb.id,
|
1214
|
-
ssl_certificates=[default_region_ssl_certificate.self_link])
|
1215
|
-
# Regional forwarding rule
|
1216
|
-
default_forwarding_rule = gcp.compute.ForwardingRule("default",
|
1217
|
-
name="l7-ilb-forwarding-rule",
|
1218
|
-
region="europe-west1",
|
1219
|
-
ip_protocol="TCP",
|
1220
|
-
ip_address=default_address.id,
|
1221
|
-
load_balancing_scheme="INTERNAL_MANAGED",
|
1222
|
-
port_range="443",
|
1223
|
-
target=default_region_target_https_proxy.id,
|
1224
|
-
network=default.id,
|
1225
|
-
subnetwork=default_subnetwork.id,
|
1226
|
-
network_tier="PREMIUM")
|
1227
|
-
# Allow all access to health check ranges
|
1228
|
-
default_firewall = gcp.compute.Firewall("default",
|
1229
|
-
name="l7-ilb-fw-allow-hc",
|
1230
|
-
direction="INGRESS",
|
1231
|
-
network=default.id,
|
1232
|
-
source_ranges=[
|
1233
|
-
"130.211.0.0/22",
|
1234
|
-
"35.191.0.0/16",
|
1235
|
-
"35.235.240.0/20",
|
1236
|
-
],
|
1237
|
-
allows=[gcp.compute.FirewallAllowArgs(
|
1238
|
-
protocol="tcp",
|
1239
|
-
)])
|
1240
|
-
# Allow http from proxy subnet to backends
|
1241
|
-
backends = gcp.compute.Firewall("backends",
|
1242
|
-
name="l7-ilb-fw-allow-ilb-to-backends",
|
1243
|
-
direction="INGRESS",
|
1244
|
-
network=default.id,
|
1245
|
-
source_ranges=["10.0.0.0/24"],
|
1246
|
-
target_tags=["http-server"],
|
1247
|
-
allows=[gcp.compute.FirewallAllowArgs(
|
1248
|
-
protocol="tcp",
|
1249
|
-
ports=[
|
1250
|
-
"80",
|
1251
|
-
"443",
|
1252
|
-
"8080",
|
1253
|
-
],
|
1254
|
-
)])
|
1255
|
-
# Test instance
|
1256
|
-
default_instance = gcp.compute.Instance("default",
|
1257
|
-
name="l7-ilb-test-vm",
|
1258
|
-
zone="europe-west1-b",
|
1259
|
-
machine_type="e2-small",
|
1260
|
-
network_interfaces=[gcp.compute.InstanceNetworkInterfaceArgs(
|
1261
|
-
network=default.id,
|
1262
|
-
subnetwork=default_subnetwork.id,
|
1263
|
-
)],
|
1264
|
-
boot_disk=gcp.compute.InstanceBootDiskArgs(
|
1265
|
-
initialize_params=gcp.compute.InstanceBootDiskInitializeParamsArgs(
|
1266
|
-
image="debian-cloud/debian-10",
|
1267
|
-
),
|
1268
|
-
))
|
1269
|
-
### HTTP-to-HTTPS redirect ###
|
1270
|
-
# Regional URL map
|
1271
|
-
redirect_region_url_map = gcp.compute.RegionUrlMap("redirect",
|
1272
|
-
name="l7-ilb-redirect-url-map",
|
1273
|
-
region="europe-west1",
|
1274
|
-
default_service=default_region_backend_service.id,
|
1275
|
-
host_rules=[gcp.compute.RegionUrlMapHostRuleArgs(
|
1276
|
-
hosts=["*"],
|
1277
|
-
path_matcher="allpaths",
|
1278
|
-
)],
|
1279
|
-
path_matchers=[gcp.compute.RegionUrlMapPathMatcherArgs(
|
1280
|
-
name="allpaths",
|
1281
|
-
default_service=default_region_backend_service.id,
|
1282
|
-
path_rules=[gcp.compute.RegionUrlMapPathMatcherPathRuleArgs(
|
1283
|
-
paths=["/"],
|
1284
|
-
url_redirect=gcp.compute.RegionUrlMapPathMatcherPathRuleUrlRedirectArgs(
|
1285
|
-
https_redirect=True,
|
1286
|
-
host_redirect="10.0.1.5:443",
|
1287
|
-
redirect_response_code="PERMANENT_REDIRECT",
|
1288
|
-
strip_query=True,
|
1289
|
-
),
|
1290
|
-
)],
|
1291
|
-
)])
|
1292
|
-
# Regional HTTP proxy
|
1293
|
-
default_region_target_http_proxy = gcp.compute.RegionTargetHttpProxy("default",
|
1294
|
-
name="l7-ilb-target-http-proxy",
|
1295
|
-
region="europe-west1",
|
1296
|
-
url_map=redirect_region_url_map.id)
|
1297
|
-
# Regional forwarding rule
|
1298
|
-
redirect = gcp.compute.ForwardingRule("redirect",
|
1299
|
-
name="l7-ilb-redirect",
|
1300
|
-
region="europe-west1",
|
1301
|
-
ip_protocol="TCP",
|
1302
|
-
ip_address=default_address.id,
|
1303
|
-
load_balancing_scheme="INTERNAL_MANAGED",
|
1304
|
-
port_range="80",
|
1305
|
-
target=default_region_target_http_proxy.id,
|
1306
|
-
network=default.id,
|
1307
|
-
subnetwork=default_subnetwork.id,
|
1308
|
-
network_tier="PREMIUM")
|
1309
|
-
```
|
1310
1075
|
### Region Url Map Path Template Match
|
1311
1076
|
|
1312
1077
|
```python
|
@@ -1985,241 +1750,6 @@ class RegionUrlMap(pulumi.CustomResource):
|
|
1985
1750
|
path="/home",
|
1986
1751
|
)])
|
1987
1752
|
```
|
1988
|
-
### Int Https Lb Https Redirect
|
1989
|
-
|
1990
|
-
```python
|
1991
|
-
import pulumi
|
1992
|
-
import pulumi_gcp as gcp
|
1993
|
-
import pulumi_tls as tls
|
1994
|
-
|
1995
|
-
# Internal HTTPS load balancer with HTTP-to-HTTPS redirect
|
1996
|
-
# VPC network
|
1997
|
-
default = gcp.compute.Network("default",
|
1998
|
-
name="l7-ilb-network",
|
1999
|
-
auto_create_subnetworks=False)
|
2000
|
-
# Proxy-only subnet
|
2001
|
-
proxy_subnet = gcp.compute.Subnetwork("proxy_subnet",
|
2002
|
-
name="l7-ilb-proxy-subnet",
|
2003
|
-
ip_cidr_range="10.0.0.0/24",
|
2004
|
-
region="europe-west1",
|
2005
|
-
purpose="REGIONAL_MANAGED_PROXY",
|
2006
|
-
role="ACTIVE",
|
2007
|
-
network=default.id)
|
2008
|
-
# Backend subnet
|
2009
|
-
default_subnetwork = gcp.compute.Subnetwork("default",
|
2010
|
-
name="l7-ilb-subnet",
|
2011
|
-
ip_cidr_range="10.0.1.0/24",
|
2012
|
-
region="europe-west1",
|
2013
|
-
network=default.id)
|
2014
|
-
# Reserved internal address
|
2015
|
-
default_address = gcp.compute.Address("default",
|
2016
|
-
name="l7-ilb-ip",
|
2017
|
-
subnetwork=default_subnetwork.id,
|
2018
|
-
address_type="INTERNAL",
|
2019
|
-
address="10.0.1.5",
|
2020
|
-
region="europe-west1",
|
2021
|
-
purpose="SHARED_LOADBALANCER_VIP")
|
2022
|
-
# Self-signed regional SSL certificate for testing
|
2023
|
-
default_private_key = tls.PrivateKey("default",
|
2024
|
-
algorithm="RSA",
|
2025
|
-
rsa_bits=2048)
|
2026
|
-
default_self_signed_cert = tls.SelfSignedCert("default",
|
2027
|
-
key_algorithm=default_private_key.algorithm,
|
2028
|
-
private_key_pem=default_private_key.private_key_pem,
|
2029
|
-
validity_period_hours=12,
|
2030
|
-
early_renewal_hours=3,
|
2031
|
-
allowed_uses=[
|
2032
|
-
"key_encipherment",
|
2033
|
-
"digital_signature",
|
2034
|
-
"server_auth",
|
2035
|
-
],
|
2036
|
-
dns_names=["example.com"],
|
2037
|
-
subject=tls.SelfSignedCertSubjectArgs(
|
2038
|
-
common_name="example.com",
|
2039
|
-
organization="ACME Examples, Inc",
|
2040
|
-
))
|
2041
|
-
default_region_ssl_certificate = gcp.compute.RegionSslCertificate("default",
|
2042
|
-
name_prefix="my-certificate-",
|
2043
|
-
private_key=default_private_key.private_key_pem,
|
2044
|
-
certificate=default_self_signed_cert.cert_pem,
|
2045
|
-
region="europe-west1")
|
2046
|
-
# Regional health check
|
2047
|
-
default_region_health_check = gcp.compute.RegionHealthCheck("default",
|
2048
|
-
name="l7-ilb-hc",
|
2049
|
-
region="europe-west1",
|
2050
|
-
http_health_check=gcp.compute.RegionHealthCheckHttpHealthCheckArgs(
|
2051
|
-
port_specification="USE_SERVING_PORT",
|
2052
|
-
))
|
2053
|
-
# Instance template
|
2054
|
-
default_instance_template = gcp.compute.InstanceTemplate("default",
|
2055
|
-
network_interfaces=[gcp.compute.InstanceTemplateNetworkInterfaceArgs(
|
2056
|
-
access_configs=[gcp.compute.InstanceTemplateNetworkInterfaceAccessConfigArgs()],
|
2057
|
-
network=default.id,
|
2058
|
-
subnetwork=default_subnetwork.id,
|
2059
|
-
)],
|
2060
|
-
name="l7-ilb-mig-template",
|
2061
|
-
machine_type="e2-small",
|
2062
|
-
tags=["http-server"],
|
2063
|
-
disks=[gcp.compute.InstanceTemplateDiskArgs(
|
2064
|
-
source_image="debian-cloud/debian-10",
|
2065
|
-
auto_delete=True,
|
2066
|
-
boot=True,
|
2067
|
-
)],
|
2068
|
-
metadata={
|
2069
|
-
"startup-script": \"\"\"#! /bin/bash
|
2070
|
-
set -euo pipefail
|
2071
|
-
|
2072
|
-
export DEBIAN_FRONTEND=noninteractive
|
2073
|
-
apt-get update
|
2074
|
-
apt-get install -y nginx-light jq
|
2075
|
-
|
2076
|
-
NAME=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/hostname")
|
2077
|
-
IP=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip")
|
2078
|
-
METADATA=$(curl -f -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=True" | jq 'del(.["startup-script"])')
|
2079
|
-
|
2080
|
-
cat <<EOF > /var/www/html/index.html
|
2081
|
-
<pre>
|
2082
|
-
Name: $NAME
|
2083
|
-
IP: $IP
|
2084
|
-
Metadata: $METADATA
|
2085
|
-
</pre>
|
2086
|
-
EOF
|
2087
|
-
\"\"\",
|
2088
|
-
})
|
2089
|
-
# Regional MIG
|
2090
|
-
default_region_instance_group_manager = gcp.compute.RegionInstanceGroupManager("default",
|
2091
|
-
name="l7-ilb-mig1",
|
2092
|
-
region="europe-west1",
|
2093
|
-
versions=[gcp.compute.RegionInstanceGroupManagerVersionArgs(
|
2094
|
-
instance_template=default_instance_template.id,
|
2095
|
-
name="primary",
|
2096
|
-
)],
|
2097
|
-
named_ports=[gcp.compute.RegionInstanceGroupManagerNamedPortArgs(
|
2098
|
-
name="http-server",
|
2099
|
-
port=80,
|
2100
|
-
)],
|
2101
|
-
base_instance_name="vm",
|
2102
|
-
target_size=2)
|
2103
|
-
# Regional backend service
|
2104
|
-
default_region_backend_service = gcp.compute.RegionBackendService("default",
|
2105
|
-
name="l7-ilb-backend-service",
|
2106
|
-
region="europe-west1",
|
2107
|
-
protocol="HTTP",
|
2108
|
-
port_name="http-server",
|
2109
|
-
load_balancing_scheme="INTERNAL_MANAGED",
|
2110
|
-
timeout_sec=10,
|
2111
|
-
health_checks=default_region_health_check.id,
|
2112
|
-
backends=[gcp.compute.RegionBackendServiceBackendArgs(
|
2113
|
-
group=default_region_instance_group_manager.instance_group,
|
2114
|
-
balancing_mode="UTILIZATION",
|
2115
|
-
capacity_scaler=1,
|
2116
|
-
)])
|
2117
|
-
# Regional URL map
|
2118
|
-
https_lb = gcp.compute.RegionUrlMap("https_lb",
|
2119
|
-
name="l7-ilb-regional-url-map",
|
2120
|
-
region="europe-west1",
|
2121
|
-
default_service=default_region_backend_service.id)
|
2122
|
-
# Regional target HTTPS proxy
|
2123
|
-
default_region_target_https_proxy = gcp.compute.RegionTargetHttpsProxy("default",
|
2124
|
-
name="l7-ilb-target-https-proxy",
|
2125
|
-
region="europe-west1",
|
2126
|
-
url_map=https_lb.id,
|
2127
|
-
ssl_certificates=[default_region_ssl_certificate.self_link])
|
2128
|
-
# Regional forwarding rule
|
2129
|
-
default_forwarding_rule = gcp.compute.ForwardingRule("default",
|
2130
|
-
name="l7-ilb-forwarding-rule",
|
2131
|
-
region="europe-west1",
|
2132
|
-
ip_protocol="TCP",
|
2133
|
-
ip_address=default_address.id,
|
2134
|
-
load_balancing_scheme="INTERNAL_MANAGED",
|
2135
|
-
port_range="443",
|
2136
|
-
target=default_region_target_https_proxy.id,
|
2137
|
-
network=default.id,
|
2138
|
-
subnetwork=default_subnetwork.id,
|
2139
|
-
network_tier="PREMIUM")
|
2140
|
-
# Allow all access to health check ranges
|
2141
|
-
default_firewall = gcp.compute.Firewall("default",
|
2142
|
-
name="l7-ilb-fw-allow-hc",
|
2143
|
-
direction="INGRESS",
|
2144
|
-
network=default.id,
|
2145
|
-
source_ranges=[
|
2146
|
-
"130.211.0.0/22",
|
2147
|
-
"35.191.0.0/16",
|
2148
|
-
"35.235.240.0/20",
|
2149
|
-
],
|
2150
|
-
allows=[gcp.compute.FirewallAllowArgs(
|
2151
|
-
protocol="tcp",
|
2152
|
-
)])
|
2153
|
-
# Allow http from proxy subnet to backends
|
2154
|
-
backends = gcp.compute.Firewall("backends",
|
2155
|
-
name="l7-ilb-fw-allow-ilb-to-backends",
|
2156
|
-
direction="INGRESS",
|
2157
|
-
network=default.id,
|
2158
|
-
source_ranges=["10.0.0.0/24"],
|
2159
|
-
target_tags=["http-server"],
|
2160
|
-
allows=[gcp.compute.FirewallAllowArgs(
|
2161
|
-
protocol="tcp",
|
2162
|
-
ports=[
|
2163
|
-
"80",
|
2164
|
-
"443",
|
2165
|
-
"8080",
|
2166
|
-
],
|
2167
|
-
)])
|
2168
|
-
# Test instance
|
2169
|
-
default_instance = gcp.compute.Instance("default",
|
2170
|
-
name="l7-ilb-test-vm",
|
2171
|
-
zone="europe-west1-b",
|
2172
|
-
machine_type="e2-small",
|
2173
|
-
network_interfaces=[gcp.compute.InstanceNetworkInterfaceArgs(
|
2174
|
-
network=default.id,
|
2175
|
-
subnetwork=default_subnetwork.id,
|
2176
|
-
)],
|
2177
|
-
boot_disk=gcp.compute.InstanceBootDiskArgs(
|
2178
|
-
initialize_params=gcp.compute.InstanceBootDiskInitializeParamsArgs(
|
2179
|
-
image="debian-cloud/debian-10",
|
2180
|
-
),
|
2181
|
-
))
|
2182
|
-
### HTTP-to-HTTPS redirect ###
|
2183
|
-
# Regional URL map
|
2184
|
-
redirect_region_url_map = gcp.compute.RegionUrlMap("redirect",
|
2185
|
-
name="l7-ilb-redirect-url-map",
|
2186
|
-
region="europe-west1",
|
2187
|
-
default_service=default_region_backend_service.id,
|
2188
|
-
host_rules=[gcp.compute.RegionUrlMapHostRuleArgs(
|
2189
|
-
hosts=["*"],
|
2190
|
-
path_matcher="allpaths",
|
2191
|
-
)],
|
2192
|
-
path_matchers=[gcp.compute.RegionUrlMapPathMatcherArgs(
|
2193
|
-
name="allpaths",
|
2194
|
-
default_service=default_region_backend_service.id,
|
2195
|
-
path_rules=[gcp.compute.RegionUrlMapPathMatcherPathRuleArgs(
|
2196
|
-
paths=["/"],
|
2197
|
-
url_redirect=gcp.compute.RegionUrlMapPathMatcherPathRuleUrlRedirectArgs(
|
2198
|
-
https_redirect=True,
|
2199
|
-
host_redirect="10.0.1.5:443",
|
2200
|
-
redirect_response_code="PERMANENT_REDIRECT",
|
2201
|
-
strip_query=True,
|
2202
|
-
),
|
2203
|
-
)],
|
2204
|
-
)])
|
2205
|
-
# Regional HTTP proxy
|
2206
|
-
default_region_target_http_proxy = gcp.compute.RegionTargetHttpProxy("default",
|
2207
|
-
name="l7-ilb-target-http-proxy",
|
2208
|
-
region="europe-west1",
|
2209
|
-
url_map=redirect_region_url_map.id)
|
2210
|
-
# Regional forwarding rule
|
2211
|
-
redirect = gcp.compute.ForwardingRule("redirect",
|
2212
|
-
name="l7-ilb-redirect",
|
2213
|
-
region="europe-west1",
|
2214
|
-
ip_protocol="TCP",
|
2215
|
-
ip_address=default_address.id,
|
2216
|
-
load_balancing_scheme="INTERNAL_MANAGED",
|
2217
|
-
port_range="80",
|
2218
|
-
target=default_region_target_http_proxy.id,
|
2219
|
-
network=default.id,
|
2220
|
-
subnetwork=default_subnetwork.id,
|
2221
|
-
network_tier="PREMIUM")
|
2222
|
-
```
|
2223
1753
|
### Region Url Map Path Template Match
|
2224
1754
|
|
2225
1755
|
```python
|