1. Packages
  2. Oracle Cloud Infrastructure
  3. API Docs
  4. Waas
  5. CustomProtectionRule
Oracle Cloud Infrastructure v1.32.0 published on Thursday, Apr 18, 2024 by Pulumi

oci.Waas.CustomProtectionRule

Explore with Pulumi AI

oci logo
Oracle Cloud Infrastructure v1.32.0 published on Thursday, Apr 18, 2024 by Pulumi

    This resource provides the Custom Protection Rule resource in Oracle Cloud Infrastructure Web Application Acceleration and Security service.

    Creates a new custom protection rule in the specified compartment.

    Custom protection rules allow you to create rules in addition to the rulesets provided by the Web Application Firewall service, including rules from ModSecurity. The syntax for custom rules is based on the ModSecurity syntax. For more information about custom protection rules, see Custom Protection Rules.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as oci from "@pulumi/oci";
    
    const testCustomProtectionRule = new oci.waas.CustomProtectionRule("testCustomProtectionRule", {
        compartmentId: _var.compartment_id,
        displayName: _var.custom_protection_rule_display_name,
        template: _var.custom_protection_rule_template,
        definedTags: {
            "Operations.CostCenter": "42",
        },
        description: _var.custom_protection_rule_description,
        freeformTags: {
            Department: "Finance",
        },
    });
    
    import pulumi
    import pulumi_oci as oci
    
    test_custom_protection_rule = oci.waas.CustomProtectionRule("testCustomProtectionRule",
        compartment_id=var["compartment_id"],
        display_name=var["custom_protection_rule_display_name"],
        template=var["custom_protection_rule_template"],
        defined_tags={
            "Operations.CostCenter": "42",
        },
        description=var["custom_protection_rule_description"],
        freeform_tags={
            "Department": "Finance",
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-oci/sdk/go/oci/Waas"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := Waas.NewCustomProtectionRule(ctx, "testCustomProtectionRule", &Waas.CustomProtectionRuleArgs{
    			CompartmentId: pulumi.Any(_var.Compartment_id),
    			DisplayName:   pulumi.Any(_var.Custom_protection_rule_display_name),
    			Template:      pulumi.Any(_var.Custom_protection_rule_template),
    			DefinedTags: pulumi.Map{
    				"Operations.CostCenter": pulumi.Any("42"),
    			},
    			Description: pulumi.Any(_var.Custom_protection_rule_description),
    			FreeformTags: pulumi.Map{
    				"Department": pulumi.Any("Finance"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Oci = Pulumi.Oci;
    
    return await Deployment.RunAsync(() => 
    {
        var testCustomProtectionRule = new Oci.Waas.CustomProtectionRule("testCustomProtectionRule", new()
        {
            CompartmentId = @var.Compartment_id,
            DisplayName = @var.Custom_protection_rule_display_name,
            Template = @var.Custom_protection_rule_template,
            DefinedTags = 
            {
                { "Operations.CostCenter", "42" },
            },
            Description = @var.Custom_protection_rule_description,
            FreeformTags = 
            {
                { "Department", "Finance" },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.oci.Waas.CustomProtectionRule;
    import com.pulumi.oci.Waas.CustomProtectionRuleArgs;
    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 testCustomProtectionRule = new CustomProtectionRule("testCustomProtectionRule", CustomProtectionRuleArgs.builder()        
                .compartmentId(var_.compartment_id())
                .displayName(var_.custom_protection_rule_display_name())
                .template(var_.custom_protection_rule_template())
                .definedTags(Map.of("Operations.CostCenter", "42"))
                .description(var_.custom_protection_rule_description())
                .freeformTags(Map.of("Department", "Finance"))
                .build());
    
        }
    }
    
    resources:
      testCustomProtectionRule:
        type: oci:Waas:CustomProtectionRule
        properties:
          #Required
          compartmentId: ${var.compartment_id}
          displayName: ${var.custom_protection_rule_display_name}
          template: ${var.custom_protection_rule_template}
          #Optional
          definedTags:
            Operations.CostCenter: '42'
          description: ${var.custom_protection_rule_description}
          freeformTags:
            Department: Finance
    

    Create CustomProtectionRule Resource

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

    Constructor syntax

    new CustomProtectionRule(name: string, args: CustomProtectionRuleArgs, opts?: CustomResourceOptions);
    @overload
    def CustomProtectionRule(resource_name: str,
                             args: CustomProtectionRuleArgs,
                             opts: Optional[ResourceOptions] = None)
    
    @overload
    def CustomProtectionRule(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             compartment_id: Optional[str] = None,
                             display_name: Optional[str] = None,
                             template: Optional[str] = None,
                             defined_tags: Optional[Mapping[str, Any]] = None,
                             description: Optional[str] = None,
                             freeform_tags: Optional[Mapping[str, Any]] = None)
    func NewCustomProtectionRule(ctx *Context, name string, args CustomProtectionRuleArgs, opts ...ResourceOption) (*CustomProtectionRule, error)
    public CustomProtectionRule(string name, CustomProtectionRuleArgs args, CustomResourceOptions? opts = null)
    public CustomProtectionRule(String name, CustomProtectionRuleArgs args)
    public CustomProtectionRule(String name, CustomProtectionRuleArgs args, CustomResourceOptions options)
    
    type: oci:Waas:CustomProtectionRule
    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 CustomProtectionRuleArgs
    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 CustomProtectionRuleArgs
    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 CustomProtectionRuleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CustomProtectionRuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CustomProtectionRuleArgs
    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 customProtectionRuleResource = new Oci.Waas.CustomProtectionRule("customProtectionRuleResource", new()
    {
        CompartmentId = "string",
        DisplayName = "string",
        Template = "string",
        DefinedTags = 
        {
            { "string", "any" },
        },
        Description = "string",
        FreeformTags = 
        {
            { "string", "any" },
        },
    });
    
    example, err := Waas.NewCustomProtectionRule(ctx, "customProtectionRuleResource", &Waas.CustomProtectionRuleArgs{
    	CompartmentId: pulumi.String("string"),
    	DisplayName:   pulumi.String("string"),
    	Template:      pulumi.String("string"),
    	DefinedTags: pulumi.Map{
    		"string": pulumi.Any("any"),
    	},
    	Description: pulumi.String("string"),
    	FreeformTags: pulumi.Map{
    		"string": pulumi.Any("any"),
    	},
    })
    
    var customProtectionRuleResource = new CustomProtectionRule("customProtectionRuleResource", CustomProtectionRuleArgs.builder()        
        .compartmentId("string")
        .displayName("string")
        .template("string")
        .definedTags(Map.of("string", "any"))
        .description("string")
        .freeformTags(Map.of("string", "any"))
        .build());
    
    custom_protection_rule_resource = oci.waas.CustomProtectionRule("customProtectionRuleResource",
        compartment_id="string",
        display_name="string",
        template="string",
        defined_tags={
            "string": "any",
        },
        description="string",
        freeform_tags={
            "string": "any",
        })
    
    const customProtectionRuleResource = new oci.waas.CustomProtectionRule("customProtectionRuleResource", {
        compartmentId: "string",
        displayName: "string",
        template: "string",
        definedTags: {
            string: "any",
        },
        description: "string",
        freeformTags: {
            string: "any",
        },
    });
    
    type: oci:Waas:CustomProtectionRule
    properties:
        compartmentId: string
        definedTags:
            string: any
        description: string
        displayName: string
        freeformTags:
            string: any
        template: string
    

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

    CompartmentId string
    (Updatable) The OCID of the compartment in which to create the custom protection rule.
    DisplayName string
    (Updatable) A user-friendly name for the custom protection rule.
    Template string

    (Updatable) The template text of the custom protection rule. All custom protection rules are expressed in ModSecurity Rule Language.

    Additionally, each rule must include two placeholder variables that are updated by the WAF service upon publication of the rule.

    id: {{id_1}} - This field is populated with a unique rule ID generated by the WAF service which identifies a SecRule. More than one SecRule can be defined in the template field of a CreateCustomSecurityRule call. The value of the first SecRule must be id: {{id_1}} and the id field of each subsequent SecRule should increase by one, as shown in the example.

    ctl:ruleEngine={{mode}} - The action to be taken when the criteria of the SecRule are met, either OFF, DETECT or BLOCK. This field is automatically populated with the corresponding value of the action field of the CustomProtectionRuleSetting schema when the WafConfig is updated.

    Example: SecRule REQUEST_COOKIES "regex matching SQL injection - part 1/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 1/2.', \ id: {{id_1}}, \ ctl:ruleEngine={{mode}}, \ deny" SecRule REQUEST_COOKIES "regex matching SQL injection - part 2/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 2/2.', \ id: {{id_2}}, \ ctl:ruleEngine={{mode}}, \ deny"

    The example contains two SecRules each having distinct regex expression to match the Cookie header value during the second input analysis phase.

    For more information about custom protection rules, see Custom Protection Rules.

    For more information about ModSecurity syntax, see Making Rules: The Basic Syntax.

    For more information about ModSecurity's open source WAF rules, see Mod Security's OWASP Core Rule Set documentation.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    DefinedTags Dictionary<string, object>
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    Description string
    (Updatable) A description for the Custom Protection rule.
    FreeformTags Dictionary<string, object>
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    CompartmentId string
    (Updatable) The OCID of the compartment in which to create the custom protection rule.
    DisplayName string
    (Updatable) A user-friendly name for the custom protection rule.
    Template string

    (Updatable) The template text of the custom protection rule. All custom protection rules are expressed in ModSecurity Rule Language.

    Additionally, each rule must include two placeholder variables that are updated by the WAF service upon publication of the rule.

    id: {{id_1}} - This field is populated with a unique rule ID generated by the WAF service which identifies a SecRule. More than one SecRule can be defined in the template field of a CreateCustomSecurityRule call. The value of the first SecRule must be id: {{id_1}} and the id field of each subsequent SecRule should increase by one, as shown in the example.

    ctl:ruleEngine={{mode}} - The action to be taken when the criteria of the SecRule are met, either OFF, DETECT or BLOCK. This field is automatically populated with the corresponding value of the action field of the CustomProtectionRuleSetting schema when the WafConfig is updated.

    Example: SecRule REQUEST_COOKIES "regex matching SQL injection - part 1/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 1/2.', \ id: {{id_1}}, \ ctl:ruleEngine={{mode}}, \ deny" SecRule REQUEST_COOKIES "regex matching SQL injection - part 2/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 2/2.', \ id: {{id_2}}, \ ctl:ruleEngine={{mode}}, \ deny"

    The example contains two SecRules each having distinct regex expression to match the Cookie header value during the second input analysis phase.

    For more information about custom protection rules, see Custom Protection Rules.

    For more information about ModSecurity syntax, see Making Rules: The Basic Syntax.

    For more information about ModSecurity's open source WAF rules, see Mod Security's OWASP Core Rule Set documentation.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    DefinedTags map[string]interface{}
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    Description string
    (Updatable) A description for the Custom Protection rule.
    FreeformTags map[string]interface{}
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    compartmentId String
    (Updatable) The OCID of the compartment in which to create the custom protection rule.
    displayName String
    (Updatable) A user-friendly name for the custom protection rule.
    template String

    (Updatable) The template text of the custom protection rule. All custom protection rules are expressed in ModSecurity Rule Language.

    Additionally, each rule must include two placeholder variables that are updated by the WAF service upon publication of the rule.

    id: {{id_1}} - This field is populated with a unique rule ID generated by the WAF service which identifies a SecRule. More than one SecRule can be defined in the template field of a CreateCustomSecurityRule call. The value of the first SecRule must be id: {{id_1}} and the id field of each subsequent SecRule should increase by one, as shown in the example.

    ctl:ruleEngine={{mode}} - The action to be taken when the criteria of the SecRule are met, either OFF, DETECT or BLOCK. This field is automatically populated with the corresponding value of the action field of the CustomProtectionRuleSetting schema when the WafConfig is updated.

    Example: SecRule REQUEST_COOKIES "regex matching SQL injection - part 1/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 1/2.', \ id: {{id_1}}, \ ctl:ruleEngine={{mode}}, \ deny" SecRule REQUEST_COOKIES "regex matching SQL injection - part 2/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 2/2.', \ id: {{id_2}}, \ ctl:ruleEngine={{mode}}, \ deny"

    The example contains two SecRules each having distinct regex expression to match the Cookie header value during the second input analysis phase.

    For more information about custom protection rules, see Custom Protection Rules.

    For more information about ModSecurity syntax, see Making Rules: The Basic Syntax.

    For more information about ModSecurity's open source WAF rules, see Mod Security's OWASP Core Rule Set documentation.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    definedTags Map<String,Object>
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    description String
    (Updatable) A description for the Custom Protection rule.
    freeformTags Map<String,Object>
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    compartmentId string
    (Updatable) The OCID of the compartment in which to create the custom protection rule.
    displayName string
    (Updatable) A user-friendly name for the custom protection rule.
    template string

    (Updatable) The template text of the custom protection rule. All custom protection rules are expressed in ModSecurity Rule Language.

    Additionally, each rule must include two placeholder variables that are updated by the WAF service upon publication of the rule.

    id: {{id_1}} - This field is populated with a unique rule ID generated by the WAF service which identifies a SecRule. More than one SecRule can be defined in the template field of a CreateCustomSecurityRule call. The value of the first SecRule must be id: {{id_1}} and the id field of each subsequent SecRule should increase by one, as shown in the example.

    ctl:ruleEngine={{mode}} - The action to be taken when the criteria of the SecRule are met, either OFF, DETECT or BLOCK. This field is automatically populated with the corresponding value of the action field of the CustomProtectionRuleSetting schema when the WafConfig is updated.

    Example: SecRule REQUEST_COOKIES "regex matching SQL injection - part 1/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 1/2.', \ id: {{id_1}}, \ ctl:ruleEngine={{mode}}, \ deny" SecRule REQUEST_COOKIES "regex matching SQL injection - part 2/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 2/2.', \ id: {{id_2}}, \ ctl:ruleEngine={{mode}}, \ deny"

    The example contains two SecRules each having distinct regex expression to match the Cookie header value during the second input analysis phase.

    For more information about custom protection rules, see Custom Protection Rules.

    For more information about ModSecurity syntax, see Making Rules: The Basic Syntax.

    For more information about ModSecurity's open source WAF rules, see Mod Security's OWASP Core Rule Set documentation.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    definedTags {[key: string]: any}
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    description string
    (Updatable) A description for the Custom Protection rule.
    freeformTags {[key: string]: any}
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    compartment_id str
    (Updatable) The OCID of the compartment in which to create the custom protection rule.
    display_name str
    (Updatable) A user-friendly name for the custom protection rule.
    template str

    (Updatable) The template text of the custom protection rule. All custom protection rules are expressed in ModSecurity Rule Language.

    Additionally, each rule must include two placeholder variables that are updated by the WAF service upon publication of the rule.

    id: {{id_1}} - This field is populated with a unique rule ID generated by the WAF service which identifies a SecRule. More than one SecRule can be defined in the template field of a CreateCustomSecurityRule call. The value of the first SecRule must be id: {{id_1}} and the id field of each subsequent SecRule should increase by one, as shown in the example.

    ctl:ruleEngine={{mode}} - The action to be taken when the criteria of the SecRule are met, either OFF, DETECT or BLOCK. This field is automatically populated with the corresponding value of the action field of the CustomProtectionRuleSetting schema when the WafConfig is updated.

    Example: SecRule REQUEST_COOKIES "regex matching SQL injection - part 1/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 1/2.', \ id: {{id_1}}, \ ctl:ruleEngine={{mode}}, \ deny" SecRule REQUEST_COOKIES "regex matching SQL injection - part 2/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 2/2.', \ id: {{id_2}}, \ ctl:ruleEngine={{mode}}, \ deny"

    The example contains two SecRules each having distinct regex expression to match the Cookie header value during the second input analysis phase.

    For more information about custom protection rules, see Custom Protection Rules.

    For more information about ModSecurity syntax, see Making Rules: The Basic Syntax.

    For more information about ModSecurity's open source WAF rules, see Mod Security's OWASP Core Rule Set documentation.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    defined_tags Mapping[str, Any]
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    description str
    (Updatable) A description for the Custom Protection rule.
    freeform_tags Mapping[str, Any]
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    compartmentId String
    (Updatable) The OCID of the compartment in which to create the custom protection rule.
    displayName String
    (Updatable) A user-friendly name for the custom protection rule.
    template String

    (Updatable) The template text of the custom protection rule. All custom protection rules are expressed in ModSecurity Rule Language.

    Additionally, each rule must include two placeholder variables that are updated by the WAF service upon publication of the rule.

    id: {{id_1}} - This field is populated with a unique rule ID generated by the WAF service which identifies a SecRule. More than one SecRule can be defined in the template field of a CreateCustomSecurityRule call. The value of the first SecRule must be id: {{id_1}} and the id field of each subsequent SecRule should increase by one, as shown in the example.

    ctl:ruleEngine={{mode}} - The action to be taken when the criteria of the SecRule are met, either OFF, DETECT or BLOCK. This field is automatically populated with the corresponding value of the action field of the CustomProtectionRuleSetting schema when the WafConfig is updated.

    Example: SecRule REQUEST_COOKIES "regex matching SQL injection - part 1/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 1/2.', \ id: {{id_1}}, \ ctl:ruleEngine={{mode}}, \ deny" SecRule REQUEST_COOKIES "regex matching SQL injection - part 2/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 2/2.', \ id: {{id_2}}, \ ctl:ruleEngine={{mode}}, \ deny"

    The example contains two SecRules each having distinct regex expression to match the Cookie header value during the second input analysis phase.

    For more information about custom protection rules, see Custom Protection Rules.

    For more information about ModSecurity syntax, see Making Rules: The Basic Syntax.

    For more information about ModSecurity's open source WAF rules, see Mod Security's OWASP Core Rule Set documentation.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    definedTags Map<Any>
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    description String
    (Updatable) A description for the Custom Protection rule.
    freeformTags Map<Any>
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    ModSecurityRuleIds List<string>
    The auto-generated ID for the custom protection rule. These IDs are referenced in logs.
    State string
    The current lifecycle state of the custom protection rule.
    TimeCreated string
    The date and time the protection rule was created, expressed in RFC 3339 timestamp format.
    Id string
    The provider-assigned unique ID for this managed resource.
    ModSecurityRuleIds []string
    The auto-generated ID for the custom protection rule. These IDs are referenced in logs.
    State string
    The current lifecycle state of the custom protection rule.
    TimeCreated string
    The date and time the protection rule was created, expressed in RFC 3339 timestamp format.
    id String
    The provider-assigned unique ID for this managed resource.
    modSecurityRuleIds List<String>
    The auto-generated ID for the custom protection rule. These IDs are referenced in logs.
    state String
    The current lifecycle state of the custom protection rule.
    timeCreated String
    The date and time the protection rule was created, expressed in RFC 3339 timestamp format.
    id string
    The provider-assigned unique ID for this managed resource.
    modSecurityRuleIds string[]
    The auto-generated ID for the custom protection rule. These IDs are referenced in logs.
    state string
    The current lifecycle state of the custom protection rule.
    timeCreated string
    The date and time the protection rule was created, expressed in RFC 3339 timestamp format.
    id str
    The provider-assigned unique ID for this managed resource.
    mod_security_rule_ids Sequence[str]
    The auto-generated ID for the custom protection rule. These IDs are referenced in logs.
    state str
    The current lifecycle state of the custom protection rule.
    time_created str
    The date and time the protection rule was created, expressed in RFC 3339 timestamp format.
    id String
    The provider-assigned unique ID for this managed resource.
    modSecurityRuleIds List<String>
    The auto-generated ID for the custom protection rule. These IDs are referenced in logs.
    state String
    The current lifecycle state of the custom protection rule.
    timeCreated String
    The date and time the protection rule was created, expressed in RFC 3339 timestamp format.

    Look up Existing CustomProtectionRule Resource

    Get an existing CustomProtectionRule 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?: CustomProtectionRuleState, opts?: CustomResourceOptions): CustomProtectionRule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            compartment_id: Optional[str] = None,
            defined_tags: Optional[Mapping[str, Any]] = None,
            description: Optional[str] = None,
            display_name: Optional[str] = None,
            freeform_tags: Optional[Mapping[str, Any]] = None,
            mod_security_rule_ids: Optional[Sequence[str]] = None,
            state: Optional[str] = None,
            template: Optional[str] = None,
            time_created: Optional[str] = None) -> CustomProtectionRule
    func GetCustomProtectionRule(ctx *Context, name string, id IDInput, state *CustomProtectionRuleState, opts ...ResourceOption) (*CustomProtectionRule, error)
    public static CustomProtectionRule Get(string name, Input<string> id, CustomProtectionRuleState? state, CustomResourceOptions? opts = null)
    public static CustomProtectionRule get(String name, Output<String> id, CustomProtectionRuleState 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:
    CompartmentId string
    (Updatable) The OCID of the compartment in which to create the custom protection rule.
    DefinedTags Dictionary<string, object>
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    Description string
    (Updatable) A description for the Custom Protection rule.
    DisplayName string
    (Updatable) A user-friendly name for the custom protection rule.
    FreeformTags Dictionary<string, object>
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    ModSecurityRuleIds List<string>
    The auto-generated ID for the custom protection rule. These IDs are referenced in logs.
    State string
    The current lifecycle state of the custom protection rule.
    Template string

    (Updatable) The template text of the custom protection rule. All custom protection rules are expressed in ModSecurity Rule Language.

    Additionally, each rule must include two placeholder variables that are updated by the WAF service upon publication of the rule.

    id: {{id_1}} - This field is populated with a unique rule ID generated by the WAF service which identifies a SecRule. More than one SecRule can be defined in the template field of a CreateCustomSecurityRule call. The value of the first SecRule must be id: {{id_1}} and the id field of each subsequent SecRule should increase by one, as shown in the example.

    ctl:ruleEngine={{mode}} - The action to be taken when the criteria of the SecRule are met, either OFF, DETECT or BLOCK. This field is automatically populated with the corresponding value of the action field of the CustomProtectionRuleSetting schema when the WafConfig is updated.

    Example: SecRule REQUEST_COOKIES "regex matching SQL injection - part 1/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 1/2.', \ id: {{id_1}}, \ ctl:ruleEngine={{mode}}, \ deny" SecRule REQUEST_COOKIES "regex matching SQL injection - part 2/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 2/2.', \ id: {{id_2}}, \ ctl:ruleEngine={{mode}}, \ deny"

    The example contains two SecRules each having distinct regex expression to match the Cookie header value during the second input analysis phase.

    For more information about custom protection rules, see Custom Protection Rules.

    For more information about ModSecurity syntax, see Making Rules: The Basic Syntax.

    For more information about ModSecurity's open source WAF rules, see Mod Security's OWASP Core Rule Set documentation.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    TimeCreated string
    The date and time the protection rule was created, expressed in RFC 3339 timestamp format.
    CompartmentId string
    (Updatable) The OCID of the compartment in which to create the custom protection rule.
    DefinedTags map[string]interface{}
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    Description string
    (Updatable) A description for the Custom Protection rule.
    DisplayName string
    (Updatable) A user-friendly name for the custom protection rule.
    FreeformTags map[string]interface{}
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    ModSecurityRuleIds []string
    The auto-generated ID for the custom protection rule. These IDs are referenced in logs.
    State string
    The current lifecycle state of the custom protection rule.
    Template string

    (Updatable) The template text of the custom protection rule. All custom protection rules are expressed in ModSecurity Rule Language.

    Additionally, each rule must include two placeholder variables that are updated by the WAF service upon publication of the rule.

    id: {{id_1}} - This field is populated with a unique rule ID generated by the WAF service which identifies a SecRule. More than one SecRule can be defined in the template field of a CreateCustomSecurityRule call. The value of the first SecRule must be id: {{id_1}} and the id field of each subsequent SecRule should increase by one, as shown in the example.

    ctl:ruleEngine={{mode}} - The action to be taken when the criteria of the SecRule are met, either OFF, DETECT or BLOCK. This field is automatically populated with the corresponding value of the action field of the CustomProtectionRuleSetting schema when the WafConfig is updated.

    Example: SecRule REQUEST_COOKIES "regex matching SQL injection - part 1/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 1/2.', \ id: {{id_1}}, \ ctl:ruleEngine={{mode}}, \ deny" SecRule REQUEST_COOKIES "regex matching SQL injection - part 2/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 2/2.', \ id: {{id_2}}, \ ctl:ruleEngine={{mode}}, \ deny"

    The example contains two SecRules each having distinct regex expression to match the Cookie header value during the second input analysis phase.

    For more information about custom protection rules, see Custom Protection Rules.

    For more information about ModSecurity syntax, see Making Rules: The Basic Syntax.

    For more information about ModSecurity's open source WAF rules, see Mod Security's OWASP Core Rule Set documentation.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    TimeCreated string
    The date and time the protection rule was created, expressed in RFC 3339 timestamp format.
    compartmentId String
    (Updatable) The OCID of the compartment in which to create the custom protection rule.
    definedTags Map<String,Object>
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    description String
    (Updatable) A description for the Custom Protection rule.
    displayName String
    (Updatable) A user-friendly name for the custom protection rule.
    freeformTags Map<String,Object>
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    modSecurityRuleIds List<String>
    The auto-generated ID for the custom protection rule. These IDs are referenced in logs.
    state String
    The current lifecycle state of the custom protection rule.
    template String

    (Updatable) The template text of the custom protection rule. All custom protection rules are expressed in ModSecurity Rule Language.

    Additionally, each rule must include two placeholder variables that are updated by the WAF service upon publication of the rule.

    id: {{id_1}} - This field is populated with a unique rule ID generated by the WAF service which identifies a SecRule. More than one SecRule can be defined in the template field of a CreateCustomSecurityRule call. The value of the first SecRule must be id: {{id_1}} and the id field of each subsequent SecRule should increase by one, as shown in the example.

    ctl:ruleEngine={{mode}} - The action to be taken when the criteria of the SecRule are met, either OFF, DETECT or BLOCK. This field is automatically populated with the corresponding value of the action field of the CustomProtectionRuleSetting schema when the WafConfig is updated.

    Example: SecRule REQUEST_COOKIES "regex matching SQL injection - part 1/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 1/2.', \ id: {{id_1}}, \ ctl:ruleEngine={{mode}}, \ deny" SecRule REQUEST_COOKIES "regex matching SQL injection - part 2/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 2/2.', \ id: {{id_2}}, \ ctl:ruleEngine={{mode}}, \ deny"

    The example contains two SecRules each having distinct regex expression to match the Cookie header value during the second input analysis phase.

    For more information about custom protection rules, see Custom Protection Rules.

    For more information about ModSecurity syntax, see Making Rules: The Basic Syntax.

    For more information about ModSecurity's open source WAF rules, see Mod Security's OWASP Core Rule Set documentation.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    timeCreated String
    The date and time the protection rule was created, expressed in RFC 3339 timestamp format.
    compartmentId string
    (Updatable) The OCID of the compartment in which to create the custom protection rule.
    definedTags {[key: string]: any}
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    description string
    (Updatable) A description for the Custom Protection rule.
    displayName string
    (Updatable) A user-friendly name for the custom protection rule.
    freeformTags {[key: string]: any}
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    modSecurityRuleIds string[]
    The auto-generated ID for the custom protection rule. These IDs are referenced in logs.
    state string
    The current lifecycle state of the custom protection rule.
    template string

    (Updatable) The template text of the custom protection rule. All custom protection rules are expressed in ModSecurity Rule Language.

    Additionally, each rule must include two placeholder variables that are updated by the WAF service upon publication of the rule.

    id: {{id_1}} - This field is populated with a unique rule ID generated by the WAF service which identifies a SecRule. More than one SecRule can be defined in the template field of a CreateCustomSecurityRule call. The value of the first SecRule must be id: {{id_1}} and the id field of each subsequent SecRule should increase by one, as shown in the example.

    ctl:ruleEngine={{mode}} - The action to be taken when the criteria of the SecRule are met, either OFF, DETECT or BLOCK. This field is automatically populated with the corresponding value of the action field of the CustomProtectionRuleSetting schema when the WafConfig is updated.

    Example: SecRule REQUEST_COOKIES "regex matching SQL injection - part 1/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 1/2.', \ id: {{id_1}}, \ ctl:ruleEngine={{mode}}, \ deny" SecRule REQUEST_COOKIES "regex matching SQL injection - part 2/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 2/2.', \ id: {{id_2}}, \ ctl:ruleEngine={{mode}}, \ deny"

    The example contains two SecRules each having distinct regex expression to match the Cookie header value during the second input analysis phase.

    For more information about custom protection rules, see Custom Protection Rules.

    For more information about ModSecurity syntax, see Making Rules: The Basic Syntax.

    For more information about ModSecurity's open source WAF rules, see Mod Security's OWASP Core Rule Set documentation.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    timeCreated string
    The date and time the protection rule was created, expressed in RFC 3339 timestamp format.
    compartment_id str
    (Updatable) The OCID of the compartment in which to create the custom protection rule.
    defined_tags Mapping[str, Any]
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    description str
    (Updatable) A description for the Custom Protection rule.
    display_name str
    (Updatable) A user-friendly name for the custom protection rule.
    freeform_tags Mapping[str, Any]
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    mod_security_rule_ids Sequence[str]
    The auto-generated ID for the custom protection rule. These IDs are referenced in logs.
    state str
    The current lifecycle state of the custom protection rule.
    template str

    (Updatable) The template text of the custom protection rule. All custom protection rules are expressed in ModSecurity Rule Language.

    Additionally, each rule must include two placeholder variables that are updated by the WAF service upon publication of the rule.

    id: {{id_1}} - This field is populated with a unique rule ID generated by the WAF service which identifies a SecRule. More than one SecRule can be defined in the template field of a CreateCustomSecurityRule call. The value of the first SecRule must be id: {{id_1}} and the id field of each subsequent SecRule should increase by one, as shown in the example.

    ctl:ruleEngine={{mode}} - The action to be taken when the criteria of the SecRule are met, either OFF, DETECT or BLOCK. This field is automatically populated with the corresponding value of the action field of the CustomProtectionRuleSetting schema when the WafConfig is updated.

    Example: SecRule REQUEST_COOKIES "regex matching SQL injection - part 1/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 1/2.', \ id: {{id_1}}, \ ctl:ruleEngine={{mode}}, \ deny" SecRule REQUEST_COOKIES "regex matching SQL injection - part 2/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 2/2.', \ id: {{id_2}}, \ ctl:ruleEngine={{mode}}, \ deny"

    The example contains two SecRules each having distinct regex expression to match the Cookie header value during the second input analysis phase.

    For more information about custom protection rules, see Custom Protection Rules.

    For more information about ModSecurity syntax, see Making Rules: The Basic Syntax.

    For more information about ModSecurity's open source WAF rules, see Mod Security's OWASP Core Rule Set documentation.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    time_created str
    The date and time the protection rule was created, expressed in RFC 3339 timestamp format.
    compartmentId String
    (Updatable) The OCID of the compartment in which to create the custom protection rule.
    definedTags Map<Any>
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    description String
    (Updatable) A description for the Custom Protection rule.
    displayName String
    (Updatable) A user-friendly name for the custom protection rule.
    freeformTags Map<Any>
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    modSecurityRuleIds List<String>
    The auto-generated ID for the custom protection rule. These IDs are referenced in logs.
    state String
    The current lifecycle state of the custom protection rule.
    template String

    (Updatable) The template text of the custom protection rule. All custom protection rules are expressed in ModSecurity Rule Language.

    Additionally, each rule must include two placeholder variables that are updated by the WAF service upon publication of the rule.

    id: {{id_1}} - This field is populated with a unique rule ID generated by the WAF service which identifies a SecRule. More than one SecRule can be defined in the template field of a CreateCustomSecurityRule call. The value of the first SecRule must be id: {{id_1}} and the id field of each subsequent SecRule should increase by one, as shown in the example.

    ctl:ruleEngine={{mode}} - The action to be taken when the criteria of the SecRule are met, either OFF, DETECT or BLOCK. This field is automatically populated with the corresponding value of the action field of the CustomProtectionRuleSetting schema when the WafConfig is updated.

    Example: SecRule REQUEST_COOKIES "regex matching SQL injection - part 1/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 1/2.', \ id: {{id_1}}, \ ctl:ruleEngine={{mode}}, \ deny" SecRule REQUEST_COOKIES "regex matching SQL injection - part 2/2" \ "phase:2, \ msg:'Detects chained SQL injection attempts 2/2.', \ id: {{id_2}}, \ ctl:ruleEngine={{mode}}, \ deny"

    The example contains two SecRules each having distinct regex expression to match the Cookie header value during the second input analysis phase.

    For more information about custom protection rules, see Custom Protection Rules.

    For more information about ModSecurity syntax, see Making Rules: The Basic Syntax.

    For more information about ModSecurity's open source WAF rules, see Mod Security's OWASP Core Rule Set documentation.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    timeCreated String
    The date and time the protection rule was created, expressed in RFC 3339 timestamp format.

    Import

    CustomProtectionRules can be imported using the id, e.g.

    $ pulumi import oci:Waas/customProtectionRule:CustomProtectionRule test_custom_protection_rule "id"
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    oci pulumi/pulumi-oci
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the oci Terraform Provider.
    oci logo
    Oracle Cloud Infrastructure v1.32.0 published on Thursday, Apr 18, 2024 by Pulumi