create_firewall_rule
Create a firewall rule in GCP to allow or deny network traffic by configuring direction, protocols, ports, IP ranges, and tags.
Instructions
Create a firewall rule in a GCP project.
Args:
project_id: The ID of the GCP project
name: The name of the firewall rule
network: The name of the network to create the firewall rule for
direction: The direction of traffic to match ('INGRESS' or 'EGRESS')
priority: The priority of the rule (lower number = higher priority, 0-65535)
source_ranges: Optional list of source IP ranges (for INGRESS)
destination_ranges: Optional list of destination IP ranges (for EGRESS)
allowed_protocols: Optional list of allowed protocols, e.g. [{"IPProtocol": "tcp", "ports": ["80", "443"]}]
denied_protocols: Optional list of denied protocols, e.g. [{"IPProtocol": "tcp", "ports": ["22"]}]
target_tags: Optional list of target instance tags
source_tags: Optional list of source instance tags (for INGRESS)
description: Optional description for the firewall rule
Returns:
Result of the firewall rule creation
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| network | Yes | ||
| priority | Yes | ||
| direction | Yes | ||
| project_id | Yes | ||
| description | No | ||
| source_tags | No | ||
| target_tags | No | ||
| source_ranges | No | ||
| denied_protocols | No | ||
| allowed_protocols | No | ||
| destination_ranges | No |