1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. RegionSecurityPolicyRule
Google Cloud Classic v7.20.0 published on Wednesday, Apr 24, 2024 by Pulumi

gcp.compute.RegionSecurityPolicyRule

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.20.0 published on Wednesday, Apr 24, 2024 by Pulumi

    Example Usage

    Region Security Policy Rule Basic

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const _default = new gcp.compute.RegionSecurityPolicy("default", {
        region: "us-west2",
        name: "policyruletest",
        description: "basic region security policy",
        type: "CLOUD_ARMOR",
    });
    const policyRule = new gcp.compute.RegionSecurityPolicyRule("policy_rule", {
        region: "us-west2",
        securityPolicy: _default.name,
        description: "new rule",
        priority: 100,
        match: {
            versionedExpr: "SRC_IPS_V1",
            config: {
                srcIpRanges: ["10.10.0.0/16"],
            },
        },
        action: "allow",
        preview: true,
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    default = gcp.compute.RegionSecurityPolicy("default",
        region="us-west2",
        name="policyruletest",
        description="basic region security policy",
        type="CLOUD_ARMOR")
    policy_rule = gcp.compute.RegionSecurityPolicyRule("policy_rule",
        region="us-west2",
        security_policy=default.name,
        description="new rule",
        priority=100,
        match=gcp.compute.RegionSecurityPolicyRuleMatchArgs(
            versioned_expr="SRC_IPS_V1",
            config=gcp.compute.RegionSecurityPolicyRuleMatchConfigArgs(
                src_ip_ranges=["10.10.0.0/16"],
            ),
        ),
        action="allow",
        preview=True)
    
    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.NewRegionSecurityPolicy(ctx, "default", &compute.RegionSecurityPolicyArgs{
    			Region:      pulumi.String("us-west2"),
    			Name:        pulumi.String("policyruletest"),
    			Description: pulumi.String("basic region security policy"),
    			Type:        pulumi.String("CLOUD_ARMOR"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = compute.NewRegionSecurityPolicyRule(ctx, "policy_rule", &compute.RegionSecurityPolicyRuleArgs{
    			Region:         pulumi.String("us-west2"),
    			SecurityPolicy: _default.Name,
    			Description:    pulumi.String("new rule"),
    			Priority:       pulumi.Int(100),
    			Match: &compute.RegionSecurityPolicyRuleMatchArgs{
    				VersionedExpr: pulumi.String("SRC_IPS_V1"),
    				Config: &compute.RegionSecurityPolicyRuleMatchConfigArgs{
    					SrcIpRanges: pulumi.StringArray{
    						pulumi.String("10.10.0.0/16"),
    					},
    				},
    			},
    			Action:  pulumi.String("allow"),
    			Preview: pulumi.Bool(true),
    		})
    		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.RegionSecurityPolicy("default", new()
        {
            Region = "us-west2",
            Name = "policyruletest",
            Description = "basic region security policy",
            Type = "CLOUD_ARMOR",
        });
    
        var policyRule = new Gcp.Compute.RegionSecurityPolicyRule("policy_rule", new()
        {
            Region = "us-west2",
            SecurityPolicy = @default.Name,
            Description = "new rule",
            Priority = 100,
            Match = new Gcp.Compute.Inputs.RegionSecurityPolicyRuleMatchArgs
            {
                VersionedExpr = "SRC_IPS_V1",
                Config = new Gcp.Compute.Inputs.RegionSecurityPolicyRuleMatchConfigArgs
                {
                    SrcIpRanges = new[]
                    {
                        "10.10.0.0/16",
                    },
                },
            },
            Action = "allow",
            Preview = true,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.compute.RegionSecurityPolicy;
    import com.pulumi.gcp.compute.RegionSecurityPolicyArgs;
    import com.pulumi.gcp.compute.RegionSecurityPolicyRule;
    import com.pulumi.gcp.compute.RegionSecurityPolicyRuleArgs;
    import com.pulumi.gcp.compute.inputs.RegionSecurityPolicyRuleMatchArgs;
    import com.pulumi.gcp.compute.inputs.RegionSecurityPolicyRuleMatchConfigArgs;
    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 RegionSecurityPolicy("default", RegionSecurityPolicyArgs.builder()        
                .region("us-west2")
                .name("policyruletest")
                .description("basic region security policy")
                .type("CLOUD_ARMOR")
                .build());
    
            var policyRule = new RegionSecurityPolicyRule("policyRule", RegionSecurityPolicyRuleArgs.builder()        
                .region("us-west2")
                .securityPolicy(default_.name())
                .description("new rule")
                .priority(100)
                .match(RegionSecurityPolicyRuleMatchArgs.builder()
                    .versionedExpr("SRC_IPS_V1")
                    .config(RegionSecurityPolicyRuleMatchConfigArgs.builder()
                        .srcIpRanges("10.10.0.0/16")
                        .build())
                    .build())
                .action("allow")
                .preview(true)
                .build());
    
        }
    }
    
    resources:
      default:
        type: gcp:compute:RegionSecurityPolicy
        properties:
          region: us-west2
          name: policyruletest
          description: basic region security policy
          type: CLOUD_ARMOR
      policyRule:
        type: gcp:compute:RegionSecurityPolicyRule
        name: policy_rule
        properties:
          region: us-west2
          securityPolicy: ${default.name}
          description: new rule
          priority: 100
          match:
            versionedExpr: SRC_IPS_V1
            config:
              srcIpRanges:
                - 10.10.0.0/16
          action: allow
          preview: true
    

    Region Security Policy Rule Multiple Rules

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const _default = new gcp.compute.RegionSecurityPolicy("default", {
        region: "us-west2",
        name: "policywithmultiplerules",
        description: "basic region security policy",
        type: "CLOUD_ARMOR",
    });
    const policyRuleOne = new gcp.compute.RegionSecurityPolicyRule("policy_rule_one", {
        region: "us-west2",
        securityPolicy: _default.name,
        description: "new rule one",
        priority: 100,
        match: {
            versionedExpr: "SRC_IPS_V1",
            config: {
                srcIpRanges: ["10.10.0.0/16"],
            },
        },
        action: "allow",
        preview: true,
    });
    const policyRuleTwo = new gcp.compute.RegionSecurityPolicyRule("policy_rule_two", {
        region: "us-west2",
        securityPolicy: _default.name,
        description: "new rule two",
        priority: 101,
        match: {
            versionedExpr: "SRC_IPS_V1",
            config: {
                srcIpRanges: [
                    "192.168.0.0/16",
                    "10.0.0.0/8",
                ],
            },
        },
        action: "allow",
        preview: true,
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    default = gcp.compute.RegionSecurityPolicy("default",
        region="us-west2",
        name="policywithmultiplerules",
        description="basic region security policy",
        type="CLOUD_ARMOR")
    policy_rule_one = gcp.compute.RegionSecurityPolicyRule("policy_rule_one",
        region="us-west2",
        security_policy=default.name,
        description="new rule one",
        priority=100,
        match=gcp.compute.RegionSecurityPolicyRuleMatchArgs(
            versioned_expr="SRC_IPS_V1",
            config=gcp.compute.RegionSecurityPolicyRuleMatchConfigArgs(
                src_ip_ranges=["10.10.0.0/16"],
            ),
        ),
        action="allow",
        preview=True)
    policy_rule_two = gcp.compute.RegionSecurityPolicyRule("policy_rule_two",
        region="us-west2",
        security_policy=default.name,
        description="new rule two",
        priority=101,
        match=gcp.compute.RegionSecurityPolicyRuleMatchArgs(
            versioned_expr="SRC_IPS_V1",
            config=gcp.compute.RegionSecurityPolicyRuleMatchConfigArgs(
                src_ip_ranges=[
                    "192.168.0.0/16",
                    "10.0.0.0/8",
                ],
            ),
        ),
        action="allow",
        preview=True)
    
    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.NewRegionSecurityPolicy(ctx, "default", &compute.RegionSecurityPolicyArgs{
    			Region:      pulumi.String("us-west2"),
    			Name:        pulumi.String("policywithmultiplerules"),
    			Description: pulumi.String("basic region security policy"),
    			Type:        pulumi.String("CLOUD_ARMOR"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = compute.NewRegionSecurityPolicyRule(ctx, "policy_rule_one", &compute.RegionSecurityPolicyRuleArgs{
    			Region:         pulumi.String("us-west2"),
    			SecurityPolicy: _default.Name,
    			Description:    pulumi.String("new rule one"),
    			Priority:       pulumi.Int(100),
    			Match: &compute.RegionSecurityPolicyRuleMatchArgs{
    				VersionedExpr: pulumi.String("SRC_IPS_V1"),
    				Config: &compute.RegionSecurityPolicyRuleMatchConfigArgs{
    					SrcIpRanges: pulumi.StringArray{
    						pulumi.String("10.10.0.0/16"),
    					},
    				},
    			},
    			Action:  pulumi.String("allow"),
    			Preview: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = compute.NewRegionSecurityPolicyRule(ctx, "policy_rule_two", &compute.RegionSecurityPolicyRuleArgs{
    			Region:         pulumi.String("us-west2"),
    			SecurityPolicy: _default.Name,
    			Description:    pulumi.String("new rule two"),
    			Priority:       pulumi.Int(101),
    			Match: &compute.RegionSecurityPolicyRuleMatchArgs{
    				VersionedExpr: pulumi.String("SRC_IPS_V1"),
    				Config: &compute.RegionSecurityPolicyRuleMatchConfigArgs{
    					SrcIpRanges: pulumi.StringArray{
    						pulumi.String("192.168.0.0/16"),
    						pulumi.String("10.0.0.0/8"),
    					},
    				},
    			},
    			Action:  pulumi.String("allow"),
    			Preview: pulumi.Bool(true),
    		})
    		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.RegionSecurityPolicy("default", new()
        {
            Region = "us-west2",
            Name = "policywithmultiplerules",
            Description = "basic region security policy",
            Type = "CLOUD_ARMOR",
        });
    
        var policyRuleOne = new Gcp.Compute.RegionSecurityPolicyRule("policy_rule_one", new()
        {
            Region = "us-west2",
            SecurityPolicy = @default.Name,
            Description = "new rule one",
            Priority = 100,
            Match = new Gcp.Compute.Inputs.RegionSecurityPolicyRuleMatchArgs
            {
                VersionedExpr = "SRC_IPS_V1",
                Config = new Gcp.Compute.Inputs.RegionSecurityPolicyRuleMatchConfigArgs
                {
                    SrcIpRanges = new[]
                    {
                        "10.10.0.0/16",
                    },
                },
            },
            Action = "allow",
            Preview = true,
        });
    
        var policyRuleTwo = new Gcp.Compute.RegionSecurityPolicyRule("policy_rule_two", new()
        {
            Region = "us-west2",
            SecurityPolicy = @default.Name,
            Description = "new rule two",
            Priority = 101,
            Match = new Gcp.Compute.Inputs.RegionSecurityPolicyRuleMatchArgs
            {
                VersionedExpr = "SRC_IPS_V1",
                Config = new Gcp.Compute.Inputs.RegionSecurityPolicyRuleMatchConfigArgs
                {
                    SrcIpRanges = new[]
                    {
                        "192.168.0.0/16",
                        "10.0.0.0/8",
                    },
                },
            },
            Action = "allow",
            Preview = true,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.compute.RegionSecurityPolicy;
    import com.pulumi.gcp.compute.RegionSecurityPolicyArgs;
    import com.pulumi.gcp.compute.RegionSecurityPolicyRule;
    import com.pulumi.gcp.compute.RegionSecurityPolicyRuleArgs;
    import com.pulumi.gcp.compute.inputs.RegionSecurityPolicyRuleMatchArgs;
    import com.pulumi.gcp.compute.inputs.RegionSecurityPolicyRuleMatchConfigArgs;
    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 RegionSecurityPolicy("default", RegionSecurityPolicyArgs.builder()        
                .region("us-west2")
                .name("policywithmultiplerules")
                .description("basic region security policy")
                .type("CLOUD_ARMOR")
                .build());
    
            var policyRuleOne = new RegionSecurityPolicyRule("policyRuleOne", RegionSecurityPolicyRuleArgs.builder()        
                .region("us-west2")
                .securityPolicy(default_.name())
                .description("new rule one")
                .priority(100)
                .match(RegionSecurityPolicyRuleMatchArgs.builder()
                    .versionedExpr("SRC_IPS_V1")
                    .config(RegionSecurityPolicyRuleMatchConfigArgs.builder()
                        .srcIpRanges("10.10.0.0/16")
                        .build())
                    .build())
                .action("allow")
                .preview(true)
                .build());
    
            var policyRuleTwo = new RegionSecurityPolicyRule("policyRuleTwo", RegionSecurityPolicyRuleArgs.builder()        
                .region("us-west2")
                .securityPolicy(default_.name())
                .description("new rule two")
                .priority(101)
                .match(RegionSecurityPolicyRuleMatchArgs.builder()
                    .versionedExpr("SRC_IPS_V1")
                    .config(RegionSecurityPolicyRuleMatchConfigArgs.builder()
                        .srcIpRanges(                    
                            "192.168.0.0/16",
                            "10.0.0.0/8")
                        .build())
                    .build())
                .action("allow")
                .preview(true)
                .build());
    
        }
    }
    
    resources:
      default:
        type: gcp:compute:RegionSecurityPolicy
        properties:
          region: us-west2
          name: policywithmultiplerules
          description: basic region security policy
          type: CLOUD_ARMOR
      policyRuleOne:
        type: gcp:compute:RegionSecurityPolicyRule
        name: policy_rule_one
        properties:
          region: us-west2
          securityPolicy: ${default.name}
          description: new rule one
          priority: 100
          match:
            versionedExpr: SRC_IPS_V1
            config:
              srcIpRanges:
                - 10.10.0.0/16
          action: allow
          preview: true
      policyRuleTwo:
        type: gcp:compute:RegionSecurityPolicyRule
        name: policy_rule_two
        properties:
          region: us-west2
          securityPolicy: ${default.name}
          description: new rule two
          priority: 101
          match:
            versionedExpr: SRC_IPS_V1
            config:
              srcIpRanges:
                - 192.168.0.0/16
                - 10.0.0.0/8
          action: allow
          preview: true
    

    Region Security Policy Rule With Network Match

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    // First activate advanced network DDoS protection for the desired region
    const policyddosprotection = new gcp.compute.RegionSecurityPolicy("policyddosprotection", {
        region: "us-west2",
        name: "policyddosprotection",
        description: "policy for activating network DDoS protection for the desired region",
        type: "CLOUD_ARMOR_NETWORK",
        ddosProtectionConfig: {
            ddosProtection: "ADVANCED_PREVIEW",
        },
    });
    const edgeSecService = new gcp.compute.NetworkEdgeSecurityService("edge_sec_service", {
        region: "us-west2",
        name: "edgesecservice",
        description: "linking policy to edge security service",
        securityPolicy: policyddosprotection.selfLink,
    });
    // Add the desired policy and custom rule.
    const policynetworkmatch = new gcp.compute.RegionSecurityPolicy("policynetworkmatch", {
        region: "us-west2",
        name: "policyfornetworkmatch",
        description: "region security policy for network match",
        type: "CLOUD_ARMOR_NETWORK",
        userDefinedFields: [{
            name: "SIG1_AT_0",
            base: "TCP",
            offset: 8,
            size: 2,
            mask: "0x8F00",
        }],
    });
    const policyRuleNetworkMatch = new gcp.compute.RegionSecurityPolicyRule("policy_rule_network_match", {
        region: "us-west2",
        securityPolicy: policynetworkmatch.name,
        description: "custom rule for network match",
        priority: 100,
        networkMatch: {
            srcIpRanges: ["10.10.0.0/16"],
            userDefinedFields: [{
                name: "SIG1_AT_0",
                values: ["0x8F00"],
            }],
        },
        action: "allow",
        preview: true,
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    # First activate advanced network DDoS protection for the desired region
    policyddosprotection = gcp.compute.RegionSecurityPolicy("policyddosprotection",
        region="us-west2",
        name="policyddosprotection",
        description="policy for activating network DDoS protection for the desired region",
        type="CLOUD_ARMOR_NETWORK",
        ddos_protection_config=gcp.compute.RegionSecurityPolicyDdosProtectionConfigArgs(
            ddos_protection="ADVANCED_PREVIEW",
        ))
    edge_sec_service = gcp.compute.NetworkEdgeSecurityService("edge_sec_service",
        region="us-west2",
        name="edgesecservice",
        description="linking policy to edge security service",
        security_policy=policyddosprotection.self_link)
    # Add the desired policy and custom rule.
    policynetworkmatch = gcp.compute.RegionSecurityPolicy("policynetworkmatch",
        region="us-west2",
        name="policyfornetworkmatch",
        description="region security policy for network match",
        type="CLOUD_ARMOR_NETWORK",
        user_defined_fields=[gcp.compute.RegionSecurityPolicyUserDefinedFieldArgs(
            name="SIG1_AT_0",
            base="TCP",
            offset=8,
            size=2,
            mask="0x8F00",
        )])
    policy_rule_network_match = gcp.compute.RegionSecurityPolicyRule("policy_rule_network_match",
        region="us-west2",
        security_policy=policynetworkmatch.name,
        description="custom rule for network match",
        priority=100,
        network_match=gcp.compute.RegionSecurityPolicyRuleNetworkMatchArgs(
            src_ip_ranges=["10.10.0.0/16"],
            user_defined_fields=[gcp.compute.RegionSecurityPolicyRuleNetworkMatchUserDefinedFieldArgs(
                name="SIG1_AT_0",
                values=["0x8F00"],
            )],
        ),
        action="allow",
        preview=True)
    
    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 {
    		// First activate advanced network DDoS protection for the desired region
    		policyddosprotection, err := compute.NewRegionSecurityPolicy(ctx, "policyddosprotection", &compute.RegionSecurityPolicyArgs{
    			Region:      pulumi.String("us-west2"),
    			Name:        pulumi.String("policyddosprotection"),
    			Description: pulumi.String("policy for activating network DDoS protection for the desired region"),
    			Type:        pulumi.String("CLOUD_ARMOR_NETWORK"),
    			DdosProtectionConfig: &compute.RegionSecurityPolicyDdosProtectionConfigArgs{
    				DdosProtection: pulumi.String("ADVANCED_PREVIEW"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = compute.NewNetworkEdgeSecurityService(ctx, "edge_sec_service", &compute.NetworkEdgeSecurityServiceArgs{
    			Region:         pulumi.String("us-west2"),
    			Name:           pulumi.String("edgesecservice"),
    			Description:    pulumi.String("linking policy to edge security service"),
    			SecurityPolicy: policyddosprotection.SelfLink,
    		})
    		if err != nil {
    			return err
    		}
    		// Add the desired policy and custom rule.
    		policynetworkmatch, err := compute.NewRegionSecurityPolicy(ctx, "policynetworkmatch", &compute.RegionSecurityPolicyArgs{
    			Region:      pulumi.String("us-west2"),
    			Name:        pulumi.String("policyfornetworkmatch"),
    			Description: pulumi.String("region security policy for network match"),
    			Type:        pulumi.String("CLOUD_ARMOR_NETWORK"),
    			UserDefinedFields: compute.RegionSecurityPolicyUserDefinedFieldArray{
    				&compute.RegionSecurityPolicyUserDefinedFieldArgs{
    					Name:   pulumi.String("SIG1_AT_0"),
    					Base:   pulumi.String("TCP"),
    					Offset: pulumi.Int(8),
    					Size:   pulumi.Int(2),
    					Mask:   pulumi.String("0x8F00"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = compute.NewRegionSecurityPolicyRule(ctx, "policy_rule_network_match", &compute.RegionSecurityPolicyRuleArgs{
    			Region:         pulumi.String("us-west2"),
    			SecurityPolicy: policynetworkmatch.Name,
    			Description:    pulumi.String("custom rule for network match"),
    			Priority:       pulumi.Int(100),
    			NetworkMatch: &compute.RegionSecurityPolicyRuleNetworkMatchArgs{
    				SrcIpRanges: pulumi.StringArray{
    					pulumi.String("10.10.0.0/16"),
    				},
    				UserDefinedFields: compute.RegionSecurityPolicyRuleNetworkMatchUserDefinedFieldArray{
    					&compute.RegionSecurityPolicyRuleNetworkMatchUserDefinedFieldArgs{
    						Name: pulumi.String("SIG1_AT_0"),
    						Values: pulumi.StringArray{
    							pulumi.String("0x8F00"),
    						},
    					},
    				},
    			},
    			Action:  pulumi.String("allow"),
    			Preview: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        // First activate advanced network DDoS protection for the desired region
        var policyddosprotection = new Gcp.Compute.RegionSecurityPolicy("policyddosprotection", new()
        {
            Region = "us-west2",
            Name = "policyddosprotection",
            Description = "policy for activating network DDoS protection for the desired region",
            Type = "CLOUD_ARMOR_NETWORK",
            DdosProtectionConfig = new Gcp.Compute.Inputs.RegionSecurityPolicyDdosProtectionConfigArgs
            {
                DdosProtection = "ADVANCED_PREVIEW",
            },
        });
    
        var edgeSecService = new Gcp.Compute.NetworkEdgeSecurityService("edge_sec_service", new()
        {
            Region = "us-west2",
            Name = "edgesecservice",
            Description = "linking policy to edge security service",
            SecurityPolicy = policyddosprotection.SelfLink,
        });
    
        // Add the desired policy and custom rule.
        var policynetworkmatch = new Gcp.Compute.RegionSecurityPolicy("policynetworkmatch", new()
        {
            Region = "us-west2",
            Name = "policyfornetworkmatch",
            Description = "region security policy for network match",
            Type = "CLOUD_ARMOR_NETWORK",
            UserDefinedFields = new[]
            {
                new Gcp.Compute.Inputs.RegionSecurityPolicyUserDefinedFieldArgs
                {
                    Name = "SIG1_AT_0",
                    Base = "TCP",
                    Offset = 8,
                    Size = 2,
                    Mask = "0x8F00",
                },
            },
        });
    
        var policyRuleNetworkMatch = new Gcp.Compute.RegionSecurityPolicyRule("policy_rule_network_match", new()
        {
            Region = "us-west2",
            SecurityPolicy = policynetworkmatch.Name,
            Description = "custom rule for network match",
            Priority = 100,
            NetworkMatch = new Gcp.Compute.Inputs.RegionSecurityPolicyRuleNetworkMatchArgs
            {
                SrcIpRanges = new[]
                {
                    "10.10.0.0/16",
                },
                UserDefinedFields = new[]
                {
                    new Gcp.Compute.Inputs.RegionSecurityPolicyRuleNetworkMatchUserDefinedFieldArgs
                    {
                        Name = "SIG1_AT_0",
                        Values = new[]
                        {
                            "0x8F00",
                        },
                    },
                },
            },
            Action = "allow",
            Preview = true,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.compute.RegionSecurityPolicy;
    import com.pulumi.gcp.compute.RegionSecurityPolicyArgs;
    import com.pulumi.gcp.compute.inputs.RegionSecurityPolicyDdosProtectionConfigArgs;
    import com.pulumi.gcp.compute.NetworkEdgeSecurityService;
    import com.pulumi.gcp.compute.NetworkEdgeSecurityServiceArgs;
    import com.pulumi.gcp.compute.inputs.RegionSecurityPolicyUserDefinedFieldArgs;
    import com.pulumi.gcp.compute.RegionSecurityPolicyRule;
    import com.pulumi.gcp.compute.RegionSecurityPolicyRuleArgs;
    import com.pulumi.gcp.compute.inputs.RegionSecurityPolicyRuleNetworkMatchArgs;
    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) {
            // First activate advanced network DDoS protection for the desired region
            var policyddosprotection = new RegionSecurityPolicy("policyddosprotection", RegionSecurityPolicyArgs.builder()        
                .region("us-west2")
                .name("policyddosprotection")
                .description("policy for activating network DDoS protection for the desired region")
                .type("CLOUD_ARMOR_NETWORK")
                .ddosProtectionConfig(RegionSecurityPolicyDdosProtectionConfigArgs.builder()
                    .ddosProtection("ADVANCED_PREVIEW")
                    .build())
                .build());
    
            var edgeSecService = new NetworkEdgeSecurityService("edgeSecService", NetworkEdgeSecurityServiceArgs.builder()        
                .region("us-west2")
                .name("edgesecservice")
                .description("linking policy to edge security service")
                .securityPolicy(policyddosprotection.selfLink())
                .build());
    
            // Add the desired policy and custom rule.
            var policynetworkmatch = new RegionSecurityPolicy("policynetworkmatch", RegionSecurityPolicyArgs.builder()        
                .region("us-west2")
                .name("policyfornetworkmatch")
                .description("region security policy for network match")
                .type("CLOUD_ARMOR_NETWORK")
                .userDefinedFields(RegionSecurityPolicyUserDefinedFieldArgs.builder()
                    .name("SIG1_AT_0")
                    .base("TCP")
                    .offset(8)
                    .size(2)
                    .mask("0x8F00")
                    .build())
                .build());
    
            var policyRuleNetworkMatch = new RegionSecurityPolicyRule("policyRuleNetworkMatch", RegionSecurityPolicyRuleArgs.builder()        
                .region("us-west2")
                .securityPolicy(policynetworkmatch.name())
                .description("custom rule for network match")
                .priority(100)
                .networkMatch(RegionSecurityPolicyRuleNetworkMatchArgs.builder()
                    .srcIpRanges("10.10.0.0/16")
                    .userDefinedFields(RegionSecurityPolicyRuleNetworkMatchUserDefinedFieldArgs.builder()
                        .name("SIG1_AT_0")
                        .values("0x8F00")
                        .build())
                    .build())
                .action("allow")
                .preview(true)
                .build());
    
        }
    }
    
    resources:
      # First activate advanced network DDoS protection for the desired region
      policyddosprotection:
        type: gcp:compute:RegionSecurityPolicy
        properties:
          region: us-west2
          name: policyddosprotection
          description: policy for activating network DDoS protection for the desired region
          type: CLOUD_ARMOR_NETWORK
          ddosProtectionConfig:
            ddosProtection: ADVANCED_PREVIEW
      edgeSecService:
        type: gcp:compute:NetworkEdgeSecurityService
        name: edge_sec_service
        properties:
          region: us-west2
          name: edgesecservice
          description: linking policy to edge security service
          securityPolicy: ${policyddosprotection.selfLink}
      # Add the desired policy and custom rule.
      policynetworkmatch:
        type: gcp:compute:RegionSecurityPolicy
        properties:
          region: us-west2
          name: policyfornetworkmatch
          description: region security policy for network match
          type: CLOUD_ARMOR_NETWORK
          userDefinedFields:
            - name: SIG1_AT_0
              base: TCP
              offset: 8
              size: 2
              mask: 0x8F00
      policyRuleNetworkMatch:
        type: gcp:compute:RegionSecurityPolicyRule
        name: policy_rule_network_match
        properties:
          region: us-west2
          securityPolicy: ${policynetworkmatch.name}
          description: custom rule for network match
          priority: 100
          networkMatch:
            srcIpRanges:
              - 10.10.0.0/16
            userDefinedFields:
              - name: SIG1_AT_0
                values:
                  - 0x8F00
          action: allow
          preview: true
    

    Create RegionSecurityPolicyRule Resource

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

    Constructor syntax

    new RegionSecurityPolicyRule(name: string, args: RegionSecurityPolicyRuleArgs, opts?: CustomResourceOptions);
    @overload
    def RegionSecurityPolicyRule(resource_name: str,
                                 args: RegionSecurityPolicyRuleArgs,
                                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def RegionSecurityPolicyRule(resource_name: str,
                                 opts: Optional[ResourceOptions] = None,
                                 action: Optional[str] = None,
                                 priority: Optional[int] = None,
                                 region: Optional[str] = None,
                                 security_policy: Optional[str] = None,
                                 description: Optional[str] = None,
                                 match: Optional[RegionSecurityPolicyRuleMatchArgs] = None,
                                 network_match: Optional[RegionSecurityPolicyRuleNetworkMatchArgs] = None,
                                 preview: Optional[bool] = None,
                                 project: Optional[str] = None)
    func NewRegionSecurityPolicyRule(ctx *Context, name string, args RegionSecurityPolicyRuleArgs, opts ...ResourceOption) (*RegionSecurityPolicyRule, error)
    public RegionSecurityPolicyRule(string name, RegionSecurityPolicyRuleArgs args, CustomResourceOptions? opts = null)
    public RegionSecurityPolicyRule(String name, RegionSecurityPolicyRuleArgs args)
    public RegionSecurityPolicyRule(String name, RegionSecurityPolicyRuleArgs args, CustomResourceOptions options)
    
    type: gcp:compute:RegionSecurityPolicyRule
    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 RegionSecurityPolicyRuleArgs
    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 RegionSecurityPolicyRuleArgs
    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 RegionSecurityPolicyRuleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RegionSecurityPolicyRuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RegionSecurityPolicyRuleArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

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

    var regionSecurityPolicyRuleResource = new Gcp.Compute.RegionSecurityPolicyRule("regionSecurityPolicyRuleResource", new()
    {
        Action = "string",
        Priority = 0,
        Region = "string",
        SecurityPolicy = "string",
        Description = "string",
        Match = new Gcp.Compute.Inputs.RegionSecurityPolicyRuleMatchArgs
        {
            Config = new Gcp.Compute.Inputs.RegionSecurityPolicyRuleMatchConfigArgs
            {
                SrcIpRanges = new[]
                {
                    "string",
                },
            },
            VersionedExpr = "string",
        },
        NetworkMatch = new Gcp.Compute.Inputs.RegionSecurityPolicyRuleNetworkMatchArgs
        {
            DestIpRanges = new[]
            {
                "string",
            },
            DestPorts = new[]
            {
                "string",
            },
            IpProtocols = new[]
            {
                "string",
            },
            SrcAsns = new[]
            {
                0,
            },
            SrcIpRanges = new[]
            {
                "string",
            },
            SrcPorts = new[]
            {
                "string",
            },
            SrcRegionCodes = new[]
            {
                "string",
            },
            UserDefinedFields = new[]
            {
                new Gcp.Compute.Inputs.RegionSecurityPolicyRuleNetworkMatchUserDefinedFieldArgs
                {
                    Name = "string",
                    Values = new[]
                    {
                        "string",
                    },
                },
            },
        },
        Preview = false,
        Project = "string",
    });
    
    example, err := compute.NewRegionSecurityPolicyRule(ctx, "regionSecurityPolicyRuleResource", &compute.RegionSecurityPolicyRuleArgs{
    	Action:         pulumi.String("string"),
    	Priority:       pulumi.Int(0),
    	Region:         pulumi.String("string"),
    	SecurityPolicy: pulumi.String("string"),
    	Description:    pulumi.String("string"),
    	Match: &compute.RegionSecurityPolicyRuleMatchArgs{
    		Config: &compute.RegionSecurityPolicyRuleMatchConfigArgs{
    			SrcIpRanges: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    		},
    		VersionedExpr: pulumi.String("string"),
    	},
    	NetworkMatch: &compute.RegionSecurityPolicyRuleNetworkMatchArgs{
    		DestIpRanges: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		DestPorts: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		IpProtocols: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		SrcAsns: pulumi.IntArray{
    			pulumi.Int(0),
    		},
    		SrcIpRanges: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		SrcPorts: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		SrcRegionCodes: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		UserDefinedFields: compute.RegionSecurityPolicyRuleNetworkMatchUserDefinedFieldArray{
    			&compute.RegionSecurityPolicyRuleNetworkMatchUserDefinedFieldArgs{
    				Name: pulumi.String("string"),
    				Values: pulumi.StringArray{
    					pulumi.String("string"),
    				},
    			},
    		},
    	},
    	Preview: pulumi.Bool(false),
    	Project: pulumi.String("string"),
    })
    
    var regionSecurityPolicyRuleResource = new RegionSecurityPolicyRule("regionSecurityPolicyRuleResource", RegionSecurityPolicyRuleArgs.builder()        
        .action("string")
        .priority(0)
        .region("string")
        .securityPolicy("string")
        .description("string")
        .match(RegionSecurityPolicyRuleMatchArgs.builder()
            .config(RegionSecurityPolicyRuleMatchConfigArgs.builder()
                .srcIpRanges("string")
                .build())
            .versionedExpr("string")
            .build())
        .networkMatch(RegionSecurityPolicyRuleNetworkMatchArgs.builder()
            .destIpRanges("string")
            .destPorts("string")
            .ipProtocols("string")
            .srcAsns(0)
            .srcIpRanges("string")
            .srcPorts("string")
            .srcRegionCodes("string")
            .userDefinedFields(RegionSecurityPolicyRuleNetworkMatchUserDefinedFieldArgs.builder()
                .name("string")
                .values("string")
                .build())
            .build())
        .preview(false)
        .project("string")
        .build());
    
    region_security_policy_rule_resource = gcp.compute.RegionSecurityPolicyRule("regionSecurityPolicyRuleResource",
        action="string",
        priority=0,
        region="string",
        security_policy="string",
        description="string",
        match=gcp.compute.RegionSecurityPolicyRuleMatchArgs(
            config=gcp.compute.RegionSecurityPolicyRuleMatchConfigArgs(
                src_ip_ranges=["string"],
            ),
            versioned_expr="string",
        ),
        network_match=gcp.compute.RegionSecurityPolicyRuleNetworkMatchArgs(
            dest_ip_ranges=["string"],
            dest_ports=["string"],
            ip_protocols=["string"],
            src_asns=[0],
            src_ip_ranges=["string"],
            src_ports=["string"],
            src_region_codes=["string"],
            user_defined_fields=[gcp.compute.RegionSecurityPolicyRuleNetworkMatchUserDefinedFieldArgs(
                name="string",
                values=["string"],
            )],
        ),
        preview=False,
        project="string")
    
    const regionSecurityPolicyRuleResource = new gcp.compute.RegionSecurityPolicyRule("regionSecurityPolicyRuleResource", {
        action: "string",
        priority: 0,
        region: "string",
        securityPolicy: "string",
        description: "string",
        match: {
            config: {
                srcIpRanges: ["string"],
            },
            versionedExpr: "string",
        },
        networkMatch: {
            destIpRanges: ["string"],
            destPorts: ["string"],
            ipProtocols: ["string"],
            srcAsns: [0],
            srcIpRanges: ["string"],
            srcPorts: ["string"],
            srcRegionCodes: ["string"],
            userDefinedFields: [{
                name: "string",
                values: ["string"],
            }],
        },
        preview: false,
        project: "string",
    });
    
    type: gcp:compute:RegionSecurityPolicyRule
    properties:
        action: string
        description: string
        match:
            config:
                srcIpRanges:
                    - string
            versionedExpr: string
        networkMatch:
            destIpRanges:
                - string
            destPorts:
                - string
            ipProtocols:
                - string
            srcAsns:
                - 0
            srcIpRanges:
                - string
            srcPorts:
                - string
            srcRegionCodes:
                - string
            userDefinedFields:
                - name: string
                  values:
                    - string
        preview: false
        priority: 0
        project: string
        region: string
        securityPolicy: string
    

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

    Action string
    The Action to perform when the rule is matched. The following are the valid actions:

    • allow: allow access to target.
    • deny(STATUS): deny access to target, returns the HTTP response code specified. Valid values for STATUS are 403, 404, and 502.
    • rate_based_ban: limit client traffic to the configured threshold and ban the client if the traffic exceeds the threshold. Configure parameters for this action in RateLimitOptions. Requires rateLimitOptions to be set.
    • redirect: redirect to a different target. This can either be an internal reCAPTCHA redirect, or an external URL-based redirect via a 302 response. Parameters for this action can be configured via redirectOptions. This action is only supported in Global Security Policies of type CLOUD_ARMOR.
    • throttle: limit client traffic to the configured threshold. Configure parameters for this action in rateLimitOptions. Requires rateLimitOptions to be set for this.
    Priority int
    An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest priority.
    Region string
    The Region in which the created Region Security Policy rule should reside.
    SecurityPolicy string
    The name of the security policy this rule belongs to.


    Description string
    An optional description of this resource. Provide this property when you create the resource.
    Match RegionSecurityPolicyRuleMatch
    A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding 'action' is enforced. Structure is documented below.
    NetworkMatch RegionSecurityPolicyRuleNetworkMatch
    A match condition that incoming packets are evaluated against for CLOUD_ARMOR_NETWORK security policies. If it matches, the corresponding 'action' is enforced. The match criteria for a rule consists of built-in match fields (like 'srcIpRanges') and potentially multiple user-defined match fields ('userDefinedFields'). Field values may be extracted directly from the packet or derived from it (e.g. 'srcRegionCodes'). Some fields may not be present in every packet (e.g. 'srcPorts'). A user-defined field is only present if the base header is found in the packet and the entire field is in bounds. Each match field may specify which values can match it, listing one or more ranges, prefixes, or exact values that are considered a match for the field. A field value must be present in order to match a specified match field. If no match values are specified for a match field, then any field value is considered to match it, and it's not required to be present. For strings specifying '*' is also equivalent to match all. For a packet to match a rule, all specified match fields must match the corresponding field values derived from the packet. Example: networkMatch: srcIpRanges: - "192.0.2.0/24" - "198.51.100.0/24" userDefinedFields: - name: "ipv4_fragment_offset" values: - "1-0x1fff" The above match condition matches packets with a source IP in 192.0.2.0/24 or 198.51.100.0/24 and a user-defined field named "ipv4_fragment_offset" with a value between 1 and 0x1fff inclusive Structure is documented below.
    Preview bool
    If set to true, the specified action is not enforced.
    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 perform when the rule is matched. The following are the valid actions:

    • allow: allow access to target.
    • deny(STATUS): deny access to target, returns the HTTP response code specified. Valid values for STATUS are 403, 404, and 502.
    • rate_based_ban: limit client traffic to the configured threshold and ban the client if the traffic exceeds the threshold. Configure parameters for this action in RateLimitOptions. Requires rateLimitOptions to be set.
    • redirect: redirect to a different target. This can either be an internal reCAPTCHA redirect, or an external URL-based redirect via a 302 response. Parameters for this action can be configured via redirectOptions. This action is only supported in Global Security Policies of type CLOUD_ARMOR.
    • throttle: limit client traffic to the configured threshold. Configure parameters for this action in rateLimitOptions. Requires rateLimitOptions to be set for this.
    Priority int
    An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest priority.
    Region string
    The Region in which the created Region Security Policy rule should reside.
    SecurityPolicy string
    The name of the security policy this rule belongs to.


    Description string
    An optional description of this resource. Provide this property when you create the resource.
    Match RegionSecurityPolicyRuleMatchArgs
    A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding 'action' is enforced. Structure is documented below.
    NetworkMatch RegionSecurityPolicyRuleNetworkMatchArgs
    A match condition that incoming packets are evaluated against for CLOUD_ARMOR_NETWORK security policies. If it matches, the corresponding 'action' is enforced. The match criteria for a rule consists of built-in match fields (like 'srcIpRanges') and potentially multiple user-defined match fields ('userDefinedFields'). Field values may be extracted directly from the packet or derived from it (e.g. 'srcRegionCodes'). Some fields may not be present in every packet (e.g. 'srcPorts'). A user-defined field is only present if the base header is found in the packet and the entire field is in bounds. Each match field may specify which values can match it, listing one or more ranges, prefixes, or exact values that are considered a match for the field. A field value must be present in order to match a specified match field. If no match values are specified for a match field, then any field value is considered to match it, and it's not required to be present. For strings specifying '*' is also equivalent to match all. For a packet to match a rule, all specified match fields must match the corresponding field values derived from the packet. Example: networkMatch: srcIpRanges: - "192.0.2.0/24" - "198.51.100.0/24" userDefinedFields: - name: "ipv4_fragment_offset" values: - "1-0x1fff" The above match condition matches packets with a source IP in 192.0.2.0/24 or 198.51.100.0/24 and a user-defined field named "ipv4_fragment_offset" with a value between 1 and 0x1fff inclusive Structure is documented below.
    Preview bool
    If set to true, the specified action is not enforced.
    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 perform when the rule is matched. The following are the valid actions:

    • allow: allow access to target.
    • deny(STATUS): deny access to target, returns the HTTP response code specified. Valid values for STATUS are 403, 404, and 502.
    • rate_based_ban: limit client traffic to the configured threshold and ban the client if the traffic exceeds the threshold. Configure parameters for this action in RateLimitOptions. Requires rateLimitOptions to be set.
    • redirect: redirect to a different target. This can either be an internal reCAPTCHA redirect, or an external URL-based redirect via a 302 response. Parameters for this action can be configured via redirectOptions. This action is only supported in Global Security Policies of type CLOUD_ARMOR.
    • throttle: limit client traffic to the configured threshold. Configure parameters for this action in rateLimitOptions. Requires rateLimitOptions to be set for this.
    priority Integer
    An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest priority.
    region String
    The Region in which the created Region Security Policy rule should reside.
    securityPolicy String
    The name of the security policy this rule belongs to.


    description String
    An optional description of this resource. Provide this property when you create the resource.
    match RegionSecurityPolicyRuleMatch
    A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding 'action' is enforced. Structure is documented below.
    networkMatch RegionSecurityPolicyRuleNetworkMatch
    A match condition that incoming packets are evaluated against for CLOUD_ARMOR_NETWORK security policies. If it matches, the corresponding 'action' is enforced. The match criteria for a rule consists of built-in match fields (like 'srcIpRanges') and potentially multiple user-defined match fields ('userDefinedFields'). Field values may be extracted directly from the packet or derived from it (e.g. 'srcRegionCodes'). Some fields may not be present in every packet (e.g. 'srcPorts'). A user-defined field is only present if the base header is found in the packet and the entire field is in bounds. Each match field may specify which values can match it, listing one or more ranges, prefixes, or exact values that are considered a match for the field. A field value must be present in order to match a specified match field. If no match values are specified for a match field, then any field value is considered to match it, and it's not required to be present. For strings specifying '*' is also equivalent to match all. For a packet to match a rule, all specified match fields must match the corresponding field values derived from the packet. Example: networkMatch: srcIpRanges: - "192.0.2.0/24" - "198.51.100.0/24" userDefinedFields: - name: "ipv4_fragment_offset" values: - "1-0x1fff" The above match condition matches packets with a source IP in 192.0.2.0/24 or 198.51.100.0/24 and a user-defined field named "ipv4_fragment_offset" with a value between 1 and 0x1fff inclusive Structure is documented below.
    preview Boolean
    If set to true, the specified action is not enforced.
    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 perform when the rule is matched. The following are the valid actions:

    • allow: allow access to target.
    • deny(STATUS): deny access to target, returns the HTTP response code specified. Valid values for STATUS are 403, 404, and 502.
    • rate_based_ban: limit client traffic to the configured threshold and ban the client if the traffic exceeds the threshold. Configure parameters for this action in RateLimitOptions. Requires rateLimitOptions to be set.
    • redirect: redirect to a different target. This can either be an internal reCAPTCHA redirect, or an external URL-based redirect via a 302 response. Parameters for this action can be configured via redirectOptions. This action is only supported in Global Security Policies of type CLOUD_ARMOR.
    • throttle: limit client traffic to the configured threshold. Configure parameters for this action in rateLimitOptions. Requires rateLimitOptions to be set for this.
    priority number
    An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest priority.
    region string
    The Region in which the created Region Security Policy rule should reside.
    securityPolicy string
    The name of the security policy this rule belongs to.


    description string
    An optional description of this resource. Provide this property when you create the resource.
    match RegionSecurityPolicyRuleMatch
    A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding 'action' is enforced. Structure is documented below.
    networkMatch RegionSecurityPolicyRuleNetworkMatch
    A match condition that incoming packets are evaluated against for CLOUD_ARMOR_NETWORK security policies. If it matches, the corresponding 'action' is enforced. The match criteria for a rule consists of built-in match fields (like 'srcIpRanges') and potentially multiple user-defined match fields ('userDefinedFields'). Field values may be extracted directly from the packet or derived from it (e.g. 'srcRegionCodes'). Some fields may not be present in every packet (e.g. 'srcPorts'). A user-defined field is only present if the base header is found in the packet and the entire field is in bounds. Each match field may specify which values can match it, listing one or more ranges, prefixes, or exact values that are considered a match for the field. A field value must be present in order to match a specified match field. If no match values are specified for a match field, then any field value is considered to match it, and it's not required to be present. For strings specifying '*' is also equivalent to match all. For a packet to match a rule, all specified match fields must match the corresponding field values derived from the packet. Example: networkMatch: srcIpRanges: - "192.0.2.0/24" - "198.51.100.0/24" userDefinedFields: - name: "ipv4_fragment_offset" values: - "1-0x1fff" The above match condition matches packets with a source IP in 192.0.2.0/24 or 198.51.100.0/24 and a user-defined field named "ipv4_fragment_offset" with a value between 1 and 0x1fff inclusive Structure is documented below.
    preview boolean
    If set to true, the specified action is not enforced.
    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 perform when the rule is matched. The following are the valid actions:

    • allow: allow access to target.
    • deny(STATUS): deny access to target, returns the HTTP response code specified. Valid values for STATUS are 403, 404, and 502.
    • rate_based_ban: limit client traffic to the configured threshold and ban the client if the traffic exceeds the threshold. Configure parameters for this action in RateLimitOptions. Requires rateLimitOptions to be set.
    • redirect: redirect to a different target. This can either be an internal reCAPTCHA redirect, or an external URL-based redirect via a 302 response. Parameters for this action can be configured via redirectOptions. This action is only supported in Global Security Policies of type CLOUD_ARMOR.
    • throttle: limit client traffic to the configured threshold. Configure parameters for this action in rateLimitOptions. Requires rateLimitOptions to be set for this.
    priority int
    An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest priority.
    region str
    The Region in which the created Region Security Policy rule should reside.
    security_policy str
    The name of the security policy this rule belongs to.


    description str
    An optional description of this resource. Provide this property when you create the resource.
    match RegionSecurityPolicyRuleMatchArgs
    A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding 'action' is enforced. Structure is documented below.
    network_match RegionSecurityPolicyRuleNetworkMatchArgs
    A match condition that incoming packets are evaluated against for CLOUD_ARMOR_NETWORK security policies. If it matches, the corresponding 'action' is enforced. The match criteria for a rule consists of built-in match fields (like 'srcIpRanges') and potentially multiple user-defined match fields ('userDefinedFields'). Field values may be extracted directly from the packet or derived from it (e.g. 'srcRegionCodes'). Some fields may not be present in every packet (e.g. 'srcPorts'). A user-defined field is only present if the base header is found in the packet and the entire field is in bounds. Each match field may specify which values can match it, listing one or more ranges, prefixes, or exact values that are considered a match for the field. A field value must be present in order to match a specified match field. If no match values are specified for a match field, then any field value is considered to match it, and it's not required to be present. For strings specifying '*' is also equivalent to match all. For a packet to match a rule, all specified match fields must match the corresponding field values derived from the packet. Example: networkMatch: srcIpRanges: - "192.0.2.0/24" - "198.51.100.0/24" userDefinedFields: - name: "ipv4_fragment_offset" values: - "1-0x1fff" The above match condition matches packets with a source IP in 192.0.2.0/24 or 198.51.100.0/24 and a user-defined field named "ipv4_fragment_offset" with a value between 1 and 0x1fff inclusive Structure is documented below.
    preview bool
    If set to true, the specified action is not enforced.
    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 perform when the rule is matched. The following are the valid actions:

    • allow: allow access to target.
    • deny(STATUS): deny access to target, returns the HTTP response code specified. Valid values for STATUS are 403, 404, and 502.
    • rate_based_ban: limit client traffic to the configured threshold and ban the client if the traffic exceeds the threshold. Configure parameters for this action in RateLimitOptions. Requires rateLimitOptions to be set.
    • redirect: redirect to a different target. This can either be an internal reCAPTCHA redirect, or an external URL-based redirect via a 302 response. Parameters for this action can be configured via redirectOptions. This action is only supported in Global Security Policies of type CLOUD_ARMOR.
    • throttle: limit client traffic to the configured threshold. Configure parameters for this action in rateLimitOptions. Requires rateLimitOptions to be set for this.
    priority Number
    An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest priority.
    region String
    The Region in which the created Region Security Policy rule should reside.
    securityPolicy String
    The name of the security policy this rule belongs to.


    description String
    An optional description of this resource. Provide this property when you create the resource.
    match Property Map
    A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding 'action' is enforced. Structure is documented below.
    networkMatch Property Map
    A match condition that incoming packets are evaluated against for CLOUD_ARMOR_NETWORK security policies. If it matches, the corresponding 'action' is enforced. The match criteria for a rule consists of built-in match fields (like 'srcIpRanges') and potentially multiple user-defined match fields ('userDefinedFields'). Field values may be extracted directly from the packet or derived from it (e.g. 'srcRegionCodes'). Some fields may not be present in every packet (e.g. 'srcPorts'). A user-defined field is only present if the base header is found in the packet and the entire field is in bounds. Each match field may specify which values can match it, listing one or more ranges, prefixes, or exact values that are considered a match for the field. A field value must be present in order to match a specified match field. If no match values are specified for a match field, then any field value is considered to match it, and it's not required to be present. For strings specifying '*' is also equivalent to match all. For a packet to match a rule, all specified match fields must match the corresponding field values derived from the packet. Example: networkMatch: srcIpRanges: - "192.0.2.0/24" - "198.51.100.0/24" userDefinedFields: - name: "ipv4_fragment_offset" values: - "1-0x1fff" The above match condition matches packets with a source IP in 192.0.2.0/24 or 198.51.100.0/24 and a user-defined field named "ipv4_fragment_offset" with a value between 1 and 0x1fff inclusive Structure is documented below.
    preview Boolean
    If set to true, the specified action is not enforced.
    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 RegionSecurityPolicyRule 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 RegionSecurityPolicyRule Resource

    Get an existing RegionSecurityPolicyRule 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?: RegionSecurityPolicyRuleState, opts?: CustomResourceOptions): RegionSecurityPolicyRule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            action: Optional[str] = None,
            description: Optional[str] = None,
            match: Optional[RegionSecurityPolicyRuleMatchArgs] = None,
            network_match: Optional[RegionSecurityPolicyRuleNetworkMatchArgs] = None,
            preview: Optional[bool] = None,
            priority: Optional[int] = None,
            project: Optional[str] = None,
            region: Optional[str] = None,
            security_policy: Optional[str] = None) -> RegionSecurityPolicyRule
    func GetRegionSecurityPolicyRule(ctx *Context, name string, id IDInput, state *RegionSecurityPolicyRuleState, opts ...ResourceOption) (*RegionSecurityPolicyRule, error)
    public static RegionSecurityPolicyRule Get(string name, Input<string> id, RegionSecurityPolicyRuleState? state, CustomResourceOptions? opts = null)
    public static RegionSecurityPolicyRule get(String name, Output<String> id, RegionSecurityPolicyRuleState 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 perform when the rule is matched. The following are the valid actions:

    • allow: allow access to target.
    • deny(STATUS): deny access to target, returns the HTTP response code specified. Valid values for STATUS are 403, 404, and 502.
    • rate_based_ban: limit client traffic to the configured threshold and ban the client if the traffic exceeds the threshold. Configure parameters for this action in RateLimitOptions. Requires rateLimitOptions to be set.
    • redirect: redirect to a different target. This can either be an internal reCAPTCHA redirect, or an external URL-based redirect via a 302 response. Parameters for this action can be configured via redirectOptions. This action is only supported in Global Security Policies of type CLOUD_ARMOR.
    • throttle: limit client traffic to the configured threshold. Configure parameters for this action in rateLimitOptions. Requires rateLimitOptions to be set for this.
    Description string
    An optional description of this resource. Provide this property when you create the resource.
    Match RegionSecurityPolicyRuleMatch
    A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding 'action' is enforced. Structure is documented below.
    NetworkMatch RegionSecurityPolicyRuleNetworkMatch
    A match condition that incoming packets are evaluated against for CLOUD_ARMOR_NETWORK security policies. If it matches, the corresponding 'action' is enforced. The match criteria for a rule consists of built-in match fields (like 'srcIpRanges') and potentially multiple user-defined match fields ('userDefinedFields'). Field values may be extracted directly from the packet or derived from it (e.g. 'srcRegionCodes'). Some fields may not be present in every packet (e.g. 'srcPorts'). A user-defined field is only present if the base header is found in the packet and the entire field is in bounds. Each match field may specify which values can match it, listing one or more ranges, prefixes, or exact values that are considered a match for the field. A field value must be present in order to match a specified match field. If no match values are specified for a match field, then any field value is considered to match it, and it's not required to be present. For strings specifying '*' is also equivalent to match all. For a packet to match a rule, all specified match fields must match the corresponding field values derived from the packet. Example: networkMatch: srcIpRanges: - "192.0.2.0/24" - "198.51.100.0/24" userDefinedFields: - name: "ipv4_fragment_offset" values: - "1-0x1fff" The above match condition matches packets with a source IP in 192.0.2.0/24 or 198.51.100.0/24 and a user-defined field named "ipv4_fragment_offset" with a value between 1 and 0x1fff inclusive Structure is documented below.
    Preview bool
    If set to true, the specified action is not enforced.
    Priority int
    An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest priority.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Region string
    The Region in which the created Region Security Policy rule should reside.
    SecurityPolicy string
    The name of the security policy this rule belongs to.


    Action string
    The Action to perform when the rule is matched. The following are the valid actions:

    • allow: allow access to target.
    • deny(STATUS): deny access to target, returns the HTTP response code specified. Valid values for STATUS are 403, 404, and 502.
    • rate_based_ban: limit client traffic to the configured threshold and ban the client if the traffic exceeds the threshold. Configure parameters for this action in RateLimitOptions. Requires rateLimitOptions to be set.
    • redirect: redirect to a different target. This can either be an internal reCAPTCHA redirect, or an external URL-based redirect via a 302 response. Parameters for this action can be configured via redirectOptions. This action is only supported in Global Security Policies of type CLOUD_ARMOR.
    • throttle: limit client traffic to the configured threshold. Configure parameters for this action in rateLimitOptions. Requires rateLimitOptions to be set for this.
    Description string
    An optional description of this resource. Provide this property when you create the resource.
    Match RegionSecurityPolicyRuleMatchArgs
    A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding 'action' is enforced. Structure is documented below.
    NetworkMatch RegionSecurityPolicyRuleNetworkMatchArgs
    A match condition that incoming packets are evaluated against for CLOUD_ARMOR_NETWORK security policies. If it matches, the corresponding 'action' is enforced. The match criteria for a rule consists of built-in match fields (like 'srcIpRanges') and potentially multiple user-defined match fields ('userDefinedFields'). Field values may be extracted directly from the packet or derived from it (e.g. 'srcRegionCodes'). Some fields may not be present in every packet (e.g. 'srcPorts'). A user-defined field is only present if the base header is found in the packet and the entire field is in bounds. Each match field may specify which values can match it, listing one or more ranges, prefixes, or exact values that are considered a match for the field. A field value must be present in order to match a specified match field. If no match values are specified for a match field, then any field value is considered to match it, and it's not required to be present. For strings specifying '*' is also equivalent to match all. For a packet to match a rule, all specified match fields must match the corresponding field values derived from the packet. Example: networkMatch: srcIpRanges: - "192.0.2.0/24" - "198.51.100.0/24" userDefinedFields: - name: "ipv4_fragment_offset" values: - "1-0x1fff" The above match condition matches packets with a source IP in 192.0.2.0/24 or 198.51.100.0/24 and a user-defined field named "ipv4_fragment_offset" with a value between 1 and 0x1fff inclusive Structure is documented below.
    Preview bool
    If set to true, the specified action is not enforced.
    Priority int
    An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest priority.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Region string
    The Region in which the created Region Security Policy rule should reside.
    SecurityPolicy string
    The name of the security policy this rule belongs to.


    action String
    The Action to perform when the rule is matched. The following are the valid actions:

    • allow: allow access to target.
    • deny(STATUS): deny access to target, returns the HTTP response code specified. Valid values for STATUS are 403, 404, and 502.
    • rate_based_ban: limit client traffic to the configured threshold and ban the client if the traffic exceeds the threshold. Configure parameters for this action in RateLimitOptions. Requires rateLimitOptions to be set.
    • redirect: redirect to a different target. This can either be an internal reCAPTCHA redirect, or an external URL-based redirect via a 302 response. Parameters for this action can be configured via redirectOptions. This action is only supported in Global Security Policies of type CLOUD_ARMOR.
    • throttle: limit client traffic to the configured threshold. Configure parameters for this action in rateLimitOptions. Requires rateLimitOptions to be set for this.
    description String
    An optional description of this resource. Provide this property when you create the resource.
    match RegionSecurityPolicyRuleMatch
    A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding 'action' is enforced. Structure is documented below.
    networkMatch RegionSecurityPolicyRuleNetworkMatch
    A match condition that incoming packets are evaluated against for CLOUD_ARMOR_NETWORK security policies. If it matches, the corresponding 'action' is enforced. The match criteria for a rule consists of built-in match fields (like 'srcIpRanges') and potentially multiple user-defined match fields ('userDefinedFields'). Field values may be extracted directly from the packet or derived from it (e.g. 'srcRegionCodes'). Some fields may not be present in every packet (e.g. 'srcPorts'). A user-defined field is only present if the base header is found in the packet and the entire field is in bounds. Each match field may specify which values can match it, listing one or more ranges, prefixes, or exact values that are considered a match for the field. A field value must be present in order to match a specified match field. If no match values are specified for a match field, then any field value is considered to match it, and it's not required to be present. For strings specifying '*' is also equivalent to match all. For a packet to match a rule, all specified match fields must match the corresponding field values derived from the packet. Example: networkMatch: srcIpRanges: - "192.0.2.0/24" - "198.51.100.0/24" userDefinedFields: - name: "ipv4_fragment_offset" values: - "1-0x1fff" The above match condition matches packets with a source IP in 192.0.2.0/24 or 198.51.100.0/24 and a user-defined field named "ipv4_fragment_offset" with a value between 1 and 0x1fff inclusive Structure is documented below.
    preview Boolean
    If set to true, the specified action is not enforced.
    priority Integer
    An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest priority.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    region String
    The Region in which the created Region Security Policy rule should reside.
    securityPolicy String
    The name of the security policy this rule belongs to.


    action string
    The Action to perform when the rule is matched. The following are the valid actions:

    • allow: allow access to target.
    • deny(STATUS): deny access to target, returns the HTTP response code specified. Valid values for STATUS are 403, 404, and 502.
    • rate_based_ban: limit client traffic to the configured threshold and ban the client if the traffic exceeds the threshold. Configure parameters for this action in RateLimitOptions. Requires rateLimitOptions to be set.
    • redirect: redirect to a different target. This can either be an internal reCAPTCHA redirect, or an external URL-based redirect via a 302 response. Parameters for this action can be configured via redirectOptions. This action is only supported in Global Security Policies of type CLOUD_ARMOR.
    • throttle: limit client traffic to the configured threshold. Configure parameters for this action in rateLimitOptions. Requires rateLimitOptions to be set for this.
    description string
    An optional description of this resource. Provide this property when you create the resource.
    match RegionSecurityPolicyRuleMatch
    A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding 'action' is enforced. Structure is documented below.
    networkMatch RegionSecurityPolicyRuleNetworkMatch
    A match condition that incoming packets are evaluated against for CLOUD_ARMOR_NETWORK security policies. If it matches, the corresponding 'action' is enforced. The match criteria for a rule consists of built-in match fields (like 'srcIpRanges') and potentially multiple user-defined match fields ('userDefinedFields'). Field values may be extracted directly from the packet or derived from it (e.g. 'srcRegionCodes'). Some fields may not be present in every packet (e.g. 'srcPorts'). A user-defined field is only present if the base header is found in the packet and the entire field is in bounds. Each match field may specify which values can match it, listing one or more ranges, prefixes, or exact values that are considered a match for the field. A field value must be present in order to match a specified match field. If no match values are specified for a match field, then any field value is considered to match it, and it's not required to be present. For strings specifying '*' is also equivalent to match all. For a packet to match a rule, all specified match fields must match the corresponding field values derived from the packet. Example: networkMatch: srcIpRanges: - "192.0.2.0/24" - "198.51.100.0/24" userDefinedFields: - name: "ipv4_fragment_offset" values: - "1-0x1fff" The above match condition matches packets with a source IP in 192.0.2.0/24 or 198.51.100.0/24 and a user-defined field named "ipv4_fragment_offset" with a value between 1 and 0x1fff inclusive Structure is documented below.
    preview boolean
    If set to true, the specified action is not enforced.
    priority number
    An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest priority.
    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    region string
    The Region in which the created Region Security Policy rule should reside.
    securityPolicy string
    The name of the security policy this rule belongs to.


    action str
    The Action to perform when the rule is matched. The following are the valid actions:

    • allow: allow access to target.
    • deny(STATUS): deny access to target, returns the HTTP response code specified. Valid values for STATUS are 403, 404, and 502.
    • rate_based_ban: limit client traffic to the configured threshold and ban the client if the traffic exceeds the threshold. Configure parameters for this action in RateLimitOptions. Requires rateLimitOptions to be set.
    • redirect: redirect to a different target. This can either be an internal reCAPTCHA redirect, or an external URL-based redirect via a 302 response. Parameters for this action can be configured via redirectOptions. This action is only supported in Global Security Policies of type CLOUD_ARMOR.
    • throttle: limit client traffic to the configured threshold. Configure parameters for this action in rateLimitOptions. Requires rateLimitOptions to be set for this.
    description str
    An optional description of this resource. Provide this property when you create the resource.
    match RegionSecurityPolicyRuleMatchArgs
    A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding 'action' is enforced. Structure is documented below.
    network_match RegionSecurityPolicyRuleNetworkMatchArgs
    A match condition that incoming packets are evaluated against for CLOUD_ARMOR_NETWORK security policies. If it matches, the corresponding 'action' is enforced. The match criteria for a rule consists of built-in match fields (like 'srcIpRanges') and potentially multiple user-defined match fields ('userDefinedFields'). Field values may be extracted directly from the packet or derived from it (e.g. 'srcRegionCodes'). Some fields may not be present in every packet (e.g. 'srcPorts'). A user-defined field is only present if the base header is found in the packet and the entire field is in bounds. Each match field may specify which values can match it, listing one or more ranges, prefixes, or exact values that are considered a match for the field. A field value must be present in order to match a specified match field. If no match values are specified for a match field, then any field value is considered to match it, and it's not required to be present. For strings specifying '*' is also equivalent to match all. For a packet to match a rule, all specified match fields must match the corresponding field values derived from the packet. Example: networkMatch: srcIpRanges: - "192.0.2.0/24" - "198.51.100.0/24" userDefinedFields: - name: "ipv4_fragment_offset" values: - "1-0x1fff" The above match condition matches packets with a source IP in 192.0.2.0/24 or 198.51.100.0/24 and a user-defined field named "ipv4_fragment_offset" with a value between 1 and 0x1fff inclusive Structure is documented below.
    preview bool
    If set to true, the specified action is not enforced.
    priority int
    An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest priority.
    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    region str
    The Region in which the created Region Security Policy rule should reside.
    security_policy str
    The name of the security policy this rule belongs to.


    action String
    The Action to perform when the rule is matched. The following are the valid actions:

    • allow: allow access to target.
    • deny(STATUS): deny access to target, returns the HTTP response code specified. Valid values for STATUS are 403, 404, and 502.
    • rate_based_ban: limit client traffic to the configured threshold and ban the client if the traffic exceeds the threshold. Configure parameters for this action in RateLimitOptions. Requires rateLimitOptions to be set.
    • redirect: redirect to a different target. This can either be an internal reCAPTCHA redirect, or an external URL-based redirect via a 302 response. Parameters for this action can be configured via redirectOptions. This action is only supported in Global Security Policies of type CLOUD_ARMOR.
    • throttle: limit client traffic to the configured threshold. Configure parameters for this action in rateLimitOptions. Requires rateLimitOptions to be set for this.
    description String
    An optional description of this resource. Provide this property when you create the resource.
    match Property Map
    A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding 'action' is enforced. Structure is documented below.
    networkMatch Property Map
    A match condition that incoming packets are evaluated against for CLOUD_ARMOR_NETWORK security policies. If it matches, the corresponding 'action' is enforced. The match criteria for a rule consists of built-in match fields (like 'srcIpRanges') and potentially multiple user-defined match fields ('userDefinedFields'). Field values may be extracted directly from the packet or derived from it (e.g. 'srcRegionCodes'). Some fields may not be present in every packet (e.g. 'srcPorts'). A user-defined field is only present if the base header is found in the packet and the entire field is in bounds. Each match field may specify which values can match it, listing one or more ranges, prefixes, or exact values that are considered a match for the field. A field value must be present in order to match a specified match field. If no match values are specified for a match field, then any field value is considered to match it, and it's not required to be present. For strings specifying '*' is also equivalent to match all. For a packet to match a rule, all specified match fields must match the corresponding field values derived from the packet. Example: networkMatch: srcIpRanges: - "192.0.2.0/24" - "198.51.100.0/24" userDefinedFields: - name: "ipv4_fragment_offset" values: - "1-0x1fff" The above match condition matches packets with a source IP in 192.0.2.0/24 or 198.51.100.0/24 and a user-defined field named "ipv4_fragment_offset" with a value between 1 and 0x1fff inclusive Structure is documented below.
    preview Boolean
    If set to true, the specified action is not enforced.
    priority Number
    An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest priority.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    region String
    The Region in which the created Region Security Policy rule should reside.
    securityPolicy String
    The name of the security policy this rule belongs to.


    Supporting Types

    RegionSecurityPolicyRuleMatch, RegionSecurityPolicyRuleMatchArgs

    Config RegionSecurityPolicyRuleMatchConfig
    The configuration options available when specifying versionedExpr. This field must be specified if versionedExpr is specified and cannot be specified if versionedExpr is not specified. Structure is documented below.
    VersionedExpr string
    Preconfigured versioned expression. If this field is specified, config must also be specified. Available preconfigured expressions along with their requirements are: SRC_IPS_V1 - must specify the corresponding srcIpRange field in config. Possible values are: SRC_IPS_V1.
    Config RegionSecurityPolicyRuleMatchConfig
    The configuration options available when specifying versionedExpr. This field must be specified if versionedExpr is specified and cannot be specified if versionedExpr is not specified. Structure is documented below.
    VersionedExpr string
    Preconfigured versioned expression. If this field is specified, config must also be specified. Available preconfigured expressions along with their requirements are: SRC_IPS_V1 - must specify the corresponding srcIpRange field in config. Possible values are: SRC_IPS_V1.
    config RegionSecurityPolicyRuleMatchConfig
    The configuration options available when specifying versionedExpr. This field must be specified if versionedExpr is specified and cannot be specified if versionedExpr is not specified. Structure is documented below.
    versionedExpr String
    Preconfigured versioned expression. If this field is specified, config must also be specified. Available preconfigured expressions along with their requirements are: SRC_IPS_V1 - must specify the corresponding srcIpRange field in config. Possible values are: SRC_IPS_V1.
    config RegionSecurityPolicyRuleMatchConfig
    The configuration options available when specifying versionedExpr. This field must be specified if versionedExpr is specified and cannot be specified if versionedExpr is not specified. Structure is documented below.
    versionedExpr string
    Preconfigured versioned expression. If this field is specified, config must also be specified. Available preconfigured expressions along with their requirements are: SRC_IPS_V1 - must specify the corresponding srcIpRange field in config. Possible values are: SRC_IPS_V1.
    config RegionSecurityPolicyRuleMatchConfig
    The configuration options available when specifying versionedExpr. This field must be specified if versionedExpr is specified and cannot be specified if versionedExpr is not specified. Structure is documented below.
    versioned_expr str
    Preconfigured versioned expression. If this field is specified, config must also be specified. Available preconfigured expressions along with their requirements are: SRC_IPS_V1 - must specify the corresponding srcIpRange field in config. Possible values are: SRC_IPS_V1.
    config Property Map
    The configuration options available when specifying versionedExpr. This field must be specified if versionedExpr is specified and cannot be specified if versionedExpr is not specified. Structure is documented below.
    versionedExpr String
    Preconfigured versioned expression. If this field is specified, config must also be specified. Available preconfigured expressions along with their requirements are: SRC_IPS_V1 - must specify the corresponding srcIpRange field in config. Possible values are: SRC_IPS_V1.

    RegionSecurityPolicyRuleMatchConfig, RegionSecurityPolicyRuleMatchConfigArgs

    SrcIpRanges List<string>
    CIDR IP address range. Maximum number of srcIpRanges allowed is 10.
    SrcIpRanges []string
    CIDR IP address range. Maximum number of srcIpRanges allowed is 10.
    srcIpRanges List<String>
    CIDR IP address range. Maximum number of srcIpRanges allowed is 10.
    srcIpRanges string[]
    CIDR IP address range. Maximum number of srcIpRanges allowed is 10.
    src_ip_ranges Sequence[str]
    CIDR IP address range. Maximum number of srcIpRanges allowed is 10.
    srcIpRanges List<String>
    CIDR IP address range. Maximum number of srcIpRanges allowed is 10.

    RegionSecurityPolicyRuleNetworkMatch, RegionSecurityPolicyRuleNetworkMatchArgs

    DestIpRanges List<string>
    Destination IPv4/IPv6 addresses or CIDR prefixes, in standard text format.
    DestPorts List<string>
    Destination port numbers for TCP/UDP/SCTP. Each element can be a 16-bit unsigned decimal number (e.g. "80") or range (e.g. "0-1023").
    IpProtocols List<string>
    IPv4 protocol / IPv6 next header (after extension headers). Each element can be an 8-bit unsigned decimal number (e.g. "6"), range (e.g. "253-254"), or one of the following protocol names: "tcp", "udp", "icmp", "esp", "ah", "ipip", or "sctp".
    SrcAsns List<int>
    BGP Autonomous System Number associated with the source IP address.
    SrcIpRanges List<string>
    Source IPv4/IPv6 addresses or CIDR prefixes, in standard text format.
    SrcPorts List<string>
    Source port numbers for TCP/UDP/SCTP. Each element can be a 16-bit unsigned decimal number (e.g. "80") or range (e.g. "0-1023").
    SrcRegionCodes List<string>
    Two-letter ISO 3166-1 alpha-2 country code associated with the source IP address.
    UserDefinedFields List<RegionSecurityPolicyRuleNetworkMatchUserDefinedField>
    User-defined fields. Each element names a defined field and lists the matching values for that field. Structure is documented below.
    DestIpRanges []string
    Destination IPv4/IPv6 addresses or CIDR prefixes, in standard text format.
    DestPorts []string
    Destination port numbers for TCP/UDP/SCTP. Each element can be a 16-bit unsigned decimal number (e.g. "80") or range (e.g. "0-1023").
    IpProtocols []string
    IPv4 protocol / IPv6 next header (after extension headers). Each element can be an 8-bit unsigned decimal number (e.g. "6"), range (e.g. "253-254"), or one of the following protocol names: "tcp", "udp", "icmp", "esp", "ah", "ipip", or "sctp".
    SrcAsns []int
    BGP Autonomous System Number associated with the source IP address.
    SrcIpRanges []string
    Source IPv4/IPv6 addresses or CIDR prefixes, in standard text format.
    SrcPorts []string
    Source port numbers for TCP/UDP/SCTP. Each element can be a 16-bit unsigned decimal number (e.g. "80") or range (e.g. "0-1023").
    SrcRegionCodes []string
    Two-letter ISO 3166-1 alpha-2 country code associated with the source IP address.
    UserDefinedFields []RegionSecurityPolicyRuleNetworkMatchUserDefinedField
    User-defined fields. Each element names a defined field and lists the matching values for that field. Structure is documented below.
    destIpRanges List<String>
    Destination IPv4/IPv6 addresses or CIDR prefixes, in standard text format.
    destPorts List<String>
    Destination port numbers for TCP/UDP/SCTP. Each element can be a 16-bit unsigned decimal number (e.g. "80") or range (e.g. "0-1023").
    ipProtocols List<String>
    IPv4 protocol / IPv6 next header (after extension headers). Each element can be an 8-bit unsigned decimal number (e.g. "6"), range (e.g. "253-254"), or one of the following protocol names: "tcp", "udp", "icmp", "esp", "ah", "ipip", or "sctp".
    srcAsns List<Integer>
    BGP Autonomous System Number associated with the source IP address.
    srcIpRanges List<String>
    Source IPv4/IPv6 addresses or CIDR prefixes, in standard text format.
    srcPorts List<String>
    Source port numbers for TCP/UDP/SCTP. Each element can be a 16-bit unsigned decimal number (e.g. "80") or range (e.g. "0-1023").
    srcRegionCodes List<String>
    Two-letter ISO 3166-1 alpha-2 country code associated with the source IP address.
    userDefinedFields List<RegionSecurityPolicyRuleNetworkMatchUserDefinedField>
    User-defined fields. Each element names a defined field and lists the matching values for that field. Structure is documented below.
    destIpRanges string[]
    Destination IPv4/IPv6 addresses or CIDR prefixes, in standard text format.
    destPorts string[]
    Destination port numbers for TCP/UDP/SCTP. Each element can be a 16-bit unsigned decimal number (e.g. "80") or range (e.g. "0-1023").
    ipProtocols string[]
    IPv4 protocol / IPv6 next header (after extension headers). Each element can be an 8-bit unsigned decimal number (e.g. "6"), range (e.g. "253-254"), or one of the following protocol names: "tcp", "udp", "icmp", "esp", "ah", "ipip", or "sctp".
    srcAsns number[]
    BGP Autonomous System Number associated with the source IP address.
    srcIpRanges string[]
    Source IPv4/IPv6 addresses or CIDR prefixes, in standard text format.
    srcPorts string[]
    Source port numbers for TCP/UDP/SCTP. Each element can be a 16-bit unsigned decimal number (e.g. "80") or range (e.g. "0-1023").
    srcRegionCodes string[]
    Two-letter ISO 3166-1 alpha-2 country code associated with the source IP address.
    userDefinedFields RegionSecurityPolicyRuleNetworkMatchUserDefinedField[]
    User-defined fields. Each element names a defined field and lists the matching values for that field. Structure is documented below.
    dest_ip_ranges Sequence[str]
    Destination IPv4/IPv6 addresses or CIDR prefixes, in standard text format.
    dest_ports Sequence[str]
    Destination port numbers for TCP/UDP/SCTP. Each element can be a 16-bit unsigned decimal number (e.g. "80") or range (e.g. "0-1023").
    ip_protocols Sequence[str]
    IPv4 protocol / IPv6 next header (after extension headers). Each element can be an 8-bit unsigned decimal number (e.g. "6"), range (e.g. "253-254"), or one of the following protocol names: "tcp", "udp", "icmp", "esp", "ah", "ipip", or "sctp".
    src_asns Sequence[int]
    BGP Autonomous System Number associated with the source IP address.
    src_ip_ranges Sequence[str]
    Source IPv4/IPv6 addresses or CIDR prefixes, in standard text format.
    src_ports Sequence[str]
    Source port numbers for TCP/UDP/SCTP. Each element can be a 16-bit unsigned decimal number (e.g. "80") or range (e.g. "0-1023").
    src_region_codes Sequence[str]
    Two-letter ISO 3166-1 alpha-2 country code associated with the source IP address.
    user_defined_fields Sequence[RegionSecurityPolicyRuleNetworkMatchUserDefinedField]
    User-defined fields. Each element names a defined field and lists the matching values for that field. Structure is documented below.
    destIpRanges List<String>
    Destination IPv4/IPv6 addresses or CIDR prefixes, in standard text format.
    destPorts List<String>
    Destination port numbers for TCP/UDP/SCTP. Each element can be a 16-bit unsigned decimal number (e.g. "80") or range (e.g. "0-1023").
    ipProtocols List<String>
    IPv4 protocol / IPv6 next header (after extension headers). Each element can be an 8-bit unsigned decimal number (e.g. "6"), range (e.g. "253-254"), or one of the following protocol names: "tcp", "udp", "icmp", "esp", "ah", "ipip", or "sctp".
    srcAsns List<Number>
    BGP Autonomous System Number associated with the source IP address.
    srcIpRanges List<String>
    Source IPv4/IPv6 addresses or CIDR prefixes, in standard text format.
    srcPorts List<String>
    Source port numbers for TCP/UDP/SCTP. Each element can be a 16-bit unsigned decimal number (e.g. "80") or range (e.g. "0-1023").
    srcRegionCodes List<String>
    Two-letter ISO 3166-1 alpha-2 country code associated with the source IP address.
    userDefinedFields List<Property Map>
    User-defined fields. Each element names a defined field and lists the matching values for that field. Structure is documented below.

    RegionSecurityPolicyRuleNetworkMatchUserDefinedField, RegionSecurityPolicyRuleNetworkMatchUserDefinedFieldArgs

    Name string
    Name of the user-defined field, as given in the definition.
    Values List<string>
    Matching values of the field. Each element can be a 32-bit unsigned decimal or hexadecimal (starting with "0x") number (e.g. "64") or range (e.g. "0x400-0x7ff").
    Name string
    Name of the user-defined field, as given in the definition.
    Values []string
    Matching values of the field. Each element can be a 32-bit unsigned decimal or hexadecimal (starting with "0x") number (e.g. "64") or range (e.g. "0x400-0x7ff").
    name String
    Name of the user-defined field, as given in the definition.
    values List<String>
    Matching values of the field. Each element can be a 32-bit unsigned decimal or hexadecimal (starting with "0x") number (e.g. "64") or range (e.g. "0x400-0x7ff").
    name string
    Name of the user-defined field, as given in the definition.
    values string[]
    Matching values of the field. Each element can be a 32-bit unsigned decimal or hexadecimal (starting with "0x") number (e.g. "64") or range (e.g. "0x400-0x7ff").
    name str
    Name of the user-defined field, as given in the definition.
    values Sequence[str]
    Matching values of the field. Each element can be a 32-bit unsigned decimal or hexadecimal (starting with "0x") number (e.g. "64") or range (e.g. "0x400-0x7ff").
    name String
    Name of the user-defined field, as given in the definition.
    values List<String>
    Matching values of the field. Each element can be a 32-bit unsigned decimal or hexadecimal (starting with "0x") number (e.g. "64") or range (e.g. "0x400-0x7ff").

    Import

    RegionSecurityPolicyRule can be imported using any of these accepted formats:

    • projects/{{project}}/regions/{{region}}/securityPolicies/{{security_policy}}/priority/{{priority}}

    • {{project}}/{{region}}/{{security_policy}}/{{priority}}

    • {{region}}/{{security_policy}}/{{priority}}

    • {{security_policy}}/{{priority}}

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

    $ pulumi import gcp:compute/regionSecurityPolicyRule:RegionSecurityPolicyRule default projects/{{project}}/regions/{{region}}/securityPolicies/{{security_policy}}/priority/{{priority}}
    
    $ pulumi import gcp:compute/regionSecurityPolicyRule:RegionSecurityPolicyRule default {{project}}/{{region}}/{{security_policy}}/{{priority}}
    
    $ pulumi import gcp:compute/regionSecurityPolicyRule:RegionSecurityPolicyRule default {{region}}/{{security_policy}}/{{priority}}
    
    $ pulumi import gcp:compute/regionSecurityPolicyRule:RegionSecurityPolicyRule default {{security_policy}}/{{priority}}
    

    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.20.0 published on Wednesday, Apr 24, 2024 by Pulumi