README.md
June 10, 2026 ยท View on GitHub
Description
This module facilitates the creation of custom firewall rules for existing networks.
Example usage
This module can be used by other Toolkit modules to create application-specific firewall rules or in conjunction with the pre-existing-vpc module to enable traffic in existing networks. The snippet below is drawn from the ml-slurm.yaml example:
- group: primary
modules:
- id: network
source: modules/network/pre-existing-vpc
# this example anticipates that the VPC default network has internal traffic
# allowed and IAP tunneling for SSH connections
- id: firewall_rule
source: modules/network/firewall-rules
use:
- network
settings:
ingress_rules:
- name: $(vars.deployment_name)-allow-internal-traffic
description: Allow internal traffic
destination_ranges:
- $(network.subnetwork_address)
source_ranges:
- $(network.subnetwork_address)
allow:
- protocol: tcp
ports:
- 0-65535
- protocol: udp
ports:
- 0-65535
- protocol: icmp
- name: $(vars.deployment_name)-allow-iap-ssh
description: Allow IAP-tunneled SSH connections
destination_ranges:
- $(network.subnetwork_address)
source_ranges:
- 35.235.240.0/20
allow:
- protocol: tcp
ports:
- 22
Copyright 2026 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.
Requirements
| Name | Version |
|---|---|
| terraform | >= 1.12.2 |
| >= 3.83 |
Providers
| Name | Version |
|---|---|
| >= 3.83 | |
| terraform | n/a |
Modules
| Name | Source | Version |
|---|---|---|
| firewall_rule | terraform-google-modules/network/google//modules/firewall-rules | ~> 13.0 |
Resources
| Name | Type |
|---|---|
| terraform_data.pga_check | resource |
| google_compute_subnetwork.subnetwork | data source |
Inputs
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| egress_rules | List of egress rules | list(object({ | [] | no |
| ingress_rules | List of ingress rules | list(object({ | [] | no |
| network_name | The name of the network to create firewall rules in | string | null | no |
| project_id | The project ID to host the network in | string | null | no |
| subnetwork_self_link | The self link of the subnetwork whose global network firewall rules will be modified. | string | n/a | yes |
Outputs
No outputs.