akamai.AppSecCustomDeny

Scopes: Custom deny

Modifies a custom deny action. Custom denies enable you to craft your own error message or redirect pages for use when HTTP requests are denied.

Related API Endpoint: /appsec/v1/configs/{configId}/versions/{versionNumber}/custom-deny

Output Options

The following options can be used to determine the information returned, and how that returned information is formatted:

  • custom_deny_id. ID of the new custom deny action.

Example Usage

Basic usage

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

return await Deployment.RunAsync(() => 
{
    var configuration = Akamai.GetAppSecConfiguration.Invoke(new()
    {
        Name = "Documentation",
    });

    var customDeny = new Akamai.AppSecCustomDeny("customDeny", new()
    {
        ConfigId = configuration.Apply(getAppSecConfigurationResult => getAppSecConfigurationResult.ConfigId),
        CustomDeny = File.ReadAllText($"{path.Module}/custom_deny.json"),
    });

    return new Dictionary<string, object?>
    {
        ["customDenyId"] = customDeny.CustomDenyId,
    };
});
package main

import (
	"fmt"
	"os"

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

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		configuration, err := akamai.LookupAppSecConfiguration(ctx, &akamai.LookupAppSecConfigurationArgs{
			Name: pulumi.StringRef("Documentation"),
		}, nil)
		if err != nil {
			return err
		}
		customDeny, err := akamai.NewAppSecCustomDeny(ctx, "customDeny", &akamai.AppSecCustomDenyArgs{
			ConfigId:   *pulumi.Int(configuration.ConfigId),
			CustomDeny: readFileOrPanic(fmt.Sprintf("%v/custom_deny.json", path.Module)),
		})
		if err != nil {
			return err
		}
		ctx.Export("customDenyId", customDeny.CustomDenyId)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.akamai.AkamaiFunctions;
import com.pulumi.akamai.inputs.GetAppSecConfigurationArgs;
import com.pulumi.akamai.AppSecCustomDeny;
import com.pulumi.akamai.AppSecCustomDenyArgs;
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) {
        final var configuration = AkamaiFunctions.getAppSecConfiguration(GetAppSecConfigurationArgs.builder()
            .name("Documentation")
            .build());

        var customDeny = new AppSecCustomDeny("customDeny", AppSecCustomDenyArgs.builder()        
            .configId(configuration.applyValue(getAppSecConfigurationResult -> getAppSecConfigurationResult.configId()))
            .customDeny(Files.readString(Paths.get(String.format("%s/custom_deny.json", path.module()))))
            .build());

        ctx.export("customDenyId", customDeny.customDenyId());
    }
}
import pulumi
import pulumi_akamai as akamai

configuration = akamai.get_app_sec_configuration(name="Documentation")
custom_deny = akamai.AppSecCustomDeny("customDeny",
    config_id=configuration.config_id,
    custom_deny=(lambda path: open(path).read())(f"{path['module']}/custom_deny.json"))
pulumi.export("customDenyId", custom_deny.custom_deny_id)
import * as pulumi from "@pulumi/pulumi";
import * as akamai from "@pulumi/akamai";
import * as fs from "fs";

const configuration = akamai.getAppSecConfiguration({
    name: "Documentation",
});
const customDeny = new akamai.AppSecCustomDeny("customDeny", {
    configId: configuration.then(configuration => configuration.configId),
    customDeny: fs.readFileSync(`${path.module}/custom_deny.json`),
});
export const customDenyId = customDeny.customDenyId;
resources:
  customDeny:
    type: akamai:AppSecCustomDeny
    properties:
      configId: ${configuration.configId}
      customDeny:
        fn::readFile: ${path.module}/custom_deny.json
variables:
  configuration:
    fn::invoke:
      Function: akamai:getAppSecConfiguration
      Arguments:
        name: Documentation
outputs:
  customDenyId: ${customDeny.customDenyId}

Create AppSecCustomDeny Resource

new AppSecCustomDeny(name: string, args: AppSecCustomDenyArgs, opts?: CustomResourceOptions);
@overload
def AppSecCustomDeny(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     config_id: Optional[int] = None,
                     custom_deny: Optional[str] = None)
@overload
def AppSecCustomDeny(resource_name: str,
                     args: AppSecCustomDenyArgs,
                     opts: Optional[ResourceOptions] = None)
func NewAppSecCustomDeny(ctx *Context, name string, args AppSecCustomDenyArgs, opts ...ResourceOption) (*AppSecCustomDeny, error)
public AppSecCustomDeny(string name, AppSecCustomDenyArgs args, CustomResourceOptions? opts = null)
public AppSecCustomDeny(String name, AppSecCustomDenyArgs args)
public AppSecCustomDeny(String name, AppSecCustomDenyArgs args, CustomResourceOptions options)
type: akamai:AppSecCustomDeny
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args AppSecCustomDenyArgs
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 AppSecCustomDenyArgs
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 AppSecCustomDenyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args AppSecCustomDenyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args AppSecCustomDenyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

ConfigId int

. Unique identifier of the security configuration associated with the custom deny.

CustomDeny string

. Path to a JSON file containing properties and property values for the custom deny.

ConfigId int

. Unique identifier of the security configuration associated with the custom deny.

CustomDeny string

. Path to a JSON file containing properties and property values for the custom deny.

configId Integer

. Unique identifier of the security configuration associated with the custom deny.

customDeny String

. Path to a JSON file containing properties and property values for the custom deny.

configId number

. Unique identifier of the security configuration associated with the custom deny.

customDeny string

. Path to a JSON file containing properties and property values for the custom deny.

config_id int

. Unique identifier of the security configuration associated with the custom deny.

custom_deny str

. Path to a JSON file containing properties and property values for the custom deny.

configId Number

. Unique identifier of the security configuration associated with the custom deny.

customDeny String

. Path to a JSON file containing properties and property values for the custom deny.

Outputs

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

CustomDenyId string

custom_deny_id

Id string

The provider-assigned unique ID for this managed resource.

CustomDenyId string

custom_deny_id

Id string

The provider-assigned unique ID for this managed resource.

customDenyId String

custom_deny_id

id String

The provider-assigned unique ID for this managed resource.

customDenyId string

custom_deny_id

id string

The provider-assigned unique ID for this managed resource.

custom_deny_id str

custom_deny_id

id str

The provider-assigned unique ID for this managed resource.

customDenyId String

custom_deny_id

id String

The provider-assigned unique ID for this managed resource.

Look up Existing AppSecCustomDeny Resource

Get an existing AppSecCustomDeny 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?: AppSecCustomDenyState, opts?: CustomResourceOptions): AppSecCustomDeny
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        config_id: Optional[int] = None,
        custom_deny: Optional[str] = None,
        custom_deny_id: Optional[str] = None) -> AppSecCustomDeny
func GetAppSecCustomDeny(ctx *Context, name string, id IDInput, state *AppSecCustomDenyState, opts ...ResourceOption) (*AppSecCustomDeny, error)
public static AppSecCustomDeny Get(string name, Input<string> id, AppSecCustomDenyState? state, CustomResourceOptions? opts = null)
public static AppSecCustomDeny get(String name, Output<String> id, AppSecCustomDenyState 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:
ConfigId int

. Unique identifier of the security configuration associated with the custom deny.

CustomDeny string

. Path to a JSON file containing properties and property values for the custom deny.

CustomDenyId string

custom_deny_id

ConfigId int

. Unique identifier of the security configuration associated with the custom deny.

CustomDeny string

. Path to a JSON file containing properties and property values for the custom deny.

CustomDenyId string

custom_deny_id

configId Integer

. Unique identifier of the security configuration associated with the custom deny.

customDeny String

. Path to a JSON file containing properties and property values for the custom deny.

customDenyId String

custom_deny_id

configId number

. Unique identifier of the security configuration associated with the custom deny.

customDeny string

. Path to a JSON file containing properties and property values for the custom deny.

customDenyId string

custom_deny_id

config_id int

. Unique identifier of the security configuration associated with the custom deny.

custom_deny str

. Path to a JSON file containing properties and property values for the custom deny.

custom_deny_id str

custom_deny_id

configId Number

. Unique identifier of the security configuration associated with the custom deny.

customDeny String

. Path to a JSON file containing properties and property values for the custom deny.

customDenyId String

custom_deny_id

Package Details

Repository
Akamai pulumi/pulumi-akamai
License
Apache-2.0
Notes

This Pulumi package is based on the akamai Terraform Provider.