1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. RegionNetworkFirewallPolicyAssociation
Google Cloud v8.27.1 published on Friday, Apr 25, 2025 by Pulumi

gcp.compute.RegionNetworkFirewallPolicyAssociation

Explore with Pulumi AI

The Compute NetworkFirewallPolicyAssociation resource

To get more information about RegionNetworkFirewallPolicyAssociation, see:

Example Usage

Region Network Firewall Policy Association

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

const policy = new gcp.compute.RegionNetworkFirewallPolicy("policy", {
    name: "my-policy",
    project: "my-project-name",
    description: "Sample global network firewall policy",
    region: "us-west1",
});
const network = new gcp.compute.Network("network", {
    name: "my-network",
    autoCreateSubnetworks: false,
});
const _default = new gcp.compute.RegionNetworkFirewallPolicyAssociation("default", {
    name: "my-association",
    project: "my-project-name",
    attachmentTarget: network.id,
    firewallPolicy: policy.id,
    region: "us-west1",
});
Copy
import pulumi
import pulumi_gcp as gcp

policy = gcp.compute.RegionNetworkFirewallPolicy("policy",
    name="my-policy",
    project="my-project-name",
    description="Sample global network firewall policy",
    region="us-west1")
network = gcp.compute.Network("network",
    name="my-network",
    auto_create_subnetworks=False)
default = gcp.compute.RegionNetworkFirewallPolicyAssociation("default",
    name="my-association",
    project="my-project-name",
    attachment_target=network.id,
    firewall_policy=policy.id,
    region="us-west1")
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 {
		policy, err := compute.NewRegionNetworkFirewallPolicy(ctx, "policy", &compute.RegionNetworkFirewallPolicyArgs{
			Name:        pulumi.String("my-policy"),
			Project:     pulumi.String("my-project-name"),
			Description: pulumi.String("Sample global network firewall policy"),
			Region:      pulumi.String("us-west1"),
		})
		if err != nil {
			return err
		}
		network, err := compute.NewNetwork(ctx, "network", &compute.NetworkArgs{
			Name:                  pulumi.String("my-network"),
			AutoCreateSubnetworks: pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		_, err = compute.NewRegionNetworkFirewallPolicyAssociation(ctx, "default", &compute.RegionNetworkFirewallPolicyAssociationArgs{
			Name:             pulumi.String("my-association"),
			Project:          pulumi.String("my-project-name"),
			AttachmentTarget: network.ID(),
			FirewallPolicy:   policy.ID(),
			Region:           pulumi.String("us-west1"),
		})
		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.RegionNetworkFirewallPolicy("policy", new()
    {
        Name = "my-policy",
        Project = "my-project-name",
        Description = "Sample global network firewall policy",
        Region = "us-west1",
    });

    var network = new Gcp.Compute.Network("network", new()
    {
        Name = "my-network",
        AutoCreateSubnetworks = false,
    });

    var @default = new Gcp.Compute.RegionNetworkFirewallPolicyAssociation("default", new()
    {
        Name = "my-association",
        Project = "my-project-name",
        AttachmentTarget = network.Id,
        FirewallPolicy = policy.Id,
        Region = "us-west1",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.RegionNetworkFirewallPolicy;
import com.pulumi.gcp.compute.RegionNetworkFirewallPolicyArgs;
import com.pulumi.gcp.compute.Network;
import com.pulumi.gcp.compute.NetworkArgs;
import com.pulumi.gcp.compute.RegionNetworkFirewallPolicyAssociation;
import com.pulumi.gcp.compute.RegionNetworkFirewallPolicyAssociationArgs;
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 RegionNetworkFirewallPolicy("policy", RegionNetworkFirewallPolicyArgs.builder()
            .name("my-policy")
            .project("my-project-name")
            .description("Sample global network firewall policy")
            .region("us-west1")
            .build());

        var network = new Network("network", NetworkArgs.builder()
            .name("my-network")
            .autoCreateSubnetworks(false)
            .build());

        var default_ = new RegionNetworkFirewallPolicyAssociation("default", RegionNetworkFirewallPolicyAssociationArgs.builder()
            .name("my-association")
            .project("my-project-name")
            .attachmentTarget(network.id())
            .firewallPolicy(policy.id())
            .region("us-west1")
            .build());

    }
}
Copy
resources:
  policy:
    type: gcp:compute:RegionNetworkFirewallPolicy
    properties:
      name: my-policy
      project: my-project-name
      description: Sample global network firewall policy
      region: us-west1
  network:
    type: gcp:compute:Network
    properties:
      name: my-network
      autoCreateSubnetworks: false
  default:
    type: gcp:compute:RegionNetworkFirewallPolicyAssociation
    properties:
      name: my-association
      project: my-project-name
      attachmentTarget: ${network.id}
      firewallPolicy: ${policy.id}
      region: us-west1
Copy

Create RegionNetworkFirewallPolicyAssociation Resource

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

Constructor syntax

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

@overload
def RegionNetworkFirewallPolicyAssociation(resource_name: str,
                                           opts: Optional[ResourceOptions] = None,
                                           attachment_target: Optional[str] = None,
                                           firewall_policy: Optional[str] = None,
                                           name: Optional[str] = None,
                                           project: Optional[str] = None,
                                           region: Optional[str] = None)
func NewRegionNetworkFirewallPolicyAssociation(ctx *Context, name string, args RegionNetworkFirewallPolicyAssociationArgs, opts ...ResourceOption) (*RegionNetworkFirewallPolicyAssociation, error)
public RegionNetworkFirewallPolicyAssociation(string name, RegionNetworkFirewallPolicyAssociationArgs args, CustomResourceOptions? opts = null)
public RegionNetworkFirewallPolicyAssociation(String name, RegionNetworkFirewallPolicyAssociationArgs args)
public RegionNetworkFirewallPolicyAssociation(String name, RegionNetworkFirewallPolicyAssociationArgs args, CustomResourceOptions options)
type: gcp:compute:RegionNetworkFirewallPolicyAssociation
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 This property is required. RegionNetworkFirewallPolicyAssociationArgs
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 This property is required. RegionNetworkFirewallPolicyAssociationArgs
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 This property is required. RegionNetworkFirewallPolicyAssociationArgs
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 This property is required. RegionNetworkFirewallPolicyAssociationArgs
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. RegionNetworkFirewallPolicyAssociationArgs
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 regionNetworkFirewallPolicyAssociationResource = new Gcp.Compute.RegionNetworkFirewallPolicyAssociation("regionNetworkFirewallPolicyAssociationResource", new()
{
    AttachmentTarget = "string",
    FirewallPolicy = "string",
    Name = "string",
    Project = "string",
    Region = "string",
});
Copy
example, err := compute.NewRegionNetworkFirewallPolicyAssociation(ctx, "regionNetworkFirewallPolicyAssociationResource", &compute.RegionNetworkFirewallPolicyAssociationArgs{
	AttachmentTarget: pulumi.String("string"),
	FirewallPolicy:   pulumi.String("string"),
	Name:             pulumi.String("string"),
	Project:          pulumi.String("string"),
	Region:           pulumi.String("string"),
})
Copy
var regionNetworkFirewallPolicyAssociationResource = new RegionNetworkFirewallPolicyAssociation("regionNetworkFirewallPolicyAssociationResource", RegionNetworkFirewallPolicyAssociationArgs.builder()
    .attachmentTarget("string")
    .firewallPolicy("string")
    .name("string")
    .project("string")
    .region("string")
    .build());
Copy
region_network_firewall_policy_association_resource = gcp.compute.RegionNetworkFirewallPolicyAssociation("regionNetworkFirewallPolicyAssociationResource",
    attachment_target="string",
    firewall_policy="string",
    name="string",
    project="string",
    region="string")
Copy
const regionNetworkFirewallPolicyAssociationResource = new gcp.compute.RegionNetworkFirewallPolicyAssociation("regionNetworkFirewallPolicyAssociationResource", {
    attachmentTarget: "string",
    firewallPolicy: "string",
    name: "string",
    project: "string",
    region: "string",
});
Copy
type: gcp:compute:RegionNetworkFirewallPolicyAssociation
properties:
    attachmentTarget: string
    firewallPolicy: string
    name: string
    project: string
    region: string
Copy

RegionNetworkFirewallPolicyAssociation 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 RegionNetworkFirewallPolicyAssociation resource accepts the following input properties:

AttachmentTarget
This property is required.
Changes to this property will trigger replacement.
string
The target that the firewall policy is attached to.
FirewallPolicy
This property is required.
Changes to this property will trigger replacement.
string
The firewall policy of the resource.


Name Changes to this property will trigger replacement. string
The name for an association.
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.
Region Changes to this property will trigger replacement. string
The location of this resource.
AttachmentTarget
This property is required.
Changes to this property will trigger replacement.
string
The target that the firewall policy is attached to.
FirewallPolicy
This property is required.
Changes to this property will trigger replacement.
string
The firewall policy of the resource.


Name Changes to this property will trigger replacement. string
The name for an association.
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.
Region Changes to this property will trigger replacement. string
The location of this resource.
attachmentTarget
This property is required.
Changes to this property will trigger replacement.
String
The target that the firewall policy is attached to.
firewallPolicy
This property is required.
Changes to this property will trigger replacement.
String
The firewall policy of the resource.


name Changes to this property will trigger replacement. String
The name for an association.
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.
region Changes to this property will trigger replacement. String
The location of this resource.
attachmentTarget
This property is required.
Changes to this property will trigger replacement.
string
The target that the firewall policy is attached to.
firewallPolicy
This property is required.
Changes to this property will trigger replacement.
string
The firewall policy of the resource.


name Changes to this property will trigger replacement. string
The name for an association.
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.
region Changes to this property will trigger replacement. string
The location of this resource.
attachment_target
This property is required.
Changes to this property will trigger replacement.
str
The target that the firewall policy is attached to.
firewall_policy
This property is required.
Changes to this property will trigger replacement.
str
The firewall policy of the resource.


name Changes to this property will trigger replacement. str
The name for an association.
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.
region Changes to this property will trigger replacement. str
The location of this resource.
attachmentTarget
This property is required.
Changes to this property will trigger replacement.
String
The target that the firewall policy is attached to.
firewallPolicy
This property is required.
Changes to this property will trigger replacement.
String
The firewall policy of the resource.


name Changes to this property will trigger replacement. String
The name for an association.
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.
region Changes to this property will trigger replacement. String
The location of this resource.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
ShortName string
The short name of the firewall policy of the association.
Id string
The provider-assigned unique ID for this managed resource.
ShortName string
The short name of the firewall policy of the association.
id String
The provider-assigned unique ID for this managed resource.
shortName String
The short name of the firewall policy of the association.
id string
The provider-assigned unique ID for this managed resource.
shortName string
The short name of the firewall policy of the association.
id str
The provider-assigned unique ID for this managed resource.
short_name str
The short name of the firewall policy of the association.
id String
The provider-assigned unique ID for this managed resource.
shortName String
The short name of the firewall policy of the association.

Look up Existing RegionNetworkFirewallPolicyAssociation Resource

Get an existing RegionNetworkFirewallPolicyAssociation 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?: RegionNetworkFirewallPolicyAssociationState, opts?: CustomResourceOptions): RegionNetworkFirewallPolicyAssociation
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        attachment_target: Optional[str] = None,
        firewall_policy: Optional[str] = None,
        name: Optional[str] = None,
        project: Optional[str] = None,
        region: Optional[str] = None,
        short_name: Optional[str] = None) -> RegionNetworkFirewallPolicyAssociation
func GetRegionNetworkFirewallPolicyAssociation(ctx *Context, name string, id IDInput, state *RegionNetworkFirewallPolicyAssociationState, opts ...ResourceOption) (*RegionNetworkFirewallPolicyAssociation, error)
public static RegionNetworkFirewallPolicyAssociation Get(string name, Input<string> id, RegionNetworkFirewallPolicyAssociationState? state, CustomResourceOptions? opts = null)
public static RegionNetworkFirewallPolicyAssociation get(String name, Output<String> id, RegionNetworkFirewallPolicyAssociationState state, CustomResourceOptions options)
resources:  _:    type: gcp:compute:RegionNetworkFirewallPolicyAssociation    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:
AttachmentTarget Changes to this property will trigger replacement. string
The target that the firewall policy is attached to.
FirewallPolicy Changes to this property will trigger replacement. string
The firewall policy of the resource.


Name Changes to this property will trigger replacement. string
The name for an association.
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.
Region Changes to this property will trigger replacement. string
The location of this resource.
ShortName string
The short name of the firewall policy of the association.
AttachmentTarget Changes to this property will trigger replacement. string
The target that the firewall policy is attached to.
FirewallPolicy Changes to this property will trigger replacement. string
The firewall policy of the resource.


Name Changes to this property will trigger replacement. string
The name for an association.
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.
Region Changes to this property will trigger replacement. string
The location of this resource.
ShortName string
The short name of the firewall policy of the association.
attachmentTarget Changes to this property will trigger replacement. String
The target that the firewall policy is attached to.
firewallPolicy Changes to this property will trigger replacement. String
The firewall policy of the resource.


name Changes to this property will trigger replacement. String
The name for an association.
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.
region Changes to this property will trigger replacement. String
The location of this resource.
shortName String
The short name of the firewall policy of the association.
attachmentTarget Changes to this property will trigger replacement. string
The target that the firewall policy is attached to.
firewallPolicy Changes to this property will trigger replacement. string
The firewall policy of the resource.


name Changes to this property will trigger replacement. string
The name for an association.
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.
region Changes to this property will trigger replacement. string
The location of this resource.
shortName string
The short name of the firewall policy of the association.
attachment_target Changes to this property will trigger replacement. str
The target that the firewall policy is attached to.
firewall_policy Changes to this property will trigger replacement. str
The firewall policy of the resource.


name Changes to this property will trigger replacement. str
The name for an association.
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.
region Changes to this property will trigger replacement. str
The location of this resource.
short_name str
The short name of the firewall policy of the association.
attachmentTarget Changes to this property will trigger replacement. String
The target that the firewall policy is attached to.
firewallPolicy Changes to this property will trigger replacement. String
The firewall policy of the resource.


name Changes to this property will trigger replacement. String
The name for an association.
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.
region Changes to this property will trigger replacement. String
The location of this resource.
shortName String
The short name of the firewall policy of the association.

Import

RegionNetworkFirewallPolicyAssociation can be imported using any of these accepted formats:

  • projects/{{project}}/regions/{{region}}/firewallPolicies/{{firewall_policy}}/associations/{{name}}

  • {{project}}/{{region}}/{{firewall_policy}}/{{name}}

  • {{region}}/{{firewall_policy}}/{{name}}

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

  • {{firewall_policy}}/{{name}}

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

$ pulumi import gcp:compute/regionNetworkFirewallPolicyAssociation:RegionNetworkFirewallPolicyAssociation default projects/{{project}}/regions/{{region}}/firewallPolicies/{{firewall_policy}}/associations/{{name}}
Copy
$ pulumi import gcp:compute/regionNetworkFirewallPolicyAssociation:RegionNetworkFirewallPolicyAssociation default {{project}}/{{region}}/{{firewall_policy}}/{{name}}
Copy
$ pulumi import gcp:compute/regionNetworkFirewallPolicyAssociation:RegionNetworkFirewallPolicyAssociation default {{region}}/{{firewall_policy}}/{{name}}
Copy
$ pulumi import gcp:compute/regionNetworkFirewallPolicyAssociation:RegionNetworkFirewallPolicyAssociation default {{project}}/{{firewall_policy}}/{{name}}
Copy
$ pulumi import gcp:compute/regionNetworkFirewallPolicyAssociation:RegionNetworkFirewallPolicyAssociation default {{firewall_policy}}/{{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.