create_firewall_rule
Set up firewall rules in a GCP project by defining traffic direction, priority, source/destination ranges, allowed/denied protocols, and tags for targeted control over network security.
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 |
---|---|---|---|
allowed_protocols | No | ||
denied_protocols | No | ||
description | No | ||
destination_ranges | No | ||
direction | Yes | ||
name | Yes | ||
network | Yes | ||
priority | Yes | ||
project_id | Yes | ||
source_ranges | No | ||
source_tags | No | ||
target_tags | No |
Input Schema (JSON Schema)
{
"properties": {
"allowed_protocols": {
"anyOf": [
{
"items": {
"type": "object"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Allowed Protocols"
},
"denied_protocols": {
"anyOf": [
{
"items": {
"type": "object"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Denied Protocols"
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Description"
},
"destination_ranges": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Destination Ranges"
},
"direction": {
"title": "Direction",
"type": "string"
},
"name": {
"title": "Name",
"type": "string"
},
"network": {
"title": "Network",
"type": "string"
},
"priority": {
"title": "Priority",
"type": "integer"
},
"project_id": {
"title": "Project Id",
"type": "string"
},
"source_ranges": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Source Ranges"
},
"source_tags": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Source Tags"
},
"target_tags": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Target Tags"
}
},
"required": [
"project_id",
"name",
"network",
"direction",
"priority"
],
"title": "create_firewall_ruleArguments",
"type": "object"
}