pulumi-gcp 7.24.0a1716588893__py3-none-any.whl → 7.25.0a1717097889__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/accesscontextmanager/service_perimeter_egress_policy.py +0 -64
- pulumi_gcp/accesscontextmanager/service_perimeter_ingress_policy.py +0 -70
- pulumi_gcp/alloydb/backup.py +50 -42
- pulumi_gcp/alloydb/cluster.py +56 -48
- pulumi_gcp/alloydb/instance.py +50 -42
- pulumi_gcp/alloydb/user.py +32 -24
- pulumi_gcp/apigateway/api_config.py +0 -114
- pulumi_gcp/apigateway/gateway.py +0 -44
- pulumi_gcp/apigee/addons_config.py +14 -4
- pulumi_gcp/apigee/endpoint_attachment.py +4 -2
- pulumi_gcp/apigee/env_group.py +4 -2
- pulumi_gcp/apigee/environment.py +4 -2
- pulumi_gcp/apigee/instance.py +22 -8
- pulumi_gcp/apigee/keystores_aliases_self_signed_cert.py +26 -10
- pulumi_gcp/apigee/nat_address.py +10 -2
- pulumi_gcp/apigee/organization.py +18 -6
- pulumi_gcp/apigee/sync_authorization.py +8 -4
- pulumi_gcp/apigee/target_server.py +26 -10
- pulumi_gcp/apphub/service.py +40 -20
- pulumi_gcp/apphub/service_project_attachment.py +16 -8
- pulumi_gcp/apphub/workload.py +0 -418
- pulumi_gcp/applicationintegration/auth_config.py +4 -2
- pulumi_gcp/artifactregistry/repository.py +14 -12
- pulumi_gcp/backupdisasterrecovery/management_server.py +4 -2
- pulumi_gcp/bigquery/data_transfer_config.py +8 -4
- pulumi_gcp/bigquery/job.py +22 -16
- pulumi_gcp/certificateauthority/authority.py +10 -2
- pulumi_gcp/certificateauthority/certificate.py +8 -4
- pulumi_gcp/certificatemanager/certificate.py +84 -80
- pulumi_gcp/certificatemanager/certificate_issuance_config.py +32 -30
- pulumi_gcp/cloudbuild/bitbucket_server_config.py +12 -6
- pulumi_gcp/cloudbuild/trigger.py +22 -14
- pulumi_gcp/cloudbuild/worker_pool.py +12 -6
- pulumi_gcp/cloudbuildv2/connection.py +10 -2
- pulumi_gcp/cloudbuildv2/repository.py +10 -2
- pulumi_gcp/cloudfunctionsv2/function.py +110 -62
- pulumi_gcp/cloudids/endpoint.py +4 -2
- pulumi_gcp/cloudrunv2/job.py +32 -20
- pulumi_gcp/cloudrunv2/service.py +28 -20
- pulumi_gcp/compute/forwarding_rule.py +225 -817
- pulumi_gcp/compute/global_forwarding_rule.py +0 -766
- pulumi_gcp/compute/instance_group.py +0 -100
- pulumi_gcp/compute/packet_mirroring.py +4 -2
- pulumi_gcp/compute/region_security_policy_rule.py +4 -2
- pulumi_gcp/compute/region_ssl_certificate.py +0 -188
- pulumi_gcp/compute/route.py +10 -2
- pulumi_gcp/compute/ssl_certificate.py +0 -166
- pulumi_gcp/compute/target_instance.py +4 -2
- pulumi_gcp/compute/vpn_gateway.py +12 -2
- pulumi_gcp/compute/vpn_tunnel.py +26 -16
- pulumi_gcp/databasemigrationservice/connection_profile.py +32 -16
- pulumi_gcp/datacatalog/policy_tag.py +4 -2
- pulumi_gcp/datafusion/instance.py +14 -12
- pulumi_gcp/dataplex/asset.py +4 -2
- pulumi_gcp/dataplex/datascan.py +16 -14
- pulumi_gcp/datastore/data_store_index.py +4 -2
- pulumi_gcp/datastream/stream.py +16 -10
- pulumi_gcp/diagflow/cx_test_case.py +4 -4
- pulumi_gcp/diagflow/entity_type.py +4 -2
- pulumi_gcp/diagflow/fulfillment.py +4 -2
- pulumi_gcp/diagflow/intent.py +8 -4
- pulumi_gcp/edgecontainer/node_pool.py +4 -2
- pulumi_gcp/edgecontainer/vpn_connection.py +4 -2
- pulumi_gcp/eventarc/channel.py +4 -2
- pulumi_gcp/eventarc/google_channel_config.py +4 -2
- pulumi_gcp/firebase/app_check_app_attest_config.py +16 -8
- pulumi_gcp/firebase/app_check_debug_token.py +8 -4
- pulumi_gcp/firebase/app_check_device_check_config.py +8 -4
- pulumi_gcp/firebase/app_check_play_integrity_config.py +16 -8
- pulumi_gcp/firebase/app_check_recaptcha_enterprise_config.py +8 -4
- pulumi_gcp/firebase/app_check_recaptcha_v3_config.py +8 -4
- pulumi_gcp/firebase/app_check_service_config.py +12 -6
- pulumi_gcp/firebase/database_instance.py +4 -2
- pulumi_gcp/firebaserules/release.py +0 -98
- pulumi_gcp/firestore/database.py +24 -20
- pulumi_gcp/firestore/document.py +24 -12
- pulumi_gcp/folder/access_approval_settings.py +4 -2
- pulumi_gcp/gkehub/membership_binding.py +14 -4
- pulumi_gcp/gkehub/membership_rbac_role_binding.py +8 -4
- pulumi_gcp/gkehub/namespace.py +4 -2
- pulumi_gcp/gkehub/scope_rbac_role_binding.py +4 -2
- pulumi_gcp/integrationconnectors/connection.py +4 -2
- pulumi_gcp/integrationconnectors/managed_zone.py +18 -6
- pulumi_gcp/logging/folder_settings.py +12 -10
- pulumi_gcp/logging/linked_dataset.py +4 -2
- pulumi_gcp/logging/organization_settings.py +12 -10
- pulumi_gcp/logging/project_bucket_config.py +4 -2
- pulumi_gcp/looker/instance.py +12 -10
- pulumi_gcp/netapp/volume_replication.py +4 -2
- pulumi_gcp/netapp/volume_snapshot.py +4 -2
- pulumi_gcp/networkconnectivity/internal_range.py +14 -12
- pulumi_gcp/networksecurity/gateway_security_policy.py +16 -4
- pulumi_gcp/networksecurity/tls_inspection_policy.py +22 -4
- pulumi_gcp/networkservices/gateway.py +12 -6
- pulumi_gcp/networkservices/lb_traffic_extension.py +0 -526
- pulumi_gcp/organizations/access_approval_settings.py +4 -2
- pulumi_gcp/parallelstore/instance.py +20 -18
- pulumi_gcp/projects/access_approval_settings.py +4 -2
- pulumi_gcp/pubsub/schema.py +4 -2
- pulumi_gcp/pubsub/subscription.py +94 -62
- pulumi_gcp/pubsub/topic.py +4 -2
- pulumi_gcp/pulumi-plugin.json +1 -1
- pulumi_gcp/redis/cluster.py +30 -28
- pulumi_gcp/redis/instance.py +4 -2
- pulumi_gcp/secretmanager/secret.py +4 -2
- pulumi_gcp/securesourcemanager/instance.py +20 -8
- pulumi_gcp/securitycenter/instance_iam_binding.py +14 -12
- pulumi_gcp/securitycenter/instance_iam_member.py +14 -12
- pulumi_gcp/securitycenter/instance_iam_policy.py +14 -12
- pulumi_gcp/serviceaccount/key.py +2 -2
- pulumi_gcp/sql/database_instance.py +4 -2
- pulumi_gcp/storage/get_project_service_account.py +4 -2
- pulumi_gcp/storage/insights_report_config.py +12 -10
- pulumi_gcp/storage/notification.py +18 -16
- pulumi_gcp/storage/transfer_agent_pool.py +4 -2
- pulumi_gcp/storage/transfer_job.py +14 -4
- pulumi_gcp/tpu/v2_vm.py +10 -6
- pulumi_gcp/vertex/ai_endpoint.py +24 -22
- pulumi_gcp/vertex/ai_index_endpoint.py +20 -18
- pulumi_gcp/vertex/ai_tensorboard.py +14 -12
- pulumi_gcp/vmwareengine/external_address.py +4 -2
- pulumi_gcp/vmwareengine/network.py +8 -4
- {pulumi_gcp-7.24.0a1716588893.dist-info → pulumi_gcp-7.25.0a1717097889.dist-info}/METADATA +1 -1
- {pulumi_gcp-7.24.0a1716588893.dist-info → pulumi_gcp-7.25.0a1717097889.dist-info}/RECORD +126 -126
- {pulumi_gcp-7.24.0a1716588893.dist-info → pulumi_gcp-7.25.0a1717097889.dist-info}/WHEEL +0 -0
- {pulumi_gcp-7.24.0a1716588893.dist-info → pulumi_gcp-7.25.0a1717097889.dist-info}/top_level.txt +0 -0
@@ -1186,240 +1186,6 @@ class GlobalForwardingRule(pulumi.CustomResource):
|
|
1186
1186
|
|
1187
1187
|
## Example Usage
|
1188
1188
|
|
1189
|
-
### External Tcp Proxy Lb Mig Backend
|
1190
|
-
|
1191
|
-
```python
|
1192
|
-
import pulumi
|
1193
|
-
import pulumi_gcp as gcp
|
1194
|
-
|
1195
|
-
# External TCP proxy load balancer with managed instance group backend
|
1196
|
-
# VPC
|
1197
|
-
default = gcp.compute.Network("default",
|
1198
|
-
name="tcp-proxy-xlb-network",
|
1199
|
-
auto_create_subnetworks=False)
|
1200
|
-
# backend subnet
|
1201
|
-
default_subnetwork = gcp.compute.Subnetwork("default",
|
1202
|
-
name="tcp-proxy-xlb-subnet",
|
1203
|
-
ip_cidr_range="10.0.1.0/24",
|
1204
|
-
region="us-central1",
|
1205
|
-
network=default.id)
|
1206
|
-
# reserved IP address
|
1207
|
-
default_global_address = gcp.compute.GlobalAddress("default", name="tcp-proxy-xlb-ip")
|
1208
|
-
default_health_check = gcp.compute.HealthCheck("default",
|
1209
|
-
name="tcp-proxy-health-check",
|
1210
|
-
timeout_sec=1,
|
1211
|
-
check_interval_sec=1,
|
1212
|
-
tcp_health_check=gcp.compute.HealthCheckTcpHealthCheckArgs(
|
1213
|
-
port=80,
|
1214
|
-
))
|
1215
|
-
# instance template
|
1216
|
-
default_instance_template = gcp.compute.InstanceTemplate("default",
|
1217
|
-
network_interfaces=[gcp.compute.InstanceTemplateNetworkInterfaceArgs(
|
1218
|
-
access_configs=[gcp.compute.InstanceTemplateNetworkInterfaceAccessConfigArgs()],
|
1219
|
-
network=default.id,
|
1220
|
-
subnetwork=default_subnetwork.id,
|
1221
|
-
)],
|
1222
|
-
name="tcp-proxy-xlb-mig-template",
|
1223
|
-
machine_type="e2-small",
|
1224
|
-
tags=["allow-health-check"],
|
1225
|
-
disks=[gcp.compute.InstanceTemplateDiskArgs(
|
1226
|
-
source_image="debian-cloud/debian-10",
|
1227
|
-
auto_delete=True,
|
1228
|
-
boot=True,
|
1229
|
-
)],
|
1230
|
-
metadata={
|
1231
|
-
"startup-script": \"\"\"#! /bin/bash
|
1232
|
-
set -euo pipefail
|
1233
|
-
export DEBIAN_FRONTEND=noninteractive
|
1234
|
-
apt-get update
|
1235
|
-
apt-get install -y nginx-light jq
|
1236
|
-
NAME=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/hostname")
|
1237
|
-
IP=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip")
|
1238
|
-
METADATA=$(curl -f -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=True" | jq 'del(.["startup-script"])')
|
1239
|
-
cat <<EOF > /var/www/html/index.html
|
1240
|
-
<pre>
|
1241
|
-
Name: $NAME
|
1242
|
-
IP: $IP
|
1243
|
-
Metadata: $METADATA
|
1244
|
-
</pre>
|
1245
|
-
EOF
|
1246
|
-
\"\"\",
|
1247
|
-
})
|
1248
|
-
# MIG
|
1249
|
-
default_instance_group_manager = gcp.compute.InstanceGroupManager("default",
|
1250
|
-
name="tcp-proxy-xlb-mig1",
|
1251
|
-
zone="us-central1-c",
|
1252
|
-
named_ports=[gcp.compute.InstanceGroupManagerNamedPortArgs(
|
1253
|
-
name="tcp",
|
1254
|
-
port=80,
|
1255
|
-
)],
|
1256
|
-
versions=[gcp.compute.InstanceGroupManagerVersionArgs(
|
1257
|
-
instance_template=default_instance_template.id,
|
1258
|
-
name="primary",
|
1259
|
-
)],
|
1260
|
-
base_instance_name="vm",
|
1261
|
-
target_size=2)
|
1262
|
-
# backend service
|
1263
|
-
default_backend_service = gcp.compute.BackendService("default",
|
1264
|
-
name="tcp-proxy-xlb-backend-service",
|
1265
|
-
protocol="TCP",
|
1266
|
-
port_name="tcp",
|
1267
|
-
load_balancing_scheme="EXTERNAL",
|
1268
|
-
timeout_sec=10,
|
1269
|
-
health_checks=default_health_check.id,
|
1270
|
-
backends=[gcp.compute.BackendServiceBackendArgs(
|
1271
|
-
group=default_instance_group_manager.instance_group,
|
1272
|
-
balancing_mode="UTILIZATION",
|
1273
|
-
max_utilization=1,
|
1274
|
-
capacity_scaler=1,
|
1275
|
-
)])
|
1276
|
-
default_target_tcp_proxy = gcp.compute.TargetTCPProxy("default",
|
1277
|
-
name="test-proxy-health-check",
|
1278
|
-
backend_service=default_backend_service.id)
|
1279
|
-
# forwarding rule
|
1280
|
-
default_global_forwarding_rule = gcp.compute.GlobalForwardingRule("default",
|
1281
|
-
name="tcp-proxy-xlb-forwarding-rule",
|
1282
|
-
ip_protocol="TCP",
|
1283
|
-
load_balancing_scheme="EXTERNAL",
|
1284
|
-
port_range="110",
|
1285
|
-
target=default_target_tcp_proxy.id,
|
1286
|
-
ip_address=default_global_address.id)
|
1287
|
-
# allow access from health check ranges
|
1288
|
-
default_firewall = gcp.compute.Firewall("default",
|
1289
|
-
name="tcp-proxy-xlb-fw-allow-hc",
|
1290
|
-
direction="INGRESS",
|
1291
|
-
network=default.id,
|
1292
|
-
source_ranges=[
|
1293
|
-
"130.211.0.0/22",
|
1294
|
-
"35.191.0.0/16",
|
1295
|
-
],
|
1296
|
-
allows=[gcp.compute.FirewallAllowArgs(
|
1297
|
-
protocol="tcp",
|
1298
|
-
)],
|
1299
|
-
target_tags=["allow-health-check"])
|
1300
|
-
```
|
1301
|
-
### External Http Lb Mig Backend Custom Header
|
1302
|
-
|
1303
|
-
```python
|
1304
|
-
import pulumi
|
1305
|
-
import pulumi_gcp as gcp
|
1306
|
-
|
1307
|
-
# External HTTP load balancer with a CDN-enabled managed instance group backend
|
1308
|
-
# and custom request and response headers
|
1309
|
-
# VPC
|
1310
|
-
default = gcp.compute.Network("default",
|
1311
|
-
name="l7-xlb-network",
|
1312
|
-
auto_create_subnetworks=False)
|
1313
|
-
# backend subnet
|
1314
|
-
default_subnetwork = gcp.compute.Subnetwork("default",
|
1315
|
-
name="l7-xlb-subnet",
|
1316
|
-
ip_cidr_range="10.0.1.0/24",
|
1317
|
-
region="us-central1",
|
1318
|
-
network=default.id)
|
1319
|
-
# reserved IP address
|
1320
|
-
default_global_address = gcp.compute.GlobalAddress("default", name="l7-xlb-static-ip")
|
1321
|
-
# health check
|
1322
|
-
default_health_check = gcp.compute.HealthCheck("default",
|
1323
|
-
name="l7-xlb-hc",
|
1324
|
-
http_health_check=gcp.compute.HealthCheckHttpHealthCheckArgs(
|
1325
|
-
port_specification="USE_SERVING_PORT",
|
1326
|
-
))
|
1327
|
-
# instance template
|
1328
|
-
default_instance_template = gcp.compute.InstanceTemplate("default",
|
1329
|
-
network_interfaces=[gcp.compute.InstanceTemplateNetworkInterfaceArgs(
|
1330
|
-
access_configs=[gcp.compute.InstanceTemplateNetworkInterfaceAccessConfigArgs()],
|
1331
|
-
network=default.id,
|
1332
|
-
subnetwork=default_subnetwork.id,
|
1333
|
-
)],
|
1334
|
-
name="l7-xlb-mig-template",
|
1335
|
-
machine_type="e2-small",
|
1336
|
-
tags=["allow-health-check"],
|
1337
|
-
disks=[gcp.compute.InstanceTemplateDiskArgs(
|
1338
|
-
source_image="debian-cloud/debian-10",
|
1339
|
-
auto_delete=True,
|
1340
|
-
boot=True,
|
1341
|
-
)],
|
1342
|
-
metadata={
|
1343
|
-
"startup-script": \"\"\"#! /bin/bash
|
1344
|
-
set -euo pipefail
|
1345
|
-
|
1346
|
-
export DEBIAN_FRONTEND=noninteractive
|
1347
|
-
apt-get update
|
1348
|
-
apt-get install -y nginx-light jq
|
1349
|
-
|
1350
|
-
NAME=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/hostname")
|
1351
|
-
IP=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip")
|
1352
|
-
METADATA=$(curl -f -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=True" | jq 'del(.["startup-script"])')
|
1353
|
-
|
1354
|
-
cat <<EOF > /var/www/html/index.html
|
1355
|
-
<pre>
|
1356
|
-
Name: $NAME
|
1357
|
-
IP: $IP
|
1358
|
-
Metadata: $METADATA
|
1359
|
-
</pre>
|
1360
|
-
EOF
|
1361
|
-
\"\"\",
|
1362
|
-
})
|
1363
|
-
# MIG
|
1364
|
-
default_instance_group_manager = gcp.compute.InstanceGroupManager("default",
|
1365
|
-
name="l7-xlb-mig1",
|
1366
|
-
zone="us-central1-c",
|
1367
|
-
named_ports=[gcp.compute.InstanceGroupManagerNamedPortArgs(
|
1368
|
-
name="http",
|
1369
|
-
port=8080,
|
1370
|
-
)],
|
1371
|
-
versions=[gcp.compute.InstanceGroupManagerVersionArgs(
|
1372
|
-
instance_template=default_instance_template.id,
|
1373
|
-
name="primary",
|
1374
|
-
)],
|
1375
|
-
base_instance_name="vm",
|
1376
|
-
target_size=2)
|
1377
|
-
# backend service with custom request and response headers
|
1378
|
-
default_backend_service = gcp.compute.BackendService("default",
|
1379
|
-
name="l7-xlb-backend-service",
|
1380
|
-
protocol="HTTP",
|
1381
|
-
port_name="my-port",
|
1382
|
-
load_balancing_scheme="EXTERNAL",
|
1383
|
-
timeout_sec=10,
|
1384
|
-
enable_cdn=True,
|
1385
|
-
custom_request_headers=["X-Client-Geo-Location: {client_region_subdivision}, {client_city}"],
|
1386
|
-
custom_response_headers=["X-Cache-Hit: {cdn_cache_status}"],
|
1387
|
-
health_checks=default_health_check.id,
|
1388
|
-
backends=[gcp.compute.BackendServiceBackendArgs(
|
1389
|
-
group=default_instance_group_manager.instance_group,
|
1390
|
-
balancing_mode="UTILIZATION",
|
1391
|
-
capacity_scaler=1,
|
1392
|
-
)])
|
1393
|
-
# url map
|
1394
|
-
default_url_map = gcp.compute.URLMap("default",
|
1395
|
-
name="l7-xlb-url-map",
|
1396
|
-
default_service=default_backend_service.id)
|
1397
|
-
# http proxy
|
1398
|
-
default_target_http_proxy = gcp.compute.TargetHttpProxy("default",
|
1399
|
-
name="l7-xlb-target-http-proxy",
|
1400
|
-
url_map=default_url_map.id)
|
1401
|
-
# forwarding rule
|
1402
|
-
default_global_forwarding_rule = gcp.compute.GlobalForwardingRule("default",
|
1403
|
-
name="l7-xlb-forwarding-rule",
|
1404
|
-
ip_protocol="TCP",
|
1405
|
-
load_balancing_scheme="EXTERNAL",
|
1406
|
-
port_range="80",
|
1407
|
-
target=default_target_http_proxy.id,
|
1408
|
-
ip_address=default_global_address.id)
|
1409
|
-
# allow access from health check ranges
|
1410
|
-
default_firewall = gcp.compute.Firewall("default",
|
1411
|
-
name="l7-xlb-fw-allow-hc",
|
1412
|
-
direction="INGRESS",
|
1413
|
-
network=default.id,
|
1414
|
-
source_ranges=[
|
1415
|
-
"130.211.0.0/22",
|
1416
|
-
"35.191.0.0/16",
|
1417
|
-
],
|
1418
|
-
allows=[gcp.compute.FirewallAllowArgs(
|
1419
|
-
protocol="tcp",
|
1420
|
-
)],
|
1421
|
-
target_tags=["allow-health-check"])
|
1422
|
-
```
|
1423
1189
|
### Global Forwarding Rule Http
|
1424
1190
|
|
1425
1191
|
```python
|
@@ -1689,155 +1455,6 @@ class GlobalForwardingRule(pulumi.CustomResource):
|
|
1689
1455
|
target=default_target_http_proxy.id,
|
1690
1456
|
port_range="80")
|
1691
1457
|
```
|
1692
|
-
### Global Internal Http Lb With Mig Backend
|
1693
|
-
|
1694
|
-
```python
|
1695
|
-
import pulumi
|
1696
|
-
import pulumi_gcp as gcp
|
1697
|
-
|
1698
|
-
# Global Internal HTTP load balancer with a managed instance group backend
|
1699
|
-
# VPC network
|
1700
|
-
gilb_network = gcp.compute.Network("gilb_network",
|
1701
|
-
name="l7-gilb-network",
|
1702
|
-
auto_create_subnetworks=False)
|
1703
|
-
# proxy-only subnet
|
1704
|
-
proxy_subnet = gcp.compute.Subnetwork("proxy_subnet",
|
1705
|
-
name="l7-gilb-proxy-subnet",
|
1706
|
-
ip_cidr_range="10.0.0.0/24",
|
1707
|
-
region="europe-west1",
|
1708
|
-
purpose="GLOBAL_MANAGED_PROXY",
|
1709
|
-
role="ACTIVE",
|
1710
|
-
network=gilb_network.id)
|
1711
|
-
# backend subnet
|
1712
|
-
gilb_subnet = gcp.compute.Subnetwork("gilb_subnet",
|
1713
|
-
name="l7-gilb-subnet",
|
1714
|
-
ip_cidr_range="10.0.1.0/24",
|
1715
|
-
region="europe-west1",
|
1716
|
-
network=gilb_network.id)
|
1717
|
-
# health check
|
1718
|
-
default_health_check = gcp.compute.HealthCheck("default",
|
1719
|
-
name="l7-gilb-hc",
|
1720
|
-
http_health_check=gcp.compute.HealthCheckHttpHealthCheckArgs(
|
1721
|
-
port_specification="USE_SERVING_PORT",
|
1722
|
-
))
|
1723
|
-
# instance template
|
1724
|
-
instance_template = gcp.compute.InstanceTemplate("instance_template",
|
1725
|
-
network_interfaces=[gcp.compute.InstanceTemplateNetworkInterfaceArgs(
|
1726
|
-
access_configs=[gcp.compute.InstanceTemplateNetworkInterfaceAccessConfigArgs()],
|
1727
|
-
network=gilb_network.id,
|
1728
|
-
subnetwork=gilb_subnet.id,
|
1729
|
-
)],
|
1730
|
-
name="l7-gilb-mig-template",
|
1731
|
-
machine_type="e2-small",
|
1732
|
-
tags=["http-server"],
|
1733
|
-
disks=[gcp.compute.InstanceTemplateDiskArgs(
|
1734
|
-
source_image="debian-cloud/debian-10",
|
1735
|
-
auto_delete=True,
|
1736
|
-
boot=True,
|
1737
|
-
)],
|
1738
|
-
metadata={
|
1739
|
-
"startup-script": \"\"\"#! /bin/bash
|
1740
|
-
set -euo pipefail
|
1741
|
-
|
1742
|
-
export DEBIAN_FRONTEND=noninteractive
|
1743
|
-
apt-get update
|
1744
|
-
apt-get install -y nginx-light jq
|
1745
|
-
|
1746
|
-
NAME=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/hostname")
|
1747
|
-
IP=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip")
|
1748
|
-
METADATA=$(curl -f -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=True" | jq 'del(.["startup-script"])')
|
1749
|
-
|
1750
|
-
cat <<EOF > /var/www/html/index.html
|
1751
|
-
<pre>
|
1752
|
-
Name: $NAME
|
1753
|
-
IP: $IP
|
1754
|
-
Metadata: $METADATA
|
1755
|
-
</pre>
|
1756
|
-
EOF
|
1757
|
-
\"\"\",
|
1758
|
-
})
|
1759
|
-
# MIG
|
1760
|
-
mig = gcp.compute.InstanceGroupManager("mig",
|
1761
|
-
name="l7-gilb-mig1",
|
1762
|
-
zone="europe-west1-b",
|
1763
|
-
versions=[gcp.compute.InstanceGroupManagerVersionArgs(
|
1764
|
-
instance_template=instance_template.id,
|
1765
|
-
name="primary",
|
1766
|
-
)],
|
1767
|
-
base_instance_name="vm",
|
1768
|
-
target_size=2)
|
1769
|
-
# backend service
|
1770
|
-
default_backend_service = gcp.compute.BackendService("default",
|
1771
|
-
name="l7-gilb-backend-subnet",
|
1772
|
-
protocol="HTTP",
|
1773
|
-
load_balancing_scheme="INTERNAL_MANAGED",
|
1774
|
-
timeout_sec=10,
|
1775
|
-
health_checks=default_health_check.id,
|
1776
|
-
backends=[gcp.compute.BackendServiceBackendArgs(
|
1777
|
-
group=mig.instance_group,
|
1778
|
-
balancing_mode="UTILIZATION",
|
1779
|
-
capacity_scaler=1,
|
1780
|
-
)])
|
1781
|
-
# URL map
|
1782
|
-
default_url_map = gcp.compute.URLMap("default",
|
1783
|
-
name="l7-gilb-url-map",
|
1784
|
-
default_service=default_backend_service.id)
|
1785
|
-
# HTTP target proxy
|
1786
|
-
default = gcp.compute.TargetHttpProxy("default",
|
1787
|
-
name="l7-gilb-target-http-proxy",
|
1788
|
-
url_map=default_url_map.id)
|
1789
|
-
# forwarding rule
|
1790
|
-
google_compute_forwarding_rule = gcp.compute.GlobalForwardingRule("google_compute_forwarding_rule",
|
1791
|
-
name="l7-gilb-forwarding-rule",
|
1792
|
-
ip_protocol="TCP",
|
1793
|
-
load_balancing_scheme="INTERNAL_MANAGED",
|
1794
|
-
port_range="80",
|
1795
|
-
target=default.id,
|
1796
|
-
network=gilb_network.id,
|
1797
|
-
subnetwork=gilb_subnet.id)
|
1798
|
-
# allow all access from IAP and health check ranges
|
1799
|
-
fw_iap = gcp.compute.Firewall("fw-iap",
|
1800
|
-
name="l7-gilb-fw-allow-iap-hc",
|
1801
|
-
direction="INGRESS",
|
1802
|
-
network=gilb_network.id,
|
1803
|
-
source_ranges=[
|
1804
|
-
"130.211.0.0/22",
|
1805
|
-
"35.191.0.0/16",
|
1806
|
-
"35.235.240.0/20",
|
1807
|
-
],
|
1808
|
-
allows=[gcp.compute.FirewallAllowArgs(
|
1809
|
-
protocol="tcp",
|
1810
|
-
)])
|
1811
|
-
# allow http from proxy subnet to backends
|
1812
|
-
fw_gilb_to_backends = gcp.compute.Firewall("fw-gilb-to-backends",
|
1813
|
-
name="l7-gilb-fw-allow-gilb-to-backends",
|
1814
|
-
direction="INGRESS",
|
1815
|
-
network=gilb_network.id,
|
1816
|
-
source_ranges=["10.0.0.0/24"],
|
1817
|
-
target_tags=["http-server"],
|
1818
|
-
allows=[gcp.compute.FirewallAllowArgs(
|
1819
|
-
protocol="tcp",
|
1820
|
-
ports=[
|
1821
|
-
"80",
|
1822
|
-
"443",
|
1823
|
-
"8080",
|
1824
|
-
],
|
1825
|
-
)])
|
1826
|
-
# test instance
|
1827
|
-
vm_test = gcp.compute.Instance("vm-test",
|
1828
|
-
name="l7-gilb-test-vm",
|
1829
|
-
zone="europe-west1-b",
|
1830
|
-
machine_type="e2-small",
|
1831
|
-
network_interfaces=[gcp.compute.InstanceNetworkInterfaceArgs(
|
1832
|
-
network=gilb_network.id,
|
1833
|
-
subnetwork=gilb_subnet.id,
|
1834
|
-
)],
|
1835
|
-
boot_disk=gcp.compute.InstanceBootDiskArgs(
|
1836
|
-
initialize_params=gcp.compute.InstanceBootDiskInitializeParamsArgs(
|
1837
|
-
image="debian-cloud/debian-10",
|
1838
|
-
),
|
1839
|
-
))
|
1840
|
-
```
|
1841
1458
|
### Private Service Connect Google Apis
|
1842
1459
|
|
1843
1460
|
```python
|
@@ -2085,240 +1702,6 @@ class GlobalForwardingRule(pulumi.CustomResource):
|
|
2085
1702
|
|
2086
1703
|
## Example Usage
|
2087
1704
|
|
2088
|
-
### External Tcp Proxy Lb Mig Backend
|
2089
|
-
|
2090
|
-
```python
|
2091
|
-
import pulumi
|
2092
|
-
import pulumi_gcp as gcp
|
2093
|
-
|
2094
|
-
# External TCP proxy load balancer with managed instance group backend
|
2095
|
-
# VPC
|
2096
|
-
default = gcp.compute.Network("default",
|
2097
|
-
name="tcp-proxy-xlb-network",
|
2098
|
-
auto_create_subnetworks=False)
|
2099
|
-
# backend subnet
|
2100
|
-
default_subnetwork = gcp.compute.Subnetwork("default",
|
2101
|
-
name="tcp-proxy-xlb-subnet",
|
2102
|
-
ip_cidr_range="10.0.1.0/24",
|
2103
|
-
region="us-central1",
|
2104
|
-
network=default.id)
|
2105
|
-
# reserved IP address
|
2106
|
-
default_global_address = gcp.compute.GlobalAddress("default", name="tcp-proxy-xlb-ip")
|
2107
|
-
default_health_check = gcp.compute.HealthCheck("default",
|
2108
|
-
name="tcp-proxy-health-check",
|
2109
|
-
timeout_sec=1,
|
2110
|
-
check_interval_sec=1,
|
2111
|
-
tcp_health_check=gcp.compute.HealthCheckTcpHealthCheckArgs(
|
2112
|
-
port=80,
|
2113
|
-
))
|
2114
|
-
# instance template
|
2115
|
-
default_instance_template = gcp.compute.InstanceTemplate("default",
|
2116
|
-
network_interfaces=[gcp.compute.InstanceTemplateNetworkInterfaceArgs(
|
2117
|
-
access_configs=[gcp.compute.InstanceTemplateNetworkInterfaceAccessConfigArgs()],
|
2118
|
-
network=default.id,
|
2119
|
-
subnetwork=default_subnetwork.id,
|
2120
|
-
)],
|
2121
|
-
name="tcp-proxy-xlb-mig-template",
|
2122
|
-
machine_type="e2-small",
|
2123
|
-
tags=["allow-health-check"],
|
2124
|
-
disks=[gcp.compute.InstanceTemplateDiskArgs(
|
2125
|
-
source_image="debian-cloud/debian-10",
|
2126
|
-
auto_delete=True,
|
2127
|
-
boot=True,
|
2128
|
-
)],
|
2129
|
-
metadata={
|
2130
|
-
"startup-script": \"\"\"#! /bin/bash
|
2131
|
-
set -euo pipefail
|
2132
|
-
export DEBIAN_FRONTEND=noninteractive
|
2133
|
-
apt-get update
|
2134
|
-
apt-get install -y nginx-light jq
|
2135
|
-
NAME=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/hostname")
|
2136
|
-
IP=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip")
|
2137
|
-
METADATA=$(curl -f -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=True" | jq 'del(.["startup-script"])')
|
2138
|
-
cat <<EOF > /var/www/html/index.html
|
2139
|
-
<pre>
|
2140
|
-
Name: $NAME
|
2141
|
-
IP: $IP
|
2142
|
-
Metadata: $METADATA
|
2143
|
-
</pre>
|
2144
|
-
EOF
|
2145
|
-
\"\"\",
|
2146
|
-
})
|
2147
|
-
# MIG
|
2148
|
-
default_instance_group_manager = gcp.compute.InstanceGroupManager("default",
|
2149
|
-
name="tcp-proxy-xlb-mig1",
|
2150
|
-
zone="us-central1-c",
|
2151
|
-
named_ports=[gcp.compute.InstanceGroupManagerNamedPortArgs(
|
2152
|
-
name="tcp",
|
2153
|
-
port=80,
|
2154
|
-
)],
|
2155
|
-
versions=[gcp.compute.InstanceGroupManagerVersionArgs(
|
2156
|
-
instance_template=default_instance_template.id,
|
2157
|
-
name="primary",
|
2158
|
-
)],
|
2159
|
-
base_instance_name="vm",
|
2160
|
-
target_size=2)
|
2161
|
-
# backend service
|
2162
|
-
default_backend_service = gcp.compute.BackendService("default",
|
2163
|
-
name="tcp-proxy-xlb-backend-service",
|
2164
|
-
protocol="TCP",
|
2165
|
-
port_name="tcp",
|
2166
|
-
load_balancing_scheme="EXTERNAL",
|
2167
|
-
timeout_sec=10,
|
2168
|
-
health_checks=default_health_check.id,
|
2169
|
-
backends=[gcp.compute.BackendServiceBackendArgs(
|
2170
|
-
group=default_instance_group_manager.instance_group,
|
2171
|
-
balancing_mode="UTILIZATION",
|
2172
|
-
max_utilization=1,
|
2173
|
-
capacity_scaler=1,
|
2174
|
-
)])
|
2175
|
-
default_target_tcp_proxy = gcp.compute.TargetTCPProxy("default",
|
2176
|
-
name="test-proxy-health-check",
|
2177
|
-
backend_service=default_backend_service.id)
|
2178
|
-
# forwarding rule
|
2179
|
-
default_global_forwarding_rule = gcp.compute.GlobalForwardingRule("default",
|
2180
|
-
name="tcp-proxy-xlb-forwarding-rule",
|
2181
|
-
ip_protocol="TCP",
|
2182
|
-
load_balancing_scheme="EXTERNAL",
|
2183
|
-
port_range="110",
|
2184
|
-
target=default_target_tcp_proxy.id,
|
2185
|
-
ip_address=default_global_address.id)
|
2186
|
-
# allow access from health check ranges
|
2187
|
-
default_firewall = gcp.compute.Firewall("default",
|
2188
|
-
name="tcp-proxy-xlb-fw-allow-hc",
|
2189
|
-
direction="INGRESS",
|
2190
|
-
network=default.id,
|
2191
|
-
source_ranges=[
|
2192
|
-
"130.211.0.0/22",
|
2193
|
-
"35.191.0.0/16",
|
2194
|
-
],
|
2195
|
-
allows=[gcp.compute.FirewallAllowArgs(
|
2196
|
-
protocol="tcp",
|
2197
|
-
)],
|
2198
|
-
target_tags=["allow-health-check"])
|
2199
|
-
```
|
2200
|
-
### External Http Lb Mig Backend Custom Header
|
2201
|
-
|
2202
|
-
```python
|
2203
|
-
import pulumi
|
2204
|
-
import pulumi_gcp as gcp
|
2205
|
-
|
2206
|
-
# External HTTP load balancer with a CDN-enabled managed instance group backend
|
2207
|
-
# and custom request and response headers
|
2208
|
-
# VPC
|
2209
|
-
default = gcp.compute.Network("default",
|
2210
|
-
name="l7-xlb-network",
|
2211
|
-
auto_create_subnetworks=False)
|
2212
|
-
# backend subnet
|
2213
|
-
default_subnetwork = gcp.compute.Subnetwork("default",
|
2214
|
-
name="l7-xlb-subnet",
|
2215
|
-
ip_cidr_range="10.0.1.0/24",
|
2216
|
-
region="us-central1",
|
2217
|
-
network=default.id)
|
2218
|
-
# reserved IP address
|
2219
|
-
default_global_address = gcp.compute.GlobalAddress("default", name="l7-xlb-static-ip")
|
2220
|
-
# health check
|
2221
|
-
default_health_check = gcp.compute.HealthCheck("default",
|
2222
|
-
name="l7-xlb-hc",
|
2223
|
-
http_health_check=gcp.compute.HealthCheckHttpHealthCheckArgs(
|
2224
|
-
port_specification="USE_SERVING_PORT",
|
2225
|
-
))
|
2226
|
-
# instance template
|
2227
|
-
default_instance_template = gcp.compute.InstanceTemplate("default",
|
2228
|
-
network_interfaces=[gcp.compute.InstanceTemplateNetworkInterfaceArgs(
|
2229
|
-
access_configs=[gcp.compute.InstanceTemplateNetworkInterfaceAccessConfigArgs()],
|
2230
|
-
network=default.id,
|
2231
|
-
subnetwork=default_subnetwork.id,
|
2232
|
-
)],
|
2233
|
-
name="l7-xlb-mig-template",
|
2234
|
-
machine_type="e2-small",
|
2235
|
-
tags=["allow-health-check"],
|
2236
|
-
disks=[gcp.compute.InstanceTemplateDiskArgs(
|
2237
|
-
source_image="debian-cloud/debian-10",
|
2238
|
-
auto_delete=True,
|
2239
|
-
boot=True,
|
2240
|
-
)],
|
2241
|
-
metadata={
|
2242
|
-
"startup-script": \"\"\"#! /bin/bash
|
2243
|
-
set -euo pipefail
|
2244
|
-
|
2245
|
-
export DEBIAN_FRONTEND=noninteractive
|
2246
|
-
apt-get update
|
2247
|
-
apt-get install -y nginx-light jq
|
2248
|
-
|
2249
|
-
NAME=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/hostname")
|
2250
|
-
IP=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip")
|
2251
|
-
METADATA=$(curl -f -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=True" | jq 'del(.["startup-script"])')
|
2252
|
-
|
2253
|
-
cat <<EOF > /var/www/html/index.html
|
2254
|
-
<pre>
|
2255
|
-
Name: $NAME
|
2256
|
-
IP: $IP
|
2257
|
-
Metadata: $METADATA
|
2258
|
-
</pre>
|
2259
|
-
EOF
|
2260
|
-
\"\"\",
|
2261
|
-
})
|
2262
|
-
# MIG
|
2263
|
-
default_instance_group_manager = gcp.compute.InstanceGroupManager("default",
|
2264
|
-
name="l7-xlb-mig1",
|
2265
|
-
zone="us-central1-c",
|
2266
|
-
named_ports=[gcp.compute.InstanceGroupManagerNamedPortArgs(
|
2267
|
-
name="http",
|
2268
|
-
port=8080,
|
2269
|
-
)],
|
2270
|
-
versions=[gcp.compute.InstanceGroupManagerVersionArgs(
|
2271
|
-
instance_template=default_instance_template.id,
|
2272
|
-
name="primary",
|
2273
|
-
)],
|
2274
|
-
base_instance_name="vm",
|
2275
|
-
target_size=2)
|
2276
|
-
# backend service with custom request and response headers
|
2277
|
-
default_backend_service = gcp.compute.BackendService("default",
|
2278
|
-
name="l7-xlb-backend-service",
|
2279
|
-
protocol="HTTP",
|
2280
|
-
port_name="my-port",
|
2281
|
-
load_balancing_scheme="EXTERNAL",
|
2282
|
-
timeout_sec=10,
|
2283
|
-
enable_cdn=True,
|
2284
|
-
custom_request_headers=["X-Client-Geo-Location: {client_region_subdivision}, {client_city}"],
|
2285
|
-
custom_response_headers=["X-Cache-Hit: {cdn_cache_status}"],
|
2286
|
-
health_checks=default_health_check.id,
|
2287
|
-
backends=[gcp.compute.BackendServiceBackendArgs(
|
2288
|
-
group=default_instance_group_manager.instance_group,
|
2289
|
-
balancing_mode="UTILIZATION",
|
2290
|
-
capacity_scaler=1,
|
2291
|
-
)])
|
2292
|
-
# url map
|
2293
|
-
default_url_map = gcp.compute.URLMap("default",
|
2294
|
-
name="l7-xlb-url-map",
|
2295
|
-
default_service=default_backend_service.id)
|
2296
|
-
# http proxy
|
2297
|
-
default_target_http_proxy = gcp.compute.TargetHttpProxy("default",
|
2298
|
-
name="l7-xlb-target-http-proxy",
|
2299
|
-
url_map=default_url_map.id)
|
2300
|
-
# forwarding rule
|
2301
|
-
default_global_forwarding_rule = gcp.compute.GlobalForwardingRule("default",
|
2302
|
-
name="l7-xlb-forwarding-rule",
|
2303
|
-
ip_protocol="TCP",
|
2304
|
-
load_balancing_scheme="EXTERNAL",
|
2305
|
-
port_range="80",
|
2306
|
-
target=default_target_http_proxy.id,
|
2307
|
-
ip_address=default_global_address.id)
|
2308
|
-
# allow access from health check ranges
|
2309
|
-
default_firewall = gcp.compute.Firewall("default",
|
2310
|
-
name="l7-xlb-fw-allow-hc",
|
2311
|
-
direction="INGRESS",
|
2312
|
-
network=default.id,
|
2313
|
-
source_ranges=[
|
2314
|
-
"130.211.0.0/22",
|
2315
|
-
"35.191.0.0/16",
|
2316
|
-
],
|
2317
|
-
allows=[gcp.compute.FirewallAllowArgs(
|
2318
|
-
protocol="tcp",
|
2319
|
-
)],
|
2320
|
-
target_tags=["allow-health-check"])
|
2321
|
-
```
|
2322
1705
|
### Global Forwarding Rule Http
|
2323
1706
|
|
2324
1707
|
```python
|
@@ -2588,155 +1971,6 @@ class GlobalForwardingRule(pulumi.CustomResource):
|
|
2588
1971
|
target=default_target_http_proxy.id,
|
2589
1972
|
port_range="80")
|
2590
1973
|
```
|
2591
|
-
### Global Internal Http Lb With Mig Backend
|
2592
|
-
|
2593
|
-
```python
|
2594
|
-
import pulumi
|
2595
|
-
import pulumi_gcp as gcp
|
2596
|
-
|
2597
|
-
# Global Internal HTTP load balancer with a managed instance group backend
|
2598
|
-
# VPC network
|
2599
|
-
gilb_network = gcp.compute.Network("gilb_network",
|
2600
|
-
name="l7-gilb-network",
|
2601
|
-
auto_create_subnetworks=False)
|
2602
|
-
# proxy-only subnet
|
2603
|
-
proxy_subnet = gcp.compute.Subnetwork("proxy_subnet",
|
2604
|
-
name="l7-gilb-proxy-subnet",
|
2605
|
-
ip_cidr_range="10.0.0.0/24",
|
2606
|
-
region="europe-west1",
|
2607
|
-
purpose="GLOBAL_MANAGED_PROXY",
|
2608
|
-
role="ACTIVE",
|
2609
|
-
network=gilb_network.id)
|
2610
|
-
# backend subnet
|
2611
|
-
gilb_subnet = gcp.compute.Subnetwork("gilb_subnet",
|
2612
|
-
name="l7-gilb-subnet",
|
2613
|
-
ip_cidr_range="10.0.1.0/24",
|
2614
|
-
region="europe-west1",
|
2615
|
-
network=gilb_network.id)
|
2616
|
-
# health check
|
2617
|
-
default_health_check = gcp.compute.HealthCheck("default",
|
2618
|
-
name="l7-gilb-hc",
|
2619
|
-
http_health_check=gcp.compute.HealthCheckHttpHealthCheckArgs(
|
2620
|
-
port_specification="USE_SERVING_PORT",
|
2621
|
-
))
|
2622
|
-
# instance template
|
2623
|
-
instance_template = gcp.compute.InstanceTemplate("instance_template",
|
2624
|
-
network_interfaces=[gcp.compute.InstanceTemplateNetworkInterfaceArgs(
|
2625
|
-
access_configs=[gcp.compute.InstanceTemplateNetworkInterfaceAccessConfigArgs()],
|
2626
|
-
network=gilb_network.id,
|
2627
|
-
subnetwork=gilb_subnet.id,
|
2628
|
-
)],
|
2629
|
-
name="l7-gilb-mig-template",
|
2630
|
-
machine_type="e2-small",
|
2631
|
-
tags=["http-server"],
|
2632
|
-
disks=[gcp.compute.InstanceTemplateDiskArgs(
|
2633
|
-
source_image="debian-cloud/debian-10",
|
2634
|
-
auto_delete=True,
|
2635
|
-
boot=True,
|
2636
|
-
)],
|
2637
|
-
metadata={
|
2638
|
-
"startup-script": \"\"\"#! /bin/bash
|
2639
|
-
set -euo pipefail
|
2640
|
-
|
2641
|
-
export DEBIAN_FRONTEND=noninteractive
|
2642
|
-
apt-get update
|
2643
|
-
apt-get install -y nginx-light jq
|
2644
|
-
|
2645
|
-
NAME=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/hostname")
|
2646
|
-
IP=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip")
|
2647
|
-
METADATA=$(curl -f -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=True" | jq 'del(.["startup-script"])')
|
2648
|
-
|
2649
|
-
cat <<EOF > /var/www/html/index.html
|
2650
|
-
<pre>
|
2651
|
-
Name: $NAME
|
2652
|
-
IP: $IP
|
2653
|
-
Metadata: $METADATA
|
2654
|
-
</pre>
|
2655
|
-
EOF
|
2656
|
-
\"\"\",
|
2657
|
-
})
|
2658
|
-
# MIG
|
2659
|
-
mig = gcp.compute.InstanceGroupManager("mig",
|
2660
|
-
name="l7-gilb-mig1",
|
2661
|
-
zone="europe-west1-b",
|
2662
|
-
versions=[gcp.compute.InstanceGroupManagerVersionArgs(
|
2663
|
-
instance_template=instance_template.id,
|
2664
|
-
name="primary",
|
2665
|
-
)],
|
2666
|
-
base_instance_name="vm",
|
2667
|
-
target_size=2)
|
2668
|
-
# backend service
|
2669
|
-
default_backend_service = gcp.compute.BackendService("default",
|
2670
|
-
name="l7-gilb-backend-subnet",
|
2671
|
-
protocol="HTTP",
|
2672
|
-
load_balancing_scheme="INTERNAL_MANAGED",
|
2673
|
-
timeout_sec=10,
|
2674
|
-
health_checks=default_health_check.id,
|
2675
|
-
backends=[gcp.compute.BackendServiceBackendArgs(
|
2676
|
-
group=mig.instance_group,
|
2677
|
-
balancing_mode="UTILIZATION",
|
2678
|
-
capacity_scaler=1,
|
2679
|
-
)])
|
2680
|
-
# URL map
|
2681
|
-
default_url_map = gcp.compute.URLMap("default",
|
2682
|
-
name="l7-gilb-url-map",
|
2683
|
-
default_service=default_backend_service.id)
|
2684
|
-
# HTTP target proxy
|
2685
|
-
default = gcp.compute.TargetHttpProxy("default",
|
2686
|
-
name="l7-gilb-target-http-proxy",
|
2687
|
-
url_map=default_url_map.id)
|
2688
|
-
# forwarding rule
|
2689
|
-
google_compute_forwarding_rule = gcp.compute.GlobalForwardingRule("google_compute_forwarding_rule",
|
2690
|
-
name="l7-gilb-forwarding-rule",
|
2691
|
-
ip_protocol="TCP",
|
2692
|
-
load_balancing_scheme="INTERNAL_MANAGED",
|
2693
|
-
port_range="80",
|
2694
|
-
target=default.id,
|
2695
|
-
network=gilb_network.id,
|
2696
|
-
subnetwork=gilb_subnet.id)
|
2697
|
-
# allow all access from IAP and health check ranges
|
2698
|
-
fw_iap = gcp.compute.Firewall("fw-iap",
|
2699
|
-
name="l7-gilb-fw-allow-iap-hc",
|
2700
|
-
direction="INGRESS",
|
2701
|
-
network=gilb_network.id,
|
2702
|
-
source_ranges=[
|
2703
|
-
"130.211.0.0/22",
|
2704
|
-
"35.191.0.0/16",
|
2705
|
-
"35.235.240.0/20",
|
2706
|
-
],
|
2707
|
-
allows=[gcp.compute.FirewallAllowArgs(
|
2708
|
-
protocol="tcp",
|
2709
|
-
)])
|
2710
|
-
# allow http from proxy subnet to backends
|
2711
|
-
fw_gilb_to_backends = gcp.compute.Firewall("fw-gilb-to-backends",
|
2712
|
-
name="l7-gilb-fw-allow-gilb-to-backends",
|
2713
|
-
direction="INGRESS",
|
2714
|
-
network=gilb_network.id,
|
2715
|
-
source_ranges=["10.0.0.0/24"],
|
2716
|
-
target_tags=["http-server"],
|
2717
|
-
allows=[gcp.compute.FirewallAllowArgs(
|
2718
|
-
protocol="tcp",
|
2719
|
-
ports=[
|
2720
|
-
"80",
|
2721
|
-
"443",
|
2722
|
-
"8080",
|
2723
|
-
],
|
2724
|
-
)])
|
2725
|
-
# test instance
|
2726
|
-
vm_test = gcp.compute.Instance("vm-test",
|
2727
|
-
name="l7-gilb-test-vm",
|
2728
|
-
zone="europe-west1-b",
|
2729
|
-
machine_type="e2-small",
|
2730
|
-
network_interfaces=[gcp.compute.InstanceNetworkInterfaceArgs(
|
2731
|
-
network=gilb_network.id,
|
2732
|
-
subnetwork=gilb_subnet.id,
|
2733
|
-
)],
|
2734
|
-
boot_disk=gcp.compute.InstanceBootDiskArgs(
|
2735
|
-
initialize_params=gcp.compute.InstanceBootDiskInitializeParamsArgs(
|
2736
|
-
image="debian-cloud/debian-10",
|
2737
|
-
),
|
2738
|
-
))
|
2739
|
-
```
|
2740
1974
|
### Private Service Connect Google Apis
|
2741
1975
|
|
2742
1976
|
```python
|