chaostoolkit-examples/apphub-l7ilb-urlmap-fault-injection/app/terraform/firewall.tf (20 lines of code) (raw):
#
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# allow all access from IAP and health check ranges
resource "google_compute_firewall" "fw_iap" {
name = "l7-ilb-fw-allow-iap-hc-apphub"
direction = "INGRESS"
network = google_compute_network.ilb_vpc.id
source_ranges = ["130.211.0.0/22", "35.191.0.0/16", "35.235.240.0/20"]
allow {
protocol = "tcp"
}
}
# allow http from proxy subnet to backends
resource "google_compute_firewall" "fw_ilb_to_backends" {
name = "l7-ilb-fw-allow-ilb-to-backends-apphub"
direction = "INGRESS"
network = google_compute_network.ilb_vpc.id
source_ranges = [google_compute_subnetwork.proxy_subnet.ip_cidr_range]
target_tags = ["http-server"]
allow {
protocol = "tcp"
ports = ["80", "443", "8080"]
}
}