-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathmain.tf
70 lines (55 loc) · 2.24 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
resource "google_compute_service_attachment" "psc_ilb_service_attachment" {
name = "my-psc-ilb-${local.name_suffix}"
region = "us-west2"
description = "A service attachment configured with Terraform"
domain_names = ["gcp.tfacc.hashicorptest.com."]
enable_proxy_protocol = true
connection_preference = "ACCEPT_MANUAL"
nat_subnets = [google_compute_subnetwork.psc_ilb_nat.id]
target_service = google_compute_forwarding_rule.psc_ilb_target_service.id
consumer_reject_lists = ["673497134629", "482878270665"]
consumer_accept_lists {
project_id_or_num = "658859330310"
connection_limit = 4
}
reconcile_connections = false
}
resource "google_compute_forwarding_rule" "psc_ilb_target_service" {
name = "producer-forwarding-rule-${local.name_suffix}"
region = "us-west2"
load_balancing_scheme = "INTERNAL"
backend_service = google_compute_region_backend_service.producer_service_backend.id
all_ports = true
network = google_compute_network.psc_ilb_network.name
subnetwork = google_compute_subnetwork.psc_ilb_producer_subnetwork.name
}
resource "google_compute_region_backend_service" "producer_service_backend" {
name = "producer-service-${local.name_suffix}"
region = "us-west2"
health_checks = [google_compute_health_check.producer_service_health_check.id]
}
resource "google_compute_health_check" "producer_service_health_check" {
name = "producer-service-health-check-${local.name_suffix}"
check_interval_sec = 1
timeout_sec = 1
tcp_health_check {
port = "80"
}
}
resource "google_compute_network" "psc_ilb_network" {
name = "psc-ilb-network-${local.name_suffix}"
auto_create_subnetworks = false
}
resource "google_compute_subnetwork" "psc_ilb_producer_subnetwork" {
name = "psc-ilb-producer-subnetwork-${local.name_suffix}"
region = "us-west2"
network = google_compute_network.psc_ilb_network.id
ip_cidr_range = "10.0.0.0/16"
}
resource "google_compute_subnetwork" "psc_ilb_nat" {
name = "psc-ilb-nat-${local.name_suffix}"
region = "us-west2"
network = google_compute_network.psc_ilb_network.id
purpose = "PRIVATE_SERVICE_CONNECT"
ip_cidr_range = "10.1.0.0/16"
}