gcp.compute.firewall_rule.ensure ​
Create a GCP firewall rule idempotently
Creates a GCP firewall rule if it does not exist. When an identically-named rule already exists, returns without modification (idempotent).
Inputs:
- connection_uuid: Cloud connection UUID (required)
- name: Firewall rule name (required)
- network: VPC network name (required)
- direction: "INGRESS" | "EGRESS" (default "EGRESS")
- protocols: Protocols to allow (required). Accepts three shapes: (a) list of protocol names — ["tcp"] or ["tcp", "udp"]; (b) GCP-native "allowed" dicts — [{"IPProtocol": "tcp", "ports": ["8080"]}, {"IPProtocol": "udp"}]; (c) combined strings — ["tcp:8080", "udp:53"]. Ports carried in the dict/combined forms are unioned with the top-level
portsinput. - ports: List of port strings, e.g. ["443"] (optional)
- source_ranges: List of CIDRs (optional — required for INGRESS)
- destination_ranges: List of CIDRs (optional — required for EGRESS)
- description: Free-text description (optional)
- project_id: Explicit project_id (optional; defaults to connection)
Outputs:
- name
- project_id
- existed: bool
Overview ​
| Property | Value |
|---|---|
| Workflow type | Atomic |
| Library | Base-gcp |
| Version | 1.0 |
Input Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
connection_uuid | uuid | Yes | — | — |
name | string | Yes | — | — |
network | string | Yes | — | — |
direction | string | No | — | — |
protocols | json | Yes | — | Protocols to allow. Accepts (a) protocol-name strings ["tcp", "udp"], (b) GCP-native allowed dicts [{"IPProtocol": "tcp", "ports": ["8080"]}], or (c) combined "tcp:8080" strings. Ports from the dict/combined forms are unioned with the top-level 'ports' input. |
ports | json | No | — | — |
source_ranges | json | No | — | — |
destination_ranges | json | No | — | — |
description | string | No | — | — |
project_id | string | No | — | — |
Output Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
connection_uuid | uuid | No | — | — |
name | string | No | — | — |
network | string | No | — | — |
direction | string | No | — | — |
protocols | json | No | — | — |
ports | json | No | — | — |
source_ranges | json | No | — | — |
destination_ranges | json | No | — | — |
description | string | No | — | — |
project_id | string | No | — | — |
existed | boolean | No | — | — |
failure_reason | string | No | — | — |
failure_type | string | No | — | — |
failed_action | string | No | — | — |
failed_at_state | string | No | — | — |
failed_step | string | No | — | — |
failed_layer | string | No | — | — |
error | string | No | — | — |
error_type | string | No | — | — |
States ​
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
pending | Yes | No | — | execute | — |
completed | No | Yes | Yes | — | — |
failed | No | Yes | No | — | — |
State Diagram ​
Transitions ​
| From | Action | To | Description |
|---|---|---|---|
pending | execute | completed | — |
* (any state) | fail | failed | — |
API Usage ​
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "gcp.compute.firewall_rule.ensure",
"initial_data": {
"connection_uuid": "value",
"name": "value",
"network": "value",
"protocols": "value"
}
}