1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. NetworkFirewallPolicyAssociation
Google Cloud Classic v7.16.0 published on Wednesday, Mar 27, 2024 by Pulumi

gcp.compute.NetworkFirewallPolicyAssociation

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.16.0 published on Wednesday, Mar 27, 2024 by Pulumi

    The Compute NetworkFirewallPolicyAssociation resource

    Example Usage

    Global

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const networkFirewallPolicy = new gcp.compute.NetworkFirewallPolicy("network_firewall_policy", {
        name: "policy",
        project: "my-project-name",
        description: "Sample global network firewall policy",
    });
    const network = new gcp.compute.Network("network", {name: "network"});
    const primary = new gcp.compute.NetworkFirewallPolicyAssociation("primary", {
        name: "association",
        attachmentTarget: network.id,
        firewallPolicy: networkFirewallPolicy.name,
        project: "my-project-name",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    network_firewall_policy = gcp.compute.NetworkFirewallPolicy("network_firewall_policy",
        name="policy",
        project="my-project-name",
        description="Sample global network firewall policy")
    network = gcp.compute.Network("network", name="network")
    primary = gcp.compute.NetworkFirewallPolicyAssociation("primary",
        name="association",
        attachment_target=network.id,
        firewall_policy=network_firewall_policy.name,
        project="my-project-name")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		networkFirewallPolicy, err := compute.NewNetworkFirewallPolicy(ctx, "network_firewall_policy", &compute.NetworkFirewallPolicyArgs{
    			Name:        pulumi.String("policy"),
    			Project:     pulumi.String("my-project-name"),
    			Description: pulumi.String("Sample global network firewall policy"),
    		})
    		if err != nil {
    			return err
    		}
    		network, err := compute.NewNetwork(ctx, "network", &compute.NetworkArgs{
    			Name: pulumi.String("network"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = compute.NewNetworkFirewallPolicyAssociation(ctx, "primary", &compute.NetworkFirewallPolicyAssociationArgs{
    			Name:             pulumi.String("association"),
    			AttachmentTarget: network.ID(),
    			FirewallPolicy:   networkFirewallPolicy.Name,
    			Project:          pulumi.String("my-project-name"),
    		})
    		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 networkFirewallPolicy = new Gcp.Compute.NetworkFirewallPolicy("network_firewall_policy", new()
        {
            Name = "policy",
            Project = "my-project-name",
            Description = "Sample global network firewall policy",
        });
    
        var network = new Gcp.Compute.Network("network", new()
        {
            Name = "network",
        });
    
        var primary = new Gcp.Compute.NetworkFirewallPolicyAssociation("primary", new()
        {
            Name = "association",
            AttachmentTarget = network.Id,
            FirewallPolicy = networkFirewallPolicy.Name,
            Project = "my-project-name",
        });
    
    });
    
    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 com.pulumi.gcp.compute.Network;
    import com.pulumi.gcp.compute.NetworkArgs;
    import com.pulumi.gcp.compute.NetworkFirewallPolicyAssociation;
    import com.pulumi.gcp.compute.NetworkFirewallPolicyAssociationArgs;
    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 networkFirewallPolicy = new NetworkFirewallPolicy("networkFirewallPolicy", NetworkFirewallPolicyArgs.builder()        
                .name("policy")
                .project("my-project-name")
                .description("Sample global network firewall policy")
                .build());
    
            var network = new Network("network", NetworkArgs.builder()        
                .name("network")
                .build());
    
            var primary = new NetworkFirewallPolicyAssociation("primary", NetworkFirewallPolicyAssociationArgs.builder()        
                .name("association")
                .attachmentTarget(network.id())
                .firewallPolicy(networkFirewallPolicy.name())
                .project("my-project-name")
                .build());
    
        }
    }
    
    resources:
      networkFirewallPolicy:
        type: gcp:compute:NetworkFirewallPolicy
        name: network_firewall_policy
        properties:
          name: policy
          project: my-project-name
          description: Sample global network firewall policy
      network:
        type: gcp:compute:Network
        properties:
          name: network
      primary:
        type: gcp:compute:NetworkFirewallPolicyAssociation
        properties:
          name: association
          attachmentTarget: ${network.id}
          firewallPolicy: ${networkFirewallPolicy.name}
          project: my-project-name
    

    Create NetworkFirewallPolicyAssociation Resource

    new NetworkFirewallPolicyAssociation(name: string, args: NetworkFirewallPolicyAssociationArgs, opts?: CustomResourceOptions);
    @overload
    def NetworkFirewallPolicyAssociation(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)
    @overload
    def NetworkFirewallPolicyAssociation(resource_name: str,
                                         args: NetworkFirewallPolicyAssociationArgs,
                                         opts: Optional[ResourceOptions] = None)
    func NewNetworkFirewallPolicyAssociation(ctx *Context, name string, args NetworkFirewallPolicyAssociationArgs, opts ...ResourceOption) (*NetworkFirewallPolicyAssociation, error)
    public NetworkFirewallPolicyAssociation(string name, NetworkFirewallPolicyAssociationArgs args, CustomResourceOptions? opts = null)
    public NetworkFirewallPolicyAssociation(String name, NetworkFirewallPolicyAssociationArgs args)
    public NetworkFirewallPolicyAssociation(String name, NetworkFirewallPolicyAssociationArgs args, CustomResourceOptions options)
    
    type: gcp:compute:NetworkFirewallPolicyAssociation
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args NetworkFirewallPolicyAssociationArgs
    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 NetworkFirewallPolicyAssociationArgs
    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 NetworkFirewallPolicyAssociationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args NetworkFirewallPolicyAssociationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args NetworkFirewallPolicyAssociationArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    NetworkFirewallPolicyAssociation 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 NetworkFirewallPolicyAssociation 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.


    Project string
    The project for the resource
    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.


    Project string
    The project for the resource
    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.


    project String
    The project for the resource
    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.


    project string
    The project for the resource
    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.


    project str
    The project for the resource
    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.


    project String
    The project for the resource

    Outputs

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

    Get an existing NetworkFirewallPolicyAssociation 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?: NetworkFirewallPolicyAssociationState, opts?: CustomResourceOptions): NetworkFirewallPolicyAssociation
    @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,
            short_name: Optional[str] = None) -> NetworkFirewallPolicyAssociation
    func GetNetworkFirewallPolicyAssociation(ctx *Context, name string, id IDInput, state *NetworkFirewallPolicyAssociationState, opts ...ResourceOption) (*NetworkFirewallPolicyAssociation, error)
    public static NetworkFirewallPolicyAssociation Get(string name, Input<string> id, NetworkFirewallPolicyAssociationState? state, CustomResourceOptions? opts = null)
    public static NetworkFirewallPolicyAssociation get(String name, Output<String> id, NetworkFirewallPolicyAssociationState 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.


    Project string
    The project for the resource
    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.


    Project string
    The project for the resource
    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.


    project String
    The project for the resource
    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.


    project string
    The project for the resource
    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.


    project str
    The project for the resource
    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.


    project String
    The project for the resource
    shortName String
    The short name of the firewall policy of the association.

    Import

    NetworkFirewallPolicyAssociation can be imported using any of these accepted formats:

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

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

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

    $ pulumi import gcp:compute/networkFirewallPolicyAssociation:NetworkFirewallPolicyAssociation default projects/{{project}}/global/firewallPolicies/{{firewall_policy}}/associations/{{name}}
    
    $ pulumi import gcp:compute/networkFirewallPolicyAssociation:NetworkFirewallPolicyAssociation default {{project}}/{{firewall_policy}}/{{name}}
    

    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 v7.16.0 published on Wednesday, Mar 27, 2024 by Pulumi