1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. FirewallPolicyAssociation
Google Cloud Classic v8.3.1 published on Wednesday, Sep 25, 2024 by Pulumi

gcp.compute.FirewallPolicyAssociation

Explore with Pulumi AI

gcp logo
Google Cloud Classic v8.3.1 published on Wednesday, Sep 25, 2024 by Pulumi

    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

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const _default = new gcp.compute.FirewallPolicy("default", {
        parent: "organizations/12345",
        shortName: "my-policy",
        description: "Example Resource",
    });
    const defaultFirewallPolicyAssociation = new gcp.compute.FirewallPolicyAssociation("default", {
        firewallPolicy: _default.id,
        attachmentTarget: folder.name,
        name: "my-association",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    default = gcp.compute.FirewallPolicy("default",
        parent="organizations/12345",
        short_name="my-policy",
        description="Example Resource")
    default_firewall_policy_association = gcp.compute.FirewallPolicyAssociation("default",
        firewall_policy=default.id,
        attachment_target=folder["name"],
        name="my-association")
    
    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.NewFirewallPolicy(ctx, "default", &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, "default", &compute.FirewallPolicyAssociationArgs{
    			FirewallPolicy:   _default.ID(),
    			AttachmentTarget: pulumi.Any(folder.Name),
    			Name:             pulumi.String("my-association"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = new Gcp.Compute.FirewallPolicy("default", new()
        {
            Parent = "organizations/12345",
            ShortName = "my-policy",
            Description = "Example Resource",
        });
    
        var defaultFirewallPolicyAssociation = new Gcp.Compute.FirewallPolicyAssociation("default", new()
        {
            FirewallPolicy = @default.Id,
            AttachmentTarget = folder.Name,
            Name = "my-association",
        });
    
    });
    
    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 default_ = new FirewallPolicy("default", FirewallPolicyArgs.builder()
                .parent("organizations/12345")
                .shortName("my-policy")
                .description("Example Resource")
                .build());
    
            var defaultFirewallPolicyAssociation = new FirewallPolicyAssociation("defaultFirewallPolicyAssociation", FirewallPolicyAssociationArgs.builder()
                .firewallPolicy(default_.id())
                .attachmentTarget(folder.name())
                .name("my-association")
                .build());
    
        }
    }
    
    resources:
      default:
        type: gcp:compute:FirewallPolicy
        properties:
          parent: organizations/12345
          shortName: my-policy
          description: Example Resource
      defaultFirewallPolicyAssociation:
        type: gcp:compute:FirewallPolicyAssociation
        name: default
        properties:
          firewallPolicy: ${default.id}
          attachmentTarget: ${folder.name}
          name: my-association
    

    Create FirewallPolicyAssociation Resource

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

    Constructor syntax

    new FirewallPolicyAssociation(name: string, args: FirewallPolicyAssociationArgs, opts?: CustomResourceOptions);
    @overload
    def FirewallPolicyAssociation(resource_name: str,
                                  args: FirewallPolicyAssociationArgs,
                                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def FirewallPolicyAssociation(resource_name: str,
                                  opts: Optional[ResourceOptions] = None,
                                  attachment_target: Optional[str] = None,
                                  firewall_policy: Optional[str] = None,
                                  name: Optional[str] = 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.
    
    

    Parameters

    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.

    Constructor example

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

    var firewallPolicyAssociationResource = new Gcp.Compute.FirewallPolicyAssociation("firewallPolicyAssociationResource", new()
    {
        AttachmentTarget = "string",
        FirewallPolicy = "string",
        Name = "string",
    });
    
    example, err := compute.NewFirewallPolicyAssociation(ctx, "firewallPolicyAssociationResource", &compute.FirewallPolicyAssociationArgs{
    	AttachmentTarget: pulumi.String("string"),
    	FirewallPolicy:   pulumi.String("string"),
    	Name:             pulumi.String("string"),
    })
    
    var firewallPolicyAssociationResource = new FirewallPolicyAssociation("firewallPolicyAssociationResource", FirewallPolicyAssociationArgs.builder()
        .attachmentTarget("string")
        .firewallPolicy("string")
        .name("string")
        .build());
    
    firewall_policy_association_resource = gcp.compute.FirewallPolicyAssociation("firewallPolicyAssociationResource",
        attachment_target="string",
        firewall_policy="string",
        name="string")
    
    const firewallPolicyAssociationResource = new gcp.compute.FirewallPolicyAssociation("firewallPolicyAssociationResource", {
        attachmentTarget: "string",
        firewallPolicy: "string",
        name: "string",
    });
    
    type: gcp:compute:FirewallPolicyAssociation
    properties:
        attachmentTarget: string
        firewallPolicy: string
        name: string
    

    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:

    • locations/global/firewallPolicies/{{firewall_policy}}/associations/{{name}}

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

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

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

    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.
    gcp logo
    Google Cloud Classic v8.3.1 published on Wednesday, Sep 25, 2024 by Pulumi