1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. NetworkFirewallPolicy
Google Cloud v8.25.1 published on Wednesday, Apr 9, 2025 by Pulumi

gcp.compute.NetworkFirewallPolicy

Explore with Pulumi AI

The Compute NetworkFirewallPolicy resource

Example Usage

Network Firewall Policy Full

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const policy = new gcp.compute.NetworkFirewallPolicy("policy", {
    name: "tf-test-policy",
    description: "Terraform test",
});
Copy
import pulumi
import pulumi_gcp as gcp

policy = gcp.compute.NetworkFirewallPolicy("policy",
    name="tf-test-policy",
    description="Terraform test")
Copy
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/compute"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := compute.NewNetworkFirewallPolicy(ctx, "policy", &compute.NetworkFirewallPolicyArgs{
			Name:        pulumi.String("tf-test-policy"),
			Description: pulumi.String("Terraform test"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var policy = new Gcp.Compute.NetworkFirewallPolicy("policy", new()
    {
        Name = "tf-test-policy",
        Description = "Terraform test",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.NetworkFirewallPolicy;
import com.pulumi.gcp.compute.NetworkFirewallPolicyArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var policy = new NetworkFirewallPolicy("policy", NetworkFirewallPolicyArgs.builder()
            .name("tf-test-policy")
            .description("Terraform test")
            .build());

    }
}
Copy
resources:
  policy:
    type: gcp:compute:NetworkFirewallPolicy
    properties:
      name: tf-test-policy
      description: Terraform test
Copy

Create NetworkFirewallPolicy Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new NetworkFirewallPolicy(name: string, args?: NetworkFirewallPolicyArgs, opts?: CustomResourceOptions);
@overload
def NetworkFirewallPolicy(resource_name: str,
                          args: Optional[NetworkFirewallPolicyArgs] = None,
                          opts: Optional[ResourceOptions] = None)

@overload
def NetworkFirewallPolicy(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          description: Optional[str] = None,
                          name: Optional[str] = None,
                          project: Optional[str] = None)
func NewNetworkFirewallPolicy(ctx *Context, name string, args *NetworkFirewallPolicyArgs, opts ...ResourceOption) (*NetworkFirewallPolicy, error)
public NetworkFirewallPolicy(string name, NetworkFirewallPolicyArgs? args = null, CustomResourceOptions? opts = null)
public NetworkFirewallPolicy(String name, NetworkFirewallPolicyArgs args)
public NetworkFirewallPolicy(String name, NetworkFirewallPolicyArgs args, CustomResourceOptions options)
type: gcp:compute:NetworkFirewallPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args NetworkFirewallPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args NetworkFirewallPolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args NetworkFirewallPolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args NetworkFirewallPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. NetworkFirewallPolicyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var networkFirewallPolicyResource = new Gcp.Compute.NetworkFirewallPolicy("networkFirewallPolicyResource", new()
{
    Description = "string",
    Name = "string",
    Project = "string",
});
Copy
example, err := compute.NewNetworkFirewallPolicy(ctx, "networkFirewallPolicyResource", &compute.NetworkFirewallPolicyArgs{
	Description: pulumi.String("string"),
	Name:        pulumi.String("string"),
	Project:     pulumi.String("string"),
})
Copy
var networkFirewallPolicyResource = new NetworkFirewallPolicy("networkFirewallPolicyResource", NetworkFirewallPolicyArgs.builder()
    .description("string")
    .name("string")
    .project("string")
    .build());
Copy
network_firewall_policy_resource = gcp.compute.NetworkFirewallPolicy("networkFirewallPolicyResource",
    description="string",
    name="string",
    project="string")
Copy
const networkFirewallPolicyResource = new gcp.compute.NetworkFirewallPolicy("networkFirewallPolicyResource", {
    description: "string",
    name: "string",
    project: "string",
});
Copy
type: gcp:compute:NetworkFirewallPolicy
properties:
    description: string
    name: string
    project: string
Copy

NetworkFirewallPolicy Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The NetworkFirewallPolicy resource accepts the following input properties:

Description string
An optional description of this resource. Provide this property when you create the resource.
Name Changes to this property will trigger replacement. string
User-provided name of the Network firewall policy. The name should be unique in the project in which the firewall policy is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.


Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
Description string
An optional description of this resource. Provide this property when you create the resource.
Name Changes to this property will trigger replacement. string
User-provided name of the Network firewall policy. The name should be unique in the project in which the firewall policy is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.


Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
description String
An optional description of this resource. Provide this property when you create the resource.
name Changes to this property will trigger replacement. String
User-provided name of the Network firewall policy. The name should be unique in the project in which the firewall policy is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.


project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
description string
An optional description of this resource. Provide this property when you create the resource.
name Changes to this property will trigger replacement. string
User-provided name of the Network firewall policy. The name should be unique in the project in which the firewall policy is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.


project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
description str
An optional description of this resource. Provide this property when you create the resource.
name Changes to this property will trigger replacement. str
User-provided name of the Network firewall policy. The name should be unique in the project in which the firewall policy is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.


project Changes to this property will trigger replacement. str
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
description String
An optional description of this resource. Provide this property when you create the resource.
name Changes to this property will trigger replacement. String
User-provided name of the Network firewall policy. The name should be unique in the project in which the firewall policy is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.


project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Outputs

All input properties are implicitly available as output properties. Additionally, the NetworkFirewallPolicy resource produces the following output properties:

CreationTimestamp string
Creation timestamp in RFC3339 text format.
Fingerprint string
Fingerprint of the resource. This field is used internally during updates of this resource.
Id string
The provider-assigned unique ID for this managed resource.
NetworkFirewallPolicyId string
The unique identifier for the resource. This identifier is defined by the server.
RuleTupleCount int
Total count of all firewall policy rule tuples. A firewall policy can not exceed a set number of tuples.
SelfLink string
Server-defined URL for the resource.
SelfLinkWithId string
Server-defined URL for this resource with the resource id.
CreationTimestamp string
Creation timestamp in RFC3339 text format.
Fingerprint string
Fingerprint of the resource. This field is used internally during updates of this resource.
Id string
The provider-assigned unique ID for this managed resource.
NetworkFirewallPolicyId string
The unique identifier for the resource. This identifier is defined by the server.
RuleTupleCount int
Total count of all firewall policy rule tuples. A firewall policy can not exceed a set number of tuples.
SelfLink string
Server-defined URL for the resource.
SelfLinkWithId string
Server-defined URL for this resource with the resource id.
creationTimestamp String
Creation timestamp in RFC3339 text format.
fingerprint String
Fingerprint of the resource. This field is used internally during updates of this resource.
id String
The provider-assigned unique ID for this managed resource.
networkFirewallPolicyId String
The unique identifier for the resource. This identifier is defined by the server.
ruleTupleCount Integer
Total count of all firewall policy rule tuples. A firewall policy can not exceed a set number of tuples.
selfLink String
Server-defined URL for the resource.
selfLinkWithId String
Server-defined URL for this resource with the resource id.
creationTimestamp string
Creation timestamp in RFC3339 text format.
fingerprint string
Fingerprint of the resource. This field is used internally during updates of this resource.
id string
The provider-assigned unique ID for this managed resource.
networkFirewallPolicyId string
The unique identifier for the resource. This identifier is defined by the server.
ruleTupleCount number
Total count of all firewall policy rule tuples. A firewall policy can not exceed a set number of tuples.
selfLink string
Server-defined URL for the resource.
selfLinkWithId string
Server-defined URL for this resource with the resource id.
creation_timestamp str
Creation timestamp in RFC3339 text format.
fingerprint str
Fingerprint of the resource. This field is used internally during updates of this resource.
id str
The provider-assigned unique ID for this managed resource.
network_firewall_policy_id str
The unique identifier for the resource. This identifier is defined by the server.
rule_tuple_count int
Total count of all firewall policy rule tuples. A firewall policy can not exceed a set number of tuples.
self_link str
Server-defined URL for the resource.
self_link_with_id str
Server-defined URL for this resource with the resource id.
creationTimestamp String
Creation timestamp in RFC3339 text format.
fingerprint String
Fingerprint of the resource. This field is used internally during updates of this resource.
id String
The provider-assigned unique ID for this managed resource.
networkFirewallPolicyId String
The unique identifier for the resource. This identifier is defined by the server.
ruleTupleCount Number
Total count of all firewall policy rule tuples. A firewall policy can not exceed a set number of tuples.
selfLink String
Server-defined URL for the resource.
selfLinkWithId String
Server-defined URL for this resource with the resource id.

Look up Existing NetworkFirewallPolicy Resource

Get an existing NetworkFirewallPolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: NetworkFirewallPolicyState, opts?: CustomResourceOptions): NetworkFirewallPolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        creation_timestamp: Optional[str] = None,
        description: Optional[str] = None,
        fingerprint: Optional[str] = None,
        name: Optional[str] = None,
        network_firewall_policy_id: Optional[str] = None,
        project: Optional[str] = None,
        rule_tuple_count: Optional[int] = None,
        self_link: Optional[str] = None,
        self_link_with_id: Optional[str] = None) -> NetworkFirewallPolicy
func GetNetworkFirewallPolicy(ctx *Context, name string, id IDInput, state *NetworkFirewallPolicyState, opts ...ResourceOption) (*NetworkFirewallPolicy, error)
public static NetworkFirewallPolicy Get(string name, Input<string> id, NetworkFirewallPolicyState? state, CustomResourceOptions? opts = null)
public static NetworkFirewallPolicy get(String name, Output<String> id, NetworkFirewallPolicyState state, CustomResourceOptions options)
resources:  _:    type: gcp:compute:NetworkFirewallPolicy    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
CreationTimestamp string
Creation timestamp in RFC3339 text format.
Description string
An optional description of this resource. Provide this property when you create the resource.
Fingerprint string
Fingerprint of the resource. This field is used internally during updates of this resource.
Name Changes to this property will trigger replacement. string
User-provided name of the Network firewall policy. The name should be unique in the project in which the firewall policy is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.


NetworkFirewallPolicyId string
The unique identifier for the resource. This identifier is defined by the server.
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
RuleTupleCount int
Total count of all firewall policy rule tuples. A firewall policy can not exceed a set number of tuples.
SelfLink string
Server-defined URL for the resource.
SelfLinkWithId string
Server-defined URL for this resource with the resource id.
CreationTimestamp string
Creation timestamp in RFC3339 text format.
Description string
An optional description of this resource. Provide this property when you create the resource.
Fingerprint string
Fingerprint of the resource. This field is used internally during updates of this resource.
Name Changes to this property will trigger replacement. string
User-provided name of the Network firewall policy. The name should be unique in the project in which the firewall policy is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.


NetworkFirewallPolicyId string
The unique identifier for the resource. This identifier is defined by the server.
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
RuleTupleCount int
Total count of all firewall policy rule tuples. A firewall policy can not exceed a set number of tuples.
SelfLink string
Server-defined URL for the resource.
SelfLinkWithId string
Server-defined URL for this resource with the resource id.
creationTimestamp String
Creation timestamp in RFC3339 text format.
description String
An optional description of this resource. Provide this property when you create the resource.
fingerprint String
Fingerprint of the resource. This field is used internally during updates of this resource.
name Changes to this property will trigger replacement. String
User-provided name of the Network firewall policy. The name should be unique in the project in which the firewall policy is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.


networkFirewallPolicyId String
The unique identifier for the resource. This identifier is defined by the server.
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
ruleTupleCount Integer
Total count of all firewall policy rule tuples. A firewall policy can not exceed a set number of tuples.
selfLink String
Server-defined URL for the resource.
selfLinkWithId String
Server-defined URL for this resource with the resource id.
creationTimestamp string
Creation timestamp in RFC3339 text format.
description string
An optional description of this resource. Provide this property when you create the resource.
fingerprint string
Fingerprint of the resource. This field is used internally during updates of this resource.
name Changes to this property will trigger replacement. string
User-provided name of the Network firewall policy. The name should be unique in the project in which the firewall policy is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.


networkFirewallPolicyId string
The unique identifier for the resource. This identifier is defined by the server.
project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
ruleTupleCount number
Total count of all firewall policy rule tuples. A firewall policy can not exceed a set number of tuples.
selfLink string
Server-defined URL for the resource.
selfLinkWithId string
Server-defined URL for this resource with the resource id.
creation_timestamp str
Creation timestamp in RFC3339 text format.
description str
An optional description of this resource. Provide this property when you create the resource.
fingerprint str
Fingerprint of the resource. This field is used internally during updates of this resource.
name Changes to this property will trigger replacement. str
User-provided name of the Network firewall policy. The name should be unique in the project in which the firewall policy is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.


network_firewall_policy_id str
The unique identifier for the resource. This identifier is defined by the server.
project Changes to this property will trigger replacement. str
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
rule_tuple_count int
Total count of all firewall policy rule tuples. A firewall policy can not exceed a set number of tuples.
self_link str
Server-defined URL for the resource.
self_link_with_id str
Server-defined URL for this resource with the resource id.
creationTimestamp String
Creation timestamp in RFC3339 text format.
description String
An optional description of this resource. Provide this property when you create the resource.
fingerprint String
Fingerprint of the resource. This field is used internally during updates of this resource.
name Changes to this property will trigger replacement. String
User-provided name of the Network firewall policy. The name should be unique in the project in which the firewall policy is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.


networkFirewallPolicyId String
The unique identifier for the resource. This identifier is defined by the server.
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
ruleTupleCount Number
Total count of all firewall policy rule tuples. A firewall policy can not exceed a set number of tuples.
selfLink String
Server-defined URL for the resource.
selfLinkWithId String
Server-defined URL for this resource with the resource id.

Import

NetworkFirewallPolicy can be imported using any of these accepted formats:

  • projects/{{project}}/global/firewallPolicies/{{name}}

  • {{project}}/{{name}}

  • {{name}}

When using the pulumi import command, NetworkFirewallPolicy can be imported using one of the formats above. For example:

$ pulumi import gcp:compute/networkFirewallPolicy:NetworkFirewallPolicy default projects/{{project}}/global/firewallPolicies/{{name}}
Copy
$ pulumi import gcp:compute/networkFirewallPolicy:NetworkFirewallPolicy default {{project}}/{{name}}
Copy
$ pulumi import gcp:compute/networkFirewallPolicy:NetworkFirewallPolicy default {{name}}
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Google Cloud (GCP) Classic pulumi/pulumi-gcp
License
Apache-2.0
Notes
This Pulumi package is based on the google-beta Terraform Provider.