GatewaySecurityPolicyRule class

The GatewaySecurityPolicyRule resource is in a nested collection within a GatewaySecurityPolicy and represents a traffic matching condition and associated action to perform.

To get more information about GatewaySecurityPolicyRule, see:

Example Usage

Network Security Gateway Security Policy Rules Basic

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const _default = new gcp.networksecurity.GatewaySecurityPolicy("default", {
    name: "my-gateway-security-policy",
    location: "us-central1",
    description: "gateway security policy created to be used as reference by the rule.",
});
const defaultGatewaySecurityPolicyRule = new gcp.networksecurity.GatewaySecurityPolicyRule("default", {
    name: "my-gateway-security-policy-rule",
    location: "us-central1",
    gatewaySecurityPolicy: _default.name,
    enabled: true,
    description: "my description",
    priority: 0,
    sessionMatcher: "host() == 'example.com'",
    basicProfile: "ALLOW",
});
import pulumi
import pulumi_gcp as gcp

default = gcp.networksecurity.GatewaySecurityPolicy("default",
    name="my-gateway-security-policy",
    location="us-central1",
    description="gateway security policy created to be used as reference by the rule.")
default_gateway_security_policy_rule = gcp.networksecurity.GatewaySecurityPolicyRule("default",
    name="my-gateway-security-policy-rule",
    location="us-central1",
    gateway_security_policy=default.name,
    enabled=True,
    description="my description",
    priority=0,
    session_matcher="host() == 'example.com'",
    basic_profile="ALLOW")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var @default = new Gcp.NetworkSecurity.GatewaySecurityPolicy("default", new()
    {
        Name = "my-gateway-security-policy",
        Location = "us-central1",
        Description = "gateway security policy created to be used as reference by the rule.",
    });

    var defaultGatewaySecurityPolicyRule = new Gcp.NetworkSecurity.GatewaySecurityPolicyRule("default", new()
    {
        Name = "my-gateway-security-policy-rule",
        Location = "us-central1",
        GatewaySecurityPolicy = @default.Name,
        Enabled = true,
        Description = "my description",
        Priority = 0,
        SessionMatcher = "host() == 'example.com'",
        BasicProfile = "ALLOW",
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/networksecurity"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_default, err := networksecurity.NewGatewaySecurityPolicy(ctx, "default", &networksecurity.GatewaySecurityPolicyArgs{
			Name:        pulumi.String("my-gateway-security-policy"),
			Location:    pulumi.String("us-central1"),
			Description: pulumi.String("gateway security policy created to be used as reference by the rule."),
		})
		if err != nil {
			return err
		}
		_, err = networksecurity.NewGatewaySecurityPolicyRule(ctx, "default", &networksecurity.GatewaySecurityPolicyRuleArgs{
			Name:                  pulumi.String("my-gateway-security-policy-rule"),
			Location:              pulumi.String("us-central1"),
			GatewaySecurityPolicy: _default.Name,
			Enabled:               pulumi.Bool(true),
			Description:           pulumi.String("my description"),
			Priority:              pulumi.Int(0),
			SessionMatcher:        pulumi.String("host() == 'example.com'"),
			BasicProfile:          pulumi.String("ALLOW"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

resource "gcp_networksecurity_gatewaysecuritypolicy" "default" {
  name        = "my-gateway-security-policy"
  location    = "us-central1"
  description = "gateway security policy created to be used as reference by the rule."
}
resource "gcp_networksecurity_gatewaysecuritypolicyrule" "default" {
  name                    = "my-gateway-security-policy-rule"
  location                = "us-central1"
  gateway_security_policy = gcp_networksecurity_gatewaysecuritypolicy.default.name
  enabled                 = true
  description             = "my description"
  priority                = 0
  session_matcher         = "host() == 'example.com'"
  basic_profile           = "ALLOW"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.networksecurity.GatewaySecurityPolicy;
import com.pulumi.gcp.networksecurity.GatewaySecurityPolicyArgs;
import com.pulumi.gcp.networksecurity.GatewaySecurityPolicyRule;
import com.pulumi.gcp.networksecurity.GatewaySecurityPolicyRuleArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 GatewaySecurityPolicy("default", GatewaySecurityPolicyArgs.builder()
            .name("my-gateway-security-policy")
            .location("us-central1")
            .description("gateway security policy created to be used as reference by the rule.")
            .build());

        var defaultGatewaySecurityPolicyRule = new GatewaySecurityPolicyRule("defaultGatewaySecurityPolicyRule", GatewaySecurityPolicyRuleArgs.builder()
            .name("my-gateway-security-policy-rule")
            .location("us-central1")
            .gatewaySecurityPolicy(default_.name())
            .enabled(true)
            .description("my description")
            .priority(0)
            .sessionMatcher("host() == 'example.com'")
            .basicProfile("ALLOW")
            .build());

    }
}
resources:
  default:
    type: gcp:networksecurity:GatewaySecurityPolicy
    properties:
      name: my-gateway-security-policy
      location: us-central1
      description: gateway security policy created to be used as reference by the rule.
  defaultGatewaySecurityPolicyRule:
    type: gcp:networksecurity:GatewaySecurityPolicyRule
    name: default
    properties:
      name: my-gateway-security-policy-rule
      location: us-central1
      gatewaySecurityPolicy: ${default.name}
      enabled: true
      description: my description
      priority: 0
      sessionMatcher: host() == 'example.com'
      basicProfile: ALLOW

Network Security Gateway Security Policy Rules Advanced

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const _default = new gcp.networksecurity.GatewaySecurityPolicy("default", {
    name: "my-gateway-security-policy",
    location: "us-central1",
    description: "gateway security policy created to be used as reference by the rule.",
});
const defaultGatewaySecurityPolicyRule = new gcp.networksecurity.GatewaySecurityPolicyRule("default", {
    name: "my-gateway-security-policy-rule",
    location: "us-central1",
    gatewaySecurityPolicy: _default.name,
    enabled: true,
    description: "my description",
    priority: 0,
    sessionMatcher: "host() == 'example.com'",
    applicationMatcher: "request.method == 'POST'",
    tlsInspectionEnabled: false,
    basicProfile: "ALLOW",
});
import pulumi
import pulumi_gcp as gcp

default = gcp.networksecurity.GatewaySecurityPolicy("default",
    name="my-gateway-security-policy",
    location="us-central1",
    description="gateway security policy created to be used as reference by the rule.")
default_gateway_security_policy_rule = gcp.networksecurity.GatewaySecurityPolicyRule("default",
    name="my-gateway-security-policy-rule",
    location="us-central1",
    gateway_security_policy=default.name,
    enabled=True,
    description="my description",
    priority=0,
    session_matcher="host() == 'example.com'",
    application_matcher="request.method == 'POST'",
    tls_inspection_enabled=False,
    basic_profile="ALLOW")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var @default = new Gcp.NetworkSecurity.GatewaySecurityPolicy("default", new()
    {
        Name = "my-gateway-security-policy",
        Location = "us-central1",
        Description = "gateway security policy created to be used as reference by the rule.",
    });

    var defaultGatewaySecurityPolicyRule = new Gcp.NetworkSecurity.GatewaySecurityPolicyRule("default", new()
    {
        Name = "my-gateway-security-policy-rule",
        Location = "us-central1",
        GatewaySecurityPolicy = @default.Name,
        Enabled = true,
        Description = "my description",
        Priority = 0,
        SessionMatcher = "host() == 'example.com'",
        ApplicationMatcher = "request.method == 'POST'",
        TlsInspectionEnabled = false,
        BasicProfile = "ALLOW",
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/networksecurity"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_default, err := networksecurity.NewGatewaySecurityPolicy(ctx, "default", &networksecurity.GatewaySecurityPolicyArgs{
			Name:        pulumi.String("my-gateway-security-policy"),
			Location:    pulumi.String("us-central1"),
			Description: pulumi.String("gateway security policy created to be used as reference by the rule."),
		})
		if err != nil {
			return err
		}
		_, err = networksecurity.NewGatewaySecurityPolicyRule(ctx, "default", &networksecurity.GatewaySecurityPolicyRuleArgs{
			Name:                  pulumi.String("my-gateway-security-policy-rule"),
			Location:              pulumi.String("us-central1"),
			GatewaySecurityPolicy: _default.Name,
			Enabled:               pulumi.Bool(true),
			Description:           pulumi.String("my description"),
			Priority:              pulumi.Int(0),
			SessionMatcher:        pulumi.String("host() == 'example.com'"),
			ApplicationMatcher:    pulumi.String("request.method == 'POST'"),
			TlsInspectionEnabled:  pulumi.Bool(false),
			BasicProfile:          pulumi.String("ALLOW"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

resource "gcp_networksecurity_gatewaysecuritypolicy" "default" {
  name        = "my-gateway-security-policy"
  location    = "us-central1"
  description = "gateway security policy created to be used as reference by the rule."
}
resource "gcp_networksecurity_gatewaysecuritypolicyrule" "default" {
  name                    = "my-gateway-security-policy-rule"
  location                = "us-central1"
  gateway_security_policy = gcp_networksecurity_gatewaysecuritypolicy.default.name
  enabled                 = true
  description             = "my description"
  priority                = 0
  session_matcher         = "host() == 'example.com'"
  application_matcher     = "request.method == 'POST'"
  tls_inspection_enabled  = false
  basic_profile           = "ALLOW"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.networksecurity.GatewaySecurityPolicy;
import com.pulumi.gcp.networksecurity.GatewaySecurityPolicyArgs;
import com.pulumi.gcp.networksecurity.GatewaySecurityPolicyRule;
import com.pulumi.gcp.networksecurity.GatewaySecurityPolicyRuleArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 GatewaySecurityPolicy("default", GatewaySecurityPolicyArgs.builder()
            .name("my-gateway-security-policy")
            .location("us-central1")
            .description("gateway security policy created to be used as reference by the rule.")
            .build());

        var defaultGatewaySecurityPolicyRule = new GatewaySecurityPolicyRule("defaultGatewaySecurityPolicyRule", GatewaySecurityPolicyRuleArgs.builder()
            .name("my-gateway-security-policy-rule")
            .location("us-central1")
            .gatewaySecurityPolicy(default_.name())
            .enabled(true)
            .description("my description")
            .priority(0)
            .sessionMatcher("host() == 'example.com'")
            .applicationMatcher("request.method == 'POST'")
            .tlsInspectionEnabled(false)
            .basicProfile("ALLOW")
            .build());

    }
}
resources:
  default:
    type: gcp:networksecurity:GatewaySecurityPolicy
    properties:
      name: my-gateway-security-policy
      location: us-central1
      description: gateway security policy created to be used as reference by the rule.
  defaultGatewaySecurityPolicyRule:
    type: gcp:networksecurity:GatewaySecurityPolicyRule
    name: default
    properties:
      name: my-gateway-security-policy-rule
      location: us-central1
      gatewaySecurityPolicy: ${default.name}
      enabled: true
      description: my description
      priority: 0
      sessionMatcher: host() == 'example.com'
      applicationMatcher: request.method == 'POST'
      tlsInspectionEnabled: false
      basicProfile: ALLOW

Import

GatewaySecurityPolicyRule can be imported using any of these accepted formats:

  • projects/{{project}}/locations/{{location}}/gatewaySecurityPolicies/{{gateway_security_policy}}/rules/{{name}}
  • {{project}}/{{location}}/{{gateway_security_policy}}/{{name}}
  • {{location}}/{{gateway_security_policy}}/{{name}}

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

$ pulumi import gcp:networksecurity/gatewaySecurityPolicyRule:GatewaySecurityPolicyRule default projects/{{project}}/locations/{{location}}/gatewaySecurityPolicies/{{gateway_security_policy}}/rules/{{name}}
$ pulumi import gcp:networksecurity/gatewaySecurityPolicyRule:GatewaySecurityPolicyRule default {{project}}/{{location}}/{{gateway_security_policy}}/{{name}}
$ pulumi import gcp:networksecurity/gatewaySecurityPolicyRule:GatewaySecurityPolicyRule default {{location}}/{{gateway_security_policy}}/{{name}}

Constructors

GatewaySecurityPolicyRule(String name, {GatewaySecurityPolicyRuleArgs? args, CustomResourceOptions? options})
Creates a new GatewaySecurityPolicyRule. name The Pulumi resource name. args Arguments used to configure this GatewaySecurityPolicyRule. The set of arguments for GatewaySecurityPolicyRule. options Resource options controlling this resource's behavior.
GatewaySecurityPolicyRule.reference(String urn)
Creates a typed reference to an existing GatewaySecurityPolicyRule resource.

Properties

applicationMatcher ↔ Output<String?>
CEL expression for matching on L7/application level criteria.
latefinal
basicProfile ↔ Output<String>
Profile which tells what the primitive action should be. Possible values are: * ALLOW * DENY. Possible values are: BASIC_PROFILE_UNSPECIFIED, ALLOW, DENY.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
createTime ↔ Output<String>
The timestamp when the resource was created. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z"
latefinal
deletionPolicy ↔ Output<String>
Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
latefinal
description ↔ Output<String?>
Free-text description of the resource.
latefinal
enabled ↔ Output<bool>
Whether the rule is enforced.
latefinal
gatewaySecurityPolicy ↔ Output<String>
The name of the gatewat security policy this rule belongs to.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
location ↔ Output<String>
The location of the gateway security policy.
latefinal
name ↔ Output<String>
Name of the resource. ame is the full resource name so projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule} rule should match the pattern: (^a-z?$).
latefinal
priority ↔ Output<int>
Priority of the rule. Lower number corresponds to higher precedence.
latefinal
project ↔ Output<String>
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
Server-defined URL of this resource.
latefinal
sessionMatcher ↔ Output<String>
CEL expression for matching on session criteria.
latefinal
tlsInspectionEnabled ↔ Output<bool?>
Flag to enable TLS inspection of traffic matching on. Can only be true if the parent GatewaySecurityPolicy references a TLSInspectionConfig.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
updateTime ↔ Output<String>
The timestamp when the resource was updated. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
latefinal
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {GatewaySecurityPolicyRuleState? state, CustomResourceOptions? options}) → GatewaySecurityPolicyRule
Gets an existing GatewaySecurityPolicyRule resource's state with the given name and id.