Collection of Firewall Rules

Type: array of object

All items must be unique

Each item of this array must be:

Type: object

Ensures that if Service-Accounts are specified in either Sources or Targets, only IP CIDR Ranges or Service-Accounts can be included in them.

If the conditions in the "If" tab are respected, then the conditions in the "Then" tab should be respected. Otherwise, the conditions in the "Else" tab should be respected.


Type: object

Validates the presence of a service account in the sources array.

Type: array

At least one of the items must be:

Type: string

The email address of a service account. Firewall rules can target or be applied based on service accounts.

Must match regular expression: ^\S+@\S+\.\S+$

Must be at most 63 characters long


Examples:

"project-number-compute@developer.gserviceaccount.com"
"project-id@appspot.gserviceaccount.com"
"project-number@cloudservices.gserviceaccount.com"
Type: object

Validates the presence of a service account in the targets array.

Type: array

At least one of the items must be:

Type: string

The email address of a service account. Firewall rules can target or be applied based on service accounts.

Must match regular expression: ^\S+@\S+\.\S+$

Must be at most 63 characters long


Examples:

"project-number-compute@developer.gserviceaccount.com"
"project-id@appspot.gserviceaccount.com"
"project-number@cloudservices.gserviceaccount.com"
Type: object

Type: array

Each item of this array must be:


Type: string

IP space allocated to this subnetwork in CIDR format.

Must match regular expression: ^(?:([0-9]|[1-9][0-9]{0,1}|1[0-9]{1,2}|2[0-4][0-9]|25[0-5])(\.([0-9]|[1-9][0-9]{0,1}|1[0-9]{1,2}|2[0-4][0-9]|25[0-5])){3}/(([0-9]|[1-2][0-9]|3[0-2])))$
Example:

"192.168.0.0/24"
Type: string

The email address of a service account. Firewall rules can target or be applied based on service accounts.

Must match regular expression: ^\S+@\S+\.\S+$

Must be at most 63 characters long


Examples:

"project-number-compute@developer.gserviceaccount.com"
"project-id@appspot.gserviceaccount.com"
"project-number@cloudservices.gserviceaccount.com"

Type: array

Each item of this array must be:


Type: string

IP space allocated to this subnetwork in CIDR format.

Must match regular expression: ^(?:([0-9]|[1-9][0-9]{0,1}|1[0-9]{1,2}|2[0-4][0-9]|25[0-5])(\.([0-9]|[1-9][0-9]{0,1}|1[0-9]{1,2}|2[0-4][0-9]|25[0-5])){3}/(([0-9]|[1-2][0-9]|3[0-2])))$
Example:

"192.168.0.0/24"
Type: string

The email address of a service account. Firewall rules can target or be applied based on service accounts.

Must match regular expression: ^\S+@\S+\.\S+$

Must be at most 63 characters long


Examples:

"project-number-compute@developer.gserviceaccount.com"
"project-id@appspot.gserviceaccount.com"
"project-number@cloudservices.gserviceaccount.com"

Type: boolean Default: false

Indicates if the rule is disabled.


Examples:

true
false

Type: string

The name of the firewall rule. If not specified, it will be based on the id field.

Must match regular expression: ^(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)$

Must be at least 1 characters long

Must be at most 63 characters long


Example:

"<prefix>-<environment>-<network>-firewall-<id>"

Default: "ALLOW"

Defines whether the rule allows or denies traffic.

Type: const

Allow the traffic.

Specific value: "ALLOW"
Type: const

Deny the traffic.

Specific value: "DENY"

Examples:

"ALLOW"
"DENY"

Default: "INGRESS"

The direction of traffic to which this rule applies. Can be ingress (incoming traffic) or egress (outgoing traffic).

Type: const

Incoming traffic direction.

Specific value: "INGRESS"
Type: const

Outgoing traffic direction.

Specific value: "EGRESS"

Examples:

"INGRESS"
"EGRESS"

Type: string

A detailed description of the rule.


Example:

"This rule allows traffic from specific IP ranges."

Type: string

The Google Cloud project ID to use for this firewall rule. If omitted, then project_id will be inherited.

Must match regular expression: ^(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)$

Must be at least 5 characters long

Must be at most 63 characters long


Example:

"my-example-project"

Type: string

The network to which this rule is attached. If omitted, then network will be inherited.

Must match regular expression: ^(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)$

Must be at least 5 characters long

Must be at most 63 characters long


Example:

"default-vpc"

Type: string

A unique identifier for the rule. If not specified, the name will be based on this field.

Must match regular expression: ^[a-z0-9][a-z0-9-]{0,23}$

Must be at least 1 characters long

Must be at most 24 characters long


Example:

"example-rule-id-allow-tcp-443"

Type: string

The prefix to apply to the rule when generating a dynamic name.


Example:

"fw-rule"

Type: string

The environment to apply the rule to.


Examples:

"prod"
"dev"
"stage"

Type: array of object

A list of individual rules that define the behavior of the firewall rule based on specified conditions of protocol and port combinations.

Must contain a minimum of 1 items

All items must be unique

Each item of this array must be:


Type: object

If the conditions in the "If" tab are respected, then the conditions in the "Then" tab should be respected. Otherwise, the conditions in the "Else" tab should be respected.

Type: object

Type: string
Must match regular expression: ^(TCP|UDP)$
Type: object
No Additional Properties

Type: enum (of string) Default: "TCP"

The IP protocol to which this rule applies. The value can be TCP, UDP, ICMP, or ALL.

Must be one of:

  • "ALL"
  • "AH"
  • "ESP"
  • "ICMP"
  • "IPIP"
  • "SCTP"
  • "TCP"
  • "UDP"

Examples:

"TCP"
"UDP"
"ICMP"

Type: array of string Default: []

A list of ports or port-ranges to which the firewall rule will apply. If no port or port range is specified, all ranges are applied.

Must contain a minimum of 0 items

Each item of this array must be:


Type: object
Must match regular expression: ^(0|6[0-5][0-5][0-3][0-5]|[1-5][0-9][0-9][0-9][0-9]|[1-9][0-9]{0,3})-(6[0-5][0-5][0-3][0-5]|[1-5][0-9][0-9][0-9][0-9]|[1-9][0-9]{0,3})$
Type: object
Must match regular expression: ^(0|6[0-5][0-5][0-3][0-5]|[1-5][0-9][0-9][0-9][0-9]|[1-9][0-9]{0,3})$
Type: object

If the conditions in the "If" tab are respected, then the conditions in the "Then" tab should be respected. Otherwise, the conditions in the "Else" tab should be respected.

Type: object

Type: string
Must match regular expression: ^(ALL|ICMP|ESP|AH|SCTP|IPIP)$
Type: object
No Additional Properties

Type: enum (of string) Default: "TCP"

The IP protocol to which this rule applies. The value can be TCP, UDP, ICMP, or ALL.

Must be one of:

  • "ALL"
  • "AH"
  • "ESP"
  • "ICMP"
  • "IPIP"
  • "SCTP"
  • "TCP"
  • "UDP"

Examples:

"TCP"
"UDP"
"ICMP"

Type: array of string

For protocols other than TCP/UDP this should be an empty list.

Must contain a maximum of 0 items

Each item of this array must be:

Type: string
Must match regular expression: ^(?!.*)

Must be at most 0 characters long

Type: enum (of string) Default: "TCP"

The IP protocol to which this rule applies. The value can be TCP, UDP, ICMP, or ALL.

Must be one of:

  • "ALL"
  • "AH"
  • "ESP"
  • "ICMP"
  • "IPIP"
  • "SCTP"
  • "TCP"
  • "UDP"

Examples:

"TCP"
"UDP"
"ICMP"

Example:

{
    "protocol": "TCP",
    "ports": [
        "80",
        "443"
    ]
}

Type: array of string Default: []

List of source specifications for the firewall rule. Can be an IP CIDR range, a tag, or a service account email.

Must contain a minimum of 0 items

Each item of this array must be:


Type: string

IP space allocated to this subnetwork in CIDR format.

Must match regular expression: ^(?:([0-9]|[1-9][0-9]{0,1}|1[0-9]{1,2}|2[0-4][0-9]|25[0-5])(\.([0-9]|[1-9][0-9]{0,1}|1[0-9]{1,2}|2[0-4][0-9]|25[0-5])){3}/(([0-9]|[1-2][0-9]|3[0-2])))$
Example:

"192.168.0.0/24"
Type: string

Strings added to a tags field in a resource, such as Compute Engine virtual machine (VM) instances or instance templates. Tags enable you to make firewall rules and routes applicable to specific VM instances.

Must match regular expression: ^(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)$

Must be at most 63 characters long


Examples:

"alpha-tag"
"bravo-tag"
"charlie-tag"
"web-server"
"database"
Type: string

The email address of a service account. Firewall rules can target or be applied based on service accounts.

Must match regular expression: ^\S+@\S+\.\S+$

Must be at most 63 characters long


Examples:

"project-number-compute@developer.gserviceaccount.com"
"project-id@appspot.gserviceaccount.com"
"project-number@cloudservices.gserviceaccount.com"

Examples:

"192.168.1.0/24"
"example-tag"
"example-service-account@example.com"

Type: array of string Default: []

List of target specifications for the firewall rule. Can be an IP CIDR range, a tag, or a service account email.

Must contain a minimum of 0 items

Each item of this array must be:


Type: string

IP space allocated to this subnetwork in CIDR format.

Must match regular expression: ^(?:([0-9]|[1-9][0-9]{0,1}|1[0-9]{1,2}|2[0-4][0-9]|25[0-5])(\.([0-9]|[1-9][0-9]{0,1}|1[0-9]{1,2}|2[0-4][0-9]|25[0-5])){3}/(([0-9]|[1-2][0-9]|3[0-2])))$
Example:

"192.168.0.0/24"
Type: string

Strings added to a tags field in a resource, such as Compute Engine virtual machine (VM) instances or instance templates. Tags enable you to make firewall rules and routes applicable to specific VM instances.

Must match regular expression: ^(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)$

Must be at most 63 characters long


Examples:

"alpha-tag"
"bravo-tag"
"charlie-tag"
"web-server"
"database"
Type: string

The email address of a service account. Firewall rules can target or be applied based on service accounts.

Must match regular expression: ^\S+@\S+\.\S+$

Must be at most 63 characters long


Examples:

"project-number-compute@developer.gserviceaccount.com"
"project-id@appspot.gserviceaccount.com"
"project-number@cloudservices.gserviceaccount.com"

Examples:

"192.168.1.0/24"
"example-tag"
"example-service-account@example.com"

Type: integer Default: 1000

The priority of the rule. Lower values indicate higher priority.

Value must be greater or equal to 0 and lesser or equal to 65535


Examples:

1000
2000

Default: "DISABLED"

Defines how traffic that matches this rule should be logged.

Type: const

Exclude all metadata from the logs.

Specific value: "EXCLUDE_ALL_METADATA"
Type: const

Include all metadata in the logs.

Specific value: "INCLUDE_ALL_METADATA"
Type: const

Disable logging for this rule.

Specific value: "DISABLED"

Examples:

"EXCLUDE_ALL_METADATA"
"INCLUDE_ALL_METADATA"
"DISABLED"