gcp.appengine.FirewallRule

Explore with Pulumi AI

A single firewall rule that is evaluated against incoming traffic and provides an action to take on matched requests.

To get more information about FirewallRule, see:

Example Usage

App Engine Firewall Rule Basic

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

return await Deployment.RunAsync(() => 
{
    var myProject = new Gcp.Organizations.Project("myProject", new()
    {
        ProjectId = "ae-project",
        OrgId = "123456789",
    });

    var app = new Gcp.AppEngine.Application("app", new()
    {
        Project = myProject.ProjectId,
        LocationId = "us-central",
    });

    var rule = new Gcp.AppEngine.FirewallRule("rule", new()
    {
        Project = app.Project,
        Priority = 1000,
        Action = "ALLOW",
        SourceRange = "*",
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		myProject, err := organizations.NewProject(ctx, "myProject", &organizations.ProjectArgs{
			ProjectId: pulumi.String("ae-project"),
			OrgId:     pulumi.String("123456789"),
		})
		if err != nil {
			return err
		}
		app, err := appengine.NewApplication(ctx, "app", &appengine.ApplicationArgs{
			Project:    myProject.ProjectId,
			LocationId: pulumi.String("us-central"),
		})
		if err != nil {
			return err
		}
		_, err = appengine.NewFirewallRule(ctx, "rule", &appengine.FirewallRuleArgs{
			Project:     app.Project,
			Priority:    pulumi.Int(1000),
			Action:      pulumi.String("ALLOW"),
			SourceRange: pulumi.String("*"),
		})
		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.organizations.Project;
import com.pulumi.gcp.organizations.ProjectArgs;
import com.pulumi.gcp.appengine.Application;
import com.pulumi.gcp.appengine.ApplicationArgs;
import com.pulumi.gcp.appengine.FirewallRule;
import com.pulumi.gcp.appengine.FirewallRuleArgs;
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 myProject = new Project("myProject", ProjectArgs.builder()        
            .projectId("ae-project")
            .orgId("123456789")
            .build());

        var app = new Application("app", ApplicationArgs.builder()        
            .project(myProject.projectId())
            .locationId("us-central")
            .build());

        var rule = new FirewallRule("rule", FirewallRuleArgs.builder()        
            .project(app.project())
            .priority(1000)
            .action("ALLOW")
            .sourceRange("*")
            .build());

    }
}
import pulumi
import pulumi_gcp as gcp

my_project = gcp.organizations.Project("myProject",
    project_id="ae-project",
    org_id="123456789")
app = gcp.appengine.Application("app",
    project=my_project.project_id,
    location_id="us-central")
rule = gcp.appengine.FirewallRule("rule",
    project=app.project,
    priority=1000,
    action="ALLOW",
    source_range="*")
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const myProject = new gcp.organizations.Project("myProject", {
    projectId: "ae-project",
    orgId: "123456789",
});
const app = new gcp.appengine.Application("app", {
    project: myProject.projectId,
    locationId: "us-central",
});
const rule = new gcp.appengine.FirewallRule("rule", {
    project: app.project,
    priority: 1000,
    action: "ALLOW",
    sourceRange: "*",
});
resources:
  myProject:
    type: gcp:organizations:Project
    properties:
      projectId: ae-project
      orgId: '123456789'
  app:
    type: gcp:appengine:Application
    properties:
      project: ${myProject.projectId}
      locationId: us-central
  rule:
    type: gcp:appengine:FirewallRule
    properties:
      project: ${app.project}
      priority: 1000
      action: ALLOW
      sourceRange: '*'

Create FirewallRule Resource

new FirewallRule(name: string, args: FirewallRuleArgs, opts?: CustomResourceOptions);
@overload
def FirewallRule(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 action: Optional[str] = None,
                 description: Optional[str] = None,
                 priority: Optional[int] = None,
                 project: Optional[str] = None,
                 source_range: Optional[str] = None)
@overload
def FirewallRule(resource_name: str,
                 args: FirewallRuleArgs,
                 opts: Optional[ResourceOptions] = None)
func NewFirewallRule(ctx *Context, name string, args FirewallRuleArgs, opts ...ResourceOption) (*FirewallRule, error)
public FirewallRule(string name, FirewallRuleArgs args, CustomResourceOptions? opts = null)
public FirewallRule(String name, FirewallRuleArgs args)
public FirewallRule(String name, FirewallRuleArgs args, CustomResourceOptions options)
type: gcp:appengine:FirewallRule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args FirewallRuleArgs
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 FirewallRuleArgs
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 FirewallRuleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args FirewallRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args FirewallRuleArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

Action string

The action to take if this rule matches. Possible values are: UNSPECIFIED_ACTION, ALLOW, DENY.


SourceRange string

IP address or range, defined using CIDR notation, of requests that this rule applies to.

Description string

An optional string description of this rule.

Priority int

A positive integer that defines the order of rule evaluation. Rules with the lowest priority are evaluated first. A default rule at priority Int32.MaxValue matches all IPv4 and IPv6 traffic when no previous rule matches. Only the action of this rule can be modified by the user.

Project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Action string

The action to take if this rule matches. Possible values are: UNSPECIFIED_ACTION, ALLOW, DENY.


SourceRange string

IP address or range, defined using CIDR notation, of requests that this rule applies to.

Description string

An optional string description of this rule.

Priority int

A positive integer that defines the order of rule evaluation. Rules with the lowest priority are evaluated first. A default rule at priority Int32.MaxValue matches all IPv4 and IPv6 traffic when no previous rule matches. Only the action of this rule can be modified by the user.

Project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

action String

The action to take if this rule matches. Possible values are: UNSPECIFIED_ACTION, ALLOW, DENY.


sourceRange String

IP address or range, defined using CIDR notation, of requests that this rule applies to.

description String

An optional string description of this rule.

priority Integer

A positive integer that defines the order of rule evaluation. Rules with the lowest priority are evaluated first. A default rule at priority Int32.MaxValue matches all IPv4 and IPv6 traffic when no previous rule matches. Only the action of this rule can be modified by the user.

project String

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

action string

The action to take if this rule matches. Possible values are: UNSPECIFIED_ACTION, ALLOW, DENY.


sourceRange string

IP address or range, defined using CIDR notation, of requests that this rule applies to.

description string

An optional string description of this rule.

priority number

A positive integer that defines the order of rule evaluation. Rules with the lowest priority are evaluated first. A default rule at priority Int32.MaxValue matches all IPv4 and IPv6 traffic when no previous rule matches. Only the action of this rule can be modified by the user.

project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

action str

The action to take if this rule matches. Possible values are: UNSPECIFIED_ACTION, ALLOW, DENY.


source_range str

IP address or range, defined using CIDR notation, of requests that this rule applies to.

description str

An optional string description of this rule.

priority int

A positive integer that defines the order of rule evaluation. Rules with the lowest priority are evaluated first. A default rule at priority Int32.MaxValue matches all IPv4 and IPv6 traffic when no previous rule matches. Only the action of this rule can be modified by the user.

project str

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

action String

The action to take if this rule matches. Possible values are: UNSPECIFIED_ACTION, ALLOW, DENY.


sourceRange String

IP address or range, defined using CIDR notation, of requests that this rule applies to.

description String

An optional string description of this rule.

priority Number

A positive integer that defines the order of rule evaluation. Rules with the lowest priority are evaluated first. A default rule at priority Int32.MaxValue matches all IPv4 and IPv6 traffic when no previous rule matches. Only the action of this rule can be modified by the user.

project String

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Outputs

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

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing FirewallRule Resource

Get an existing FirewallRule 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?: FirewallRuleState, opts?: CustomResourceOptions): FirewallRule
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        action: Optional[str] = None,
        description: Optional[str] = None,
        priority: Optional[int] = None,
        project: Optional[str] = None,
        source_range: Optional[str] = None) -> FirewallRule
func GetFirewallRule(ctx *Context, name string, id IDInput, state *FirewallRuleState, opts ...ResourceOption) (*FirewallRule, error)
public static FirewallRule Get(string name, Input<string> id, FirewallRuleState? state, CustomResourceOptions? opts = null)
public static FirewallRule get(String name, Output<String> id, FirewallRuleState 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:
Action string

The action to take if this rule matches. Possible values are: UNSPECIFIED_ACTION, ALLOW, DENY.


Description string

An optional string description of this rule.

Priority int

A positive integer that defines the order of rule evaluation. Rules with the lowest priority are evaluated first. A default rule at priority Int32.MaxValue matches all IPv4 and IPv6 traffic when no previous rule matches. Only the action of this rule can be modified by the user.

Project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

SourceRange string

IP address or range, defined using CIDR notation, of requests that this rule applies to.

Action string

The action to take if this rule matches. Possible values are: UNSPECIFIED_ACTION, ALLOW, DENY.


Description string

An optional string description of this rule.

Priority int

A positive integer that defines the order of rule evaluation. Rules with the lowest priority are evaluated first. A default rule at priority Int32.MaxValue matches all IPv4 and IPv6 traffic when no previous rule matches. Only the action of this rule can be modified by the user.

Project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

SourceRange string

IP address or range, defined using CIDR notation, of requests that this rule applies to.

action String

The action to take if this rule matches. Possible values are: UNSPECIFIED_ACTION, ALLOW, DENY.


description String

An optional string description of this rule.

priority Integer

A positive integer that defines the order of rule evaluation. Rules with the lowest priority are evaluated first. A default rule at priority Int32.MaxValue matches all IPv4 and IPv6 traffic when no previous rule matches. Only the action of this rule can be modified by the user.

project String

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

sourceRange String

IP address or range, defined using CIDR notation, of requests that this rule applies to.

action string

The action to take if this rule matches. Possible values are: UNSPECIFIED_ACTION, ALLOW, DENY.


description string

An optional string description of this rule.

priority number

A positive integer that defines the order of rule evaluation. Rules with the lowest priority are evaluated first. A default rule at priority Int32.MaxValue matches all IPv4 and IPv6 traffic when no previous rule matches. Only the action of this rule can be modified by the user.

project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

sourceRange string

IP address or range, defined using CIDR notation, of requests that this rule applies to.

action str

The action to take if this rule matches. Possible values are: UNSPECIFIED_ACTION, ALLOW, DENY.


description str

An optional string description of this rule.

priority int

A positive integer that defines the order of rule evaluation. Rules with the lowest priority are evaluated first. A default rule at priority Int32.MaxValue matches all IPv4 and IPv6 traffic when no previous rule matches. Only the action of this rule can be modified by the user.

project str

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

source_range str

IP address or range, defined using CIDR notation, of requests that this rule applies to.

action String

The action to take if this rule matches. Possible values are: UNSPECIFIED_ACTION, ALLOW, DENY.


description String

An optional string description of this rule.

priority Number

A positive integer that defines the order of rule evaluation. Rules with the lowest priority are evaluated first. A default rule at priority Int32.MaxValue matches all IPv4 and IPv6 traffic when no previous rule matches. Only the action of this rule can be modified by the user.

project String

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

sourceRange String

IP address or range, defined using CIDR notation, of requests that this rule applies to.

Import

FirewallRule can be imported using any of these accepted formats

 $ pulumi import gcp:appengine/firewallRule:FirewallRule default apps/{{project}}/firewall/ingressRules/{{priority}}
 $ pulumi import gcp:appengine/firewallRule:FirewallRule default {{project}}/{{priority}}
 $ pulumi import gcp:appengine/firewallRule:FirewallRule default {{priority}}

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.