FirewallPolicyAssociation

Allows associating hierarchical firewall policies with the target where they are applied. This allows creating policies and rules in a different location than they are applied.

For more information on applying hierarchical firewall policies see the official documentation

Example Usage

using System.Collections.Generic;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var defaultFirewallPolicy = new Gcp.Compute.FirewallPolicy("defaultFirewallPolicy", new()
    {
        Parent = "organizations/12345",
        ShortName = "my-policy",
        Description = "Example Resource",
    });

    var defaultFirewallPolicyAssociation = new Gcp.Compute.FirewallPolicyAssociation("defaultFirewallPolicyAssociation", new()
    {
        FirewallPolicy = defaultFirewallPolicy.Id,
        AttachmentTarget = google_folder.Folder.Name,
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		defaultFirewallPolicy, err := compute.NewFirewallPolicy(ctx, "defaultFirewallPolicy", &compute.FirewallPolicyArgs{
			Parent:      pulumi.String("organizations/12345"),
			ShortName:   pulumi.String("my-policy"),
			Description: pulumi.String("Example Resource"),
		})
		if err != nil {
			return err
		}
		_, err = compute.NewFirewallPolicyAssociation(ctx, "defaultFirewallPolicyAssociation", &compute.FirewallPolicyAssociationArgs{
			FirewallPolicy:   defaultFirewallPolicy.ID(),
			AttachmentTarget: pulumi.Any(google_folder.Folder.Name),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.FirewallPolicy;
import com.pulumi.gcp.compute.FirewallPolicyArgs;
import com.pulumi.gcp.compute.FirewallPolicyAssociation;
import com.pulumi.gcp.compute.FirewallPolicyAssociationArgs;
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 defaultFirewallPolicy = new FirewallPolicy("defaultFirewallPolicy", FirewallPolicyArgs.builder()        
            .parent("organizations/12345")
            .shortName("my-policy")
            .description("Example Resource")
            .build());

        var defaultFirewallPolicyAssociation = new FirewallPolicyAssociation("defaultFirewallPolicyAssociation", FirewallPolicyAssociationArgs.builder()        
            .firewallPolicy(defaultFirewallPolicy.id())
            .attachmentTarget(google_folder.folder().name())
            .build());

    }
}
import pulumi
import pulumi_gcp as gcp

default_firewall_policy = gcp.compute.FirewallPolicy("defaultFirewallPolicy",
    parent="organizations/12345",
    short_name="my-policy",
    description="Example Resource")
default_firewall_policy_association = gcp.compute.FirewallPolicyAssociation("defaultFirewallPolicyAssociation",
    firewall_policy=default_firewall_policy.id,
    attachment_target=google_folder["folder"]["name"])
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const defaultFirewallPolicy = new gcp.compute.FirewallPolicy("defaultFirewallPolicy", {
    parent: "organizations/12345",
    shortName: "my-policy",
    description: "Example Resource",
});
const defaultFirewallPolicyAssociation = new gcp.compute.FirewallPolicyAssociation("defaultFirewallPolicyAssociation", {
    firewallPolicy: defaultFirewallPolicy.id,
    attachmentTarget: google_folder.folder.name,
});
resources:
  defaultFirewallPolicy:
    type: gcp:compute:FirewallPolicy
    properties:
      parent: organizations/12345
      shortName: my-policy
      description: Example Resource
  defaultFirewallPolicyAssociation:
    type: gcp:compute:FirewallPolicyAssociation
    properties:
      firewallPolicy: ${defaultFirewallPolicy.id}
      attachmentTarget: ${google_folder.folder.name}

Create FirewallPolicyAssociation Resource

new FirewallPolicyAssociation(name: string, args: FirewallPolicyAssociationArgs, opts?: CustomResourceOptions);
@overload
def FirewallPolicyAssociation(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              attachment_target: Optional[str] = None,
                              firewall_policy: Optional[str] = None,
                              name: Optional[str] = None)
@overload
def FirewallPolicyAssociation(resource_name: str,
                              args: FirewallPolicyAssociationArgs,
                              opts: Optional[ResourceOptions] = None)
func NewFirewallPolicyAssociation(ctx *Context, name string, args FirewallPolicyAssociationArgs, opts ...ResourceOption) (*FirewallPolicyAssociation, error)
public FirewallPolicyAssociation(string name, FirewallPolicyAssociationArgs args, CustomResourceOptions? opts = null)
public FirewallPolicyAssociation(String name, FirewallPolicyAssociationArgs args)
public FirewallPolicyAssociation(String name, FirewallPolicyAssociationArgs args, CustomResourceOptions options)
type: gcp:compute:FirewallPolicyAssociation
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

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

FirewallPolicyAssociation Resource Properties

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

Inputs

The FirewallPolicyAssociation resource accepts the following input properties:

AttachmentTarget string

The target that the firewall policy is attached to.

FirewallPolicy string

The firewall policy ID of the association.

Name string

The name for an association.

AttachmentTarget string

The target that the firewall policy is attached to.

FirewallPolicy string

The firewall policy ID of the association.

Name string

The name for an association.

attachmentTarget String

The target that the firewall policy is attached to.

firewallPolicy String

The firewall policy ID of the association.

name String

The name for an association.

attachmentTarget string

The target that the firewall policy is attached to.

firewallPolicy string

The firewall policy ID of the association.

name string

The name for an association.

attachment_target str

The target that the firewall policy is attached to.

firewall_policy str

The firewall policy ID of the association.

name str

The name for an association.

attachmentTarget String

The target that the firewall policy is attached to.

firewallPolicy String

The firewall policy ID of the association.

name String

The name for an association.

Outputs

All input properties are implicitly available as output properties. Additionally, the FirewallPolicyAssociation 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 FirewallPolicyAssociation Resource

Get an existing FirewallPolicyAssociation 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?: FirewallPolicyAssociationState, opts?: CustomResourceOptions): FirewallPolicyAssociation
@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,
        short_name: Optional[str] = None) -> FirewallPolicyAssociation
func GetFirewallPolicyAssociation(ctx *Context, name string, id IDInput, state *FirewallPolicyAssociationState, opts ...ResourceOption) (*FirewallPolicyAssociation, error)
public static FirewallPolicyAssociation Get(string name, Input<string> id, FirewallPolicyAssociationState? state, CustomResourceOptions? opts = null)
public static FirewallPolicyAssociation get(String name, Output<String> id, FirewallPolicyAssociationState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
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 string

The target that the firewall policy is attached to.

FirewallPolicy string

The firewall policy ID of the association.

Name string

The name for an association.

ShortName string

The short name of the firewall policy of the association.

AttachmentTarget string

The target that the firewall policy is attached to.

FirewallPolicy string

The firewall policy ID of the association.

Name string

The name for an association.

ShortName string

The short name of the firewall policy of the association.

attachmentTarget String

The target that the firewall policy is attached to.

firewallPolicy String

The firewall policy ID of the association.

name String

The name for an association.

shortName String

The short name of the firewall policy of the association.

attachmentTarget string

The target that the firewall policy is attached to.

firewallPolicy string

The firewall policy ID of the association.

name string

The name for an association.

shortName string

The short name of the firewall policy of the association.

attachment_target str

The target that the firewall policy is attached to.

firewall_policy str

The firewall policy ID of the association.

name str

The name for an association.

short_name str

The short name of the firewall policy of the association.

attachmentTarget String

The target that the firewall policy is attached to.

firewallPolicy String

The firewall policy ID of the association.

name String

The name for an association.

shortName String

The short name of the firewall policy of the association.

Import

FirewallPolicyAssociation can be imported using any of these accepted formats

 $ pulumi import gcp:compute/firewallPolicyAssociation:FirewallPolicyAssociation default locations/global/firewallPolicies/{{firewall_policy}}/associations/{{name}}
 $ pulumi import gcp:compute/firewallPolicyAssociation:FirewallPolicyAssociation default {{firewall_policy}}/{{name}}

Package Details

Repository
https://github.com/pulumi/pulumi-gcp
License
Apache-2.0
Notes

This Pulumi package is based on the google-beta Terraform Provider.