UNPKG

@pulumi/aws

Version:

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

115 lines 4.84 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.QueryLog = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a Route53 query logging configuration resource. * * > **NOTE:** There are restrictions on the configuration of query logging. Notably, * the CloudWatch log group must be in the `us-east-1` region, * a permissive CloudWatch log resource policy must be in place, and * the Route53 hosted zone must be public. * See [Configuring Logging for DNS Queries](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/query-logs.html?console_help=true#query-logs-configuring) for additional details. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * // Example Route53 zone with query logging * const exampleCom = new aws.route53.Zone("example_com", {name: "example.com"}); * const awsRoute53ExampleCom = new aws.cloudwatch.LogGroup("aws_route53_example_com", { * name: pulumi.interpolate`/aws/route53/${exampleCom.name}`, * retentionInDays: 30, * }); * // Example CloudWatch log resource policy to allow Route53 to write logs * // to any log group under /aws/route53/* * const route53_query_logging_policy = aws.iam.getPolicyDocument({ * statements: [{ * actions: [ * "logs:CreateLogStream", * "logs:PutLogEvents", * ], * resources: ["arn:aws:logs:*:*:log-group:/aws/route53/*"], * principals: [{ * identifiers: ["route53.amazonaws.com"], * type: "Service", * }], * }], * }); * const route53_query_logging_policyLogResourcePolicy = new aws.cloudwatch.LogResourcePolicy("route53-query-logging-policy", { * policyDocument: route53_query_logging_policy.then(route53_query_logging_policy => route53_query_logging_policy.json), * policyName: "route53-query-logging-policy", * }); * const exampleComQueryLog = new aws.route53.QueryLog("example_com", { * cloudwatchLogGroupArn: awsRoute53ExampleCom.arn, * zoneId: exampleCom.zoneId, * }, { * dependsOn: [route53_query_logging_policyLogResourcePolicy], * }); * ``` * * ## Import * * Using `pulumi import`, import Route53 query logging configurations using their ID. For example: * * ```sh * $ pulumi import aws:route53/queryLog:QueryLog example_com xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx * ``` */ class QueryLog extends pulumi.CustomResource { /** * Get an existing QueryLog 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 QueryLog(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of QueryLog. 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'] === QueryLog.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state?.arn; resourceInputs["cloudwatchLogGroupArn"] = state?.cloudwatchLogGroupArn; resourceInputs["zoneId"] = state?.zoneId; } else { const args = argsOrState; if (args?.cloudwatchLogGroupArn === undefined && !opts.urn) { throw new Error("Missing required property 'cloudwatchLogGroupArn'"); } if (args?.zoneId === undefined && !opts.urn) { throw new Error("Missing required property 'zoneId'"); } resourceInputs["cloudwatchLogGroupArn"] = args?.cloudwatchLogGroupArn; resourceInputs["zoneId"] = args?.zoneId; resourceInputs["arn"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(QueryLog.__pulumiType, name, resourceInputs, opts); } } exports.QueryLog = QueryLog; /** @internal */ QueryLog.__pulumiType = 'aws:route53/queryLog:QueryLog'; //# sourceMappingURL=queryLog.js.map