Welcome to Pulumi Registry, your window into the cloud. Read the announcement.

AppSecRule

Use the akamai.AppSecRule resource to create or modify a rule’s action, conditions and exceptions. When the conditions are met, the rule’s actions are ignored and not applied to that specific traffic.

Example Usage

using System.IO;
using Pulumi;
using Akamai = Pulumi.Akamai;

class MyStack : Stack
{
    public MyStack()
    {
        var configuration = Output.Create(Akamai.GetAppSecConfiguration.InvokeAsync(new Akamai.GetAppSecConfigurationArgs
        {
            Name = @var.Security_configuration,
        }));
        var rule = new Akamai.AppSecRule("rule", new Akamai.AppSecRuleArgs
        {
            ConfigId = configuration.Apply(configuration => configuration.ConfigId),
            SecurityPolicyId = @var.Security_policy_id,
            RuleId = @var.Rule_id,
            RuleAction = @var.Action,
            ConditionException = File.ReadAllText($"{path.Module}/condition_exception.json"),
        });
    }

}
package main

import (
	"fmt"
	"io/ioutil"

	"github.com/pulumi/pulumi-akamai/sdk/v2/go/akamai"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func readFileOrPanic(path string) pulumi.StringPtrInput {
	data, err := ioutil.ReadFile(path)
	if err != nil {
		panic(err.Error())
	}
	return pulumi.String(string(data))
}

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		opt0 := _var.Security_configuration
		configuration, err := akamai.LookupAppSecConfiguration(ctx, &GetAppSecConfigurationArgs{
			Name: &opt0,
		}, nil)
		if err != nil {
			return err
		}
		_, err = akamai.NewAppSecRule(ctx, "rule", &akamai.AppSecRuleArgs{
			ConfigId:           pulumi.Int(configuration.ConfigId),
			SecurityPolicyId:   pulumi.Any(_var.Security_policy_id),
			RuleId:             pulumi.Any(_var.Rule_id),
			RuleAction:         pulumi.Any(_var.Action),
			ConditionException: readFileOrPanic(fmt.Sprintf("%v%v", path.Module, "/condition_exception.json")),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_akamai as akamai

configuration = akamai.get_app_sec_configuration(name=var["security_configuration"])
rule = akamai.AppSecRule("rule",
    config_id=configuration.config_id,
    security_policy_id=var["security_policy_id"],
    rule_id=var["rule_id"],
    rule_action=var["action"],
    condition_exception=(lambda path: open(path).read())(f"{path['module']}/condition_exception.json"))
import * as pulumi from "@pulumi/pulumi";
import * as akamai from "@pulumi/akamai";
import * from "fs";

const configuration = akamai.getAppSecConfiguration({
    name: _var.security_configuration,
});
const rule = new akamai.AppSecRule("rule", {
    configId: configuration.then(configuration => configuration.configId),
    securityPolicyId: _var.security_policy_id,
    ruleId: _var.rule_id,
    ruleAction: _var.action,
    conditionException: fs.readFileSync(`${path.module}/condition_exception.json`),
});

Create a AppSecRule Resource

new AppSecRule(name: string, args: AppSecRuleArgs, opts?: CustomResourceOptions);
@overload
def AppSecRule(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               condition_exception: Optional[str] = None,
               config_id: Optional[int] = None,
               rule_action: Optional[str] = None,
               rule_id: Optional[int] = None,
               security_policy_id: Optional[str] = None)
@overload
def AppSecRule(resource_name: str,
               args: AppSecRuleArgs,
               opts: Optional[ResourceOptions] = None)
func NewAppSecRule(ctx *Context, name string, args AppSecRuleArgs, opts ...ResourceOption) (*AppSecRule, error)
public AppSecRule(string name, AppSecRuleArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args AppSecRuleArgs
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 AppSecRuleArgs
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 AppSecRuleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args AppSecRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

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

ConfigId int
The ID of the security configuration to use.
RuleId int
The ID of the rule to use.
SecurityPolicyId string
The ID of the security policy to use.
ConditionException string
The name of a file containing a JSON-formatted description of the conditions and exceptions to use (format)
RuleAction string
The action to be taken: alert to record the trigger of the event, deny to block the request, deny_custom_{custom_deny_id} to execute a custom deny action, or none to take no action. ASE Beta. if policy is in ASE_AUTO mode, only condition_exception can be modified, “ASE (Adaptive Security Engine) is currently in beta. Please contact your Akamai representative to learn more.
ConfigId int
The ID of the security configuration to use.
RuleId int
The ID of the rule to use.
SecurityPolicyId string
The ID of the security policy to use.
ConditionException string
The name of a file containing a JSON-formatted description of the conditions and exceptions to use (format)
RuleAction string
The action to be taken: alert to record the trigger of the event, deny to block the request, deny_custom_{custom_deny_id} to execute a custom deny action, or none to take no action. ASE Beta. if policy is in ASE_AUTO mode, only condition_exception can be modified, “ASE (Adaptive Security Engine) is currently in beta. Please contact your Akamai representative to learn more.
configId number
The ID of the security configuration to use.
ruleId number
The ID of the rule to use.
securityPolicyId string
The ID of the security policy to use.
conditionException string
The name of a file containing a JSON-formatted description of the conditions and exceptions to use (format)
ruleAction string
The action to be taken: alert to record the trigger of the event, deny to block the request, deny_custom_{custom_deny_id} to execute a custom deny action, or none to take no action. ASE Beta. if policy is in ASE_AUTO mode, only condition_exception can be modified, “ASE (Adaptive Security Engine) is currently in beta. Please contact your Akamai representative to learn more.
config_id int
The ID of the security configuration to use.
rule_id int
The ID of the rule to use.
security_policy_id str
The ID of the security policy to use.
condition_exception str
The name of a file containing a JSON-formatted description of the conditions and exceptions to use (format)
rule_action str
The action to be taken: alert to record the trigger of the event, deny to block the request, deny_custom_{custom_deny_id} to execute a custom deny action, or none to take no action. ASE Beta. if policy is in ASE_AUTO mode, only condition_exception can be modified, “ASE (Adaptive Security Engine) is currently in beta. Please contact your Akamai representative to learn more.

Outputs

All input properties are implicitly available as output properties. Additionally, the AppSecRule 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 str
The provider-assigned unique ID for this managed resource.

Look up an Existing AppSecRule Resource

Get an existing AppSecRule 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?: AppSecRuleState, opts?: CustomResourceOptions): AppSecRule
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        condition_exception: Optional[str] = None,
        config_id: Optional[int] = None,
        rule_action: Optional[str] = None,
        rule_id: Optional[int] = None,
        security_policy_id: Optional[str] = None) -> AppSecRule
func GetAppSecRule(ctx *Context, name string, id IDInput, state *AppSecRuleState, opts ...ResourceOption) (*AppSecRule, error)
public static AppSecRule Get(string name, Input<string> id, AppSecRuleState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

ConditionException string
The name of a file containing a JSON-formatted description of the conditions and exceptions to use (format)
ConfigId int
The ID of the security configuration to use.
RuleAction string
The action to be taken: alert to record the trigger of the event, deny to block the request, deny_custom_{custom_deny_id} to execute a custom deny action, or none to take no action. ASE Beta. if policy is in ASE_AUTO mode, only condition_exception can be modified, “ASE (Adaptive Security Engine) is currently in beta. Please contact your Akamai representative to learn more.
RuleId int
The ID of the rule to use.
SecurityPolicyId string
The ID of the security policy to use.
ConditionException string
The name of a file containing a JSON-formatted description of the conditions and exceptions to use (format)
ConfigId int
The ID of the security configuration to use.
RuleAction string
The action to be taken: alert to record the trigger of the event, deny to block the request, deny_custom_{custom_deny_id} to execute a custom deny action, or none to take no action. ASE Beta. if policy is in ASE_AUTO mode, only condition_exception can be modified, “ASE (Adaptive Security Engine) is currently in beta. Please contact your Akamai representative to learn more.
RuleId int
The ID of the rule to use.
SecurityPolicyId string
The ID of the security policy to use.
conditionException string
The name of a file containing a JSON-formatted description of the conditions and exceptions to use (format)
configId number
The ID of the security configuration to use.
ruleAction string
The action to be taken: alert to record the trigger of the event, deny to block the request, deny_custom_{custom_deny_id} to execute a custom deny action, or none to take no action. ASE Beta. if policy is in ASE_AUTO mode, only condition_exception can be modified, “ASE (Adaptive Security Engine) is currently in beta. Please contact your Akamai representative to learn more.
ruleId number
The ID of the rule to use.
securityPolicyId string
The ID of the security policy to use.
condition_exception str
The name of a file containing a JSON-formatted description of the conditions and exceptions to use (format)
config_id int
The ID of the security configuration to use.
rule_action str
The action to be taken: alert to record the trigger of the event, deny to block the request, deny_custom_{custom_deny_id} to execute a custom deny action, or none to take no action. ASE Beta. if policy is in ASE_AUTO mode, only condition_exception can be modified, “ASE (Adaptive Security Engine) is currently in beta. Please contact your Akamai representative to learn more.
rule_id int
The ID of the rule to use.
security_policy_id str
The ID of the security policy to use.

Package Details

Repository
https://github.com/pulumi/pulumi-akamai
License
Apache-2.0
Notes
This Pulumi package is based on the akamai Terraform Provider.