AppSecEvalRule

Use the akamai.AppSecEvalRule resource to create or modify an eval 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 evalRule = new Akamai.AppSecEvalRule("evalRule", new Akamai.AppSecEvalRuleArgs
        {
            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.NewAppSecEvalRule(ctx, "evalRule", &akamai.AppSecEvalRuleArgs{
			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"])
eval_rule = akamai.AppSecEvalRule("evalRule",
    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 evalRule = new akamai.AppSecEvalRule("evalRule", {
    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 AppSecEvalRule Resource

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

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

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.
RuleId int
The ID of the eval 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.
RuleId int
The ID of the eval 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.
ruleId number
The ID of the eval 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)
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.
rule_id int
The ID of the eval 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)

Outputs

All input properties are implicitly available as output properties. Additionally, the AppSecEvalRule 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 AppSecEvalRule Resource

Get an existing AppSecEvalRule 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?: AppSecEvalRuleState, opts?: CustomResourceOptions): AppSecEvalRule
@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) -> AppSecEvalRule
func GetAppSecEvalRule(ctx *Context, name string, id IDInput, state *AppSecEvalRuleState, opts ...ResourceOption) (*AppSecEvalRule, error)
public static AppSecEvalRule Get(string name, Input<string> id, AppSecEvalRuleState? 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.
RuleId int
The ID of the eval 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.
RuleId int
The ID of the eval 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.
ruleId number
The ID of the eval 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.
rule_id int
The ID of the eval 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.