oci logo
Oracle Cloud Infrastructure v0.12.0, Mar 17 23

oci.Waas.CustomProtectionRule

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

using System.Collections.Generic;
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 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.AnyMap{
				"Operations.CostCenter": pulumi.Any("42"),
			},
			Description: pulumi.Any(_var.Custom_protection_rule_description),
			FreeformTags: pulumi.AnyMap{
				"Department": pulumi.Any("Finance"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.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());

    }
}
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",
    })
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",
    },
});
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

new CustomProtectionRule(name: string, args: CustomProtectionRuleArgs, opts?: CustomResourceOptions);
@overload
def CustomProtectionRule(resource_name: 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,
                         template: Optional[str] = None)
@overload
def CustomProtectionRule(resource_name: str,
                         args: CustomProtectionRuleArgs,
                         opts: Optional[ResourceOptions] = 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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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"

Package Details

Repository
oci pulumi/pulumi-oci
License
Apache-2.0
Notes

This Pulumi package is based on the oci Terraform Provider.