1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. FirewallPolicy
Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi

gcp.compute.FirewallPolicy

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi

    Hierarchical firewall policy rules let you create and enforce a consistent firewall policy across your organization. Rules can explicitly allow or deny connections or delegate evaluation to lower level policies. Policies can be created within organizations or folders.

    This resource should be generally be used with gcp.compute.FirewallPolicyAssociation and gcp.compute.FirewallPolicyRule

    For more information 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",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    default = gcp.compute.FirewallPolicy("default",
        parent="organizations/12345",
        short_name="my-policy",
        description="Example Resource")
    
    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 {
    		_, 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
    		}
    		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",
        });
    
    });
    
    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 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());
    
        }
    }
    
    resources:
      default:
        type: gcp:compute:FirewallPolicy
        properties:
          parent: organizations/12345
          shortName: my-policy
          description: Example Resource
    

    Create FirewallPolicy Resource

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

    Constructor syntax

    new FirewallPolicy(name: string, args: FirewallPolicyArgs, opts?: CustomResourceOptions);
    @overload
    def FirewallPolicy(resource_name: str,
                       args: FirewallPolicyArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def FirewallPolicy(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       parent: Optional[str] = None,
                       short_name: Optional[str] = None,
                       description: Optional[str] = None)
    func NewFirewallPolicy(ctx *Context, name string, args FirewallPolicyArgs, opts ...ResourceOption) (*FirewallPolicy, error)
    public FirewallPolicy(string name, FirewallPolicyArgs args, CustomResourceOptions? opts = null)
    public FirewallPolicy(String name, FirewallPolicyArgs args)
    public FirewallPolicy(String name, FirewallPolicyArgs args, CustomResourceOptions options)
    
    type: gcp:compute:FirewallPolicy
    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 FirewallPolicyArgs
    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 FirewallPolicyArgs
    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 FirewallPolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args FirewallPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args FirewallPolicyArgs
    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 firewallPolicyResource = new Gcp.Compute.FirewallPolicy("firewallPolicyResource", new()
    {
        Parent = "string",
        ShortName = "string",
        Description = "string",
    });
    
    example, err := compute.NewFirewallPolicy(ctx, "firewallPolicyResource", &compute.FirewallPolicyArgs{
    	Parent:      pulumi.String("string"),
    	ShortName:   pulumi.String("string"),
    	Description: pulumi.String("string"),
    })
    
    var firewallPolicyResource = new FirewallPolicy("firewallPolicyResource", FirewallPolicyArgs.builder()
        .parent("string")
        .shortName("string")
        .description("string")
        .build());
    
    firewall_policy_resource = gcp.compute.FirewallPolicy("firewallPolicyResource",
        parent="string",
        short_name="string",
        description="string")
    
    const firewallPolicyResource = new gcp.compute.FirewallPolicy("firewallPolicyResource", {
        parent: "string",
        shortName: "string",
        description: "string",
    });
    
    type: gcp:compute:FirewallPolicy
    properties:
        description: string
        parent: string
        shortName: string
    

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

    Parent string
    The parent of the firewall policy.
    ShortName string
    User-provided name of the Organization firewall policy. The name should be unique in the organization 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.


    Description string
    An optional description of this resource. Provide this property when you create the resource.
    Parent string
    The parent of the firewall policy.
    ShortName string
    User-provided name of the Organization firewall policy. The name should be unique in the organization 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.


    Description string
    An optional description of this resource. Provide this property when you create the resource.
    parent String
    The parent of the firewall policy.
    shortName String
    User-provided name of the Organization firewall policy. The name should be unique in the organization 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.


    description String
    An optional description of this resource. Provide this property when you create the resource.
    parent string
    The parent of the firewall policy.
    shortName string
    User-provided name of the Organization firewall policy. The name should be unique in the organization 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.


    description string
    An optional description of this resource. Provide this property when you create the resource.
    parent str
    The parent of the firewall policy.
    short_name str
    User-provided name of the Organization firewall policy. The name should be unique in the organization 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.


    description str
    An optional description of this resource. Provide this property when you create the resource.
    parent String
    The parent of the firewall policy.
    shortName String
    User-provided name of the Organization firewall policy. The name should be unique in the organization 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.


    description String
    An optional description of this resource. Provide this property when you create the resource.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the FirewallPolicy 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.
    FirewallPolicyId string
    The unique identifier for the resource. This identifier is defined by the server.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    Name of the resource. It is a numeric ID allocated by GCP which uniquely identifies the Firewall Policy.
    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.
    FirewallPolicyId string
    The unique identifier for the resource. This identifier is defined by the server.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    Name of the resource. It is a numeric ID allocated by GCP which uniquely identifies the Firewall Policy.
    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.
    firewallPolicyId String
    The unique identifier for the resource. This identifier is defined by the server.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    Name of the resource. It is a numeric ID allocated by GCP which uniquely identifies the Firewall Policy.
    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.
    firewallPolicyId string
    The unique identifier for the resource. This identifier is defined by the server.
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    Name of the resource. It is a numeric ID allocated by GCP which uniquely identifies the Firewall Policy.
    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.
    firewall_policy_id str
    The unique identifier for the resource. This identifier is defined by the server.
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    Name of the resource. It is a numeric ID allocated by GCP which uniquely identifies the Firewall Policy.
    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.
    firewallPolicyId String
    The unique identifier for the resource. This identifier is defined by the server.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    Name of the resource. It is a numeric ID allocated by GCP which uniquely identifies the Firewall Policy.
    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 FirewallPolicy Resource

    Get an existing FirewallPolicy 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?: FirewallPolicyState, opts?: CustomResourceOptions): FirewallPolicy
    @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,
            firewall_policy_id: Optional[str] = None,
            name: Optional[str] = None,
            parent: Optional[str] = None,
            rule_tuple_count: Optional[int] = None,
            self_link: Optional[str] = None,
            self_link_with_id: Optional[str] = None,
            short_name: Optional[str] = None) -> FirewallPolicy
    func GetFirewallPolicy(ctx *Context, name string, id IDInput, state *FirewallPolicyState, opts ...ResourceOption) (*FirewallPolicy, error)
    public static FirewallPolicy Get(string name, Input<string> id, FirewallPolicyState? state, CustomResourceOptions? opts = null)
    public static FirewallPolicy get(String name, Output<String> id, FirewallPolicyState 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:
    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.
    FirewallPolicyId string
    The unique identifier for the resource. This identifier is defined by the server.
    Name string
    Name of the resource. It is a numeric ID allocated by GCP which uniquely identifies the Firewall Policy.
    Parent string
    The parent of the firewall policy.
    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.
    ShortName string
    User-provided name of the Organization firewall policy. The name should be unique in the organization 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.


    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.
    FirewallPolicyId string
    The unique identifier for the resource. This identifier is defined by the server.
    Name string
    Name of the resource. It is a numeric ID allocated by GCP which uniquely identifies the Firewall Policy.
    Parent string
    The parent of the firewall policy.
    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.
    ShortName string
    User-provided name of the Organization firewall policy. The name should be unique in the organization 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.


    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.
    firewallPolicyId String
    The unique identifier for the resource. This identifier is defined by the server.
    name String
    Name of the resource. It is a numeric ID allocated by GCP which uniquely identifies the Firewall Policy.
    parent String
    The parent of the firewall policy.
    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.
    shortName String
    User-provided name of the Organization firewall policy. The name should be unique in the organization 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.


    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.
    firewallPolicyId string
    The unique identifier for the resource. This identifier is defined by the server.
    name string
    Name of the resource. It is a numeric ID allocated by GCP which uniquely identifies the Firewall Policy.
    parent string
    The parent of the firewall policy.
    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.
    shortName string
    User-provided name of the Organization firewall policy. The name should be unique in the organization 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.


    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.
    firewall_policy_id str
    The unique identifier for the resource. This identifier is defined by the server.
    name str
    Name of the resource. It is a numeric ID allocated by GCP which uniquely identifies the Firewall Policy.
    parent str
    The parent of the firewall policy.
    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.
    short_name str
    User-provided name of the Organization firewall policy. The name should be unique in the organization 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.


    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.
    firewallPolicyId String
    The unique identifier for the resource. This identifier is defined by the server.
    name String
    Name of the resource. It is a numeric ID allocated by GCP which uniquely identifies the Firewall Policy.
    parent String
    The parent of the firewall policy.
    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.
    shortName String
    User-provided name of the Organization firewall policy. The name should be unique in the organization 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.


    Import

    FirewallPolicy can be imported using any of these accepted formats:

    $ pulumi import gcp:compute/firewallPolicy:FirewallPolicy default locations/global/firewallPolicies/{{name}}
    
    $ pulumi import gcp:compute/firewallPolicy:FirewallPolicy default {{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 v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi