UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

137 lines 5.92 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.WebAclLoggingConfiguration = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * This resource creates a WAFv2 Web ACL Logging Configuration. * * !> **WARNING:** When logging from a WAFv2 Web ACL to a CloudWatch Log Group, the WAFv2 service tries to create or update a generic Log Resource Policy named `AWSWAF-LOGS`. However, if there are a large number of Web ACLs or if the account frequently creates and deletes Web ACLs, this policy may exceed the maximum policy size. As a result, this resource type will fail to be created. More details about this issue can be found in this issue. To prevent this issue, you can manage a specific resource policy. Please refer to the example below for managing a CloudWatch Log Group with a managed CloudWatch Log Resource Policy. * * ## Example Usage * * ### With Redacted Fields * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.wafv2.WebAclLoggingConfiguration("example", { * logDestinationConfigs: [exampleAwsKinesisFirehoseDeliveryStream.arn], * resourceArn: exampleAwsWafv2WebAcl.arn, * redactedFields: [{ * singleHeader: { * name: "user-agent", * }, * }], * }); * ``` * * ### With Logging Filter * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.wafv2.WebAclLoggingConfiguration("example", { * logDestinationConfigs: [exampleAwsKinesisFirehoseDeliveryStream.arn], * resourceArn: exampleAwsWafv2WebAcl.arn, * loggingFilter: { * defaultBehavior: "KEEP", * filters: [ * { * behavior: "DROP", * conditions: [ * { * actionCondition: { * action: "COUNT", * }, * }, * { * labelNameCondition: { * labelName: "awswaf:111122223333:rulegroup:testRules:LabelNameZ", * }, * }, * ], * requirement: "MEETS_ALL", * }, * { * behavior: "KEEP", * conditions: [{ * actionCondition: { * action: "ALLOW", * }, * }], * requirement: "MEETS_ANY", * }, * ], * }, * }); * ``` * * ## Import * * Using `pulumi import`, import WAFv2 Web ACL Logging Configurations using the ARN of the WAFv2 Web ACL. For example: * * ```sh * $ pulumi import aws:wafv2/webAclLoggingConfiguration:WebAclLoggingConfiguration example arn:aws:wafv2:us-west-2:123456789012:regional/webacl/test-logs/a1b2c3d4-5678-90ab-cdef * ``` */ class WebAclLoggingConfiguration extends pulumi.CustomResource { /** * Get an existing WebAclLoggingConfiguration resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new WebAclLoggingConfiguration(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of WebAclLoggingConfiguration. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === WebAclLoggingConfiguration.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["logDestinationConfigs"] = state?.logDestinationConfigs; resourceInputs["loggingFilter"] = state?.loggingFilter; resourceInputs["redactedFields"] = state?.redactedFields; resourceInputs["region"] = state?.region; resourceInputs["resourceArn"] = state?.resourceArn; } else { const args = argsOrState; if (args?.logDestinationConfigs === undefined && !opts.urn) { throw new Error("Missing required property 'logDestinationConfigs'"); } if (args?.resourceArn === undefined && !opts.urn) { throw new Error("Missing required property 'resourceArn'"); } resourceInputs["logDestinationConfigs"] = args?.logDestinationConfigs; resourceInputs["loggingFilter"] = args?.loggingFilter; resourceInputs["redactedFields"] = args?.redactedFields; resourceInputs["region"] = args?.region; resourceInputs["resourceArn"] = args?.resourceArn; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(WebAclLoggingConfiguration.__pulumiType, name, resourceInputs, opts); } } exports.WebAclLoggingConfiguration = WebAclLoggingConfiguration; /** @internal */ WebAclLoggingConfiguration.__pulumiType = 'aws:wafv2/webAclLoggingConfiguration:WebAclLoggingConfiguration'; //# sourceMappingURL=webAclLoggingConfiguration.js.map