UNPKG

@pulumi/aws

Version:

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

189 lines 7.78 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.CentralizationRuleForOrganization = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages an AWS CloudWatch Observability Admin Centralization Rule For Organization. * * Centralization rules enable you to centralize log data from multiple AWS accounts and regions within your organization to a single destination account and region. This helps with log management, compliance, and cost optimization by consolidating logs in a central location. * * This requires an AWS account within an organization with at least [delegated administrator permissions](https://docs.aws.amazon.com/organizations/latest/APIReference/API_RegisterDelegatedAdministrator.html). * * ## Example Usage * * ### Basic Centralization Rule * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const current = aws.getCallerIdentity({}); * const currentGetOrganization = aws.organizations.getOrganization({}); * const example = new aws.observabilityadmin.CentralizationRuleForOrganization("example", { * ruleName: "example-centralization-rule", * rule: { * destination: { * region: "eu-west-1", * account: current.then(current => current.accountId), * }, * source: { * regions: ["ap-southeast-1"], * scope: currentGetOrganization.then(currentGetOrganization => `OrganizationId = '${currentGetOrganization.id}'`), * sourceLogsConfiguration: { * encryptedLogGroupStrategy: "SKIP", * logGroupSelectionCriteria: "*", * }, * }, * }, * tags: { * Name: "example-centralization-rule", * Environment: "production", * }, * }); * ``` * * ### Advanced Configuration with Encryption and Backup * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const current = aws.getCallerIdentity({}); * const currentGetOrganization = aws.organizations.getOrganization({}); * const advanced = new aws.observabilityadmin.CentralizationRuleForOrganization("advanced", { * ruleName: "advanced-centralization-rule", * rule: { * destination: { * region: "eu-west-1", * account: current.then(current => current.accountId), * destinationLogsConfiguration: { * logsEncryptionConfiguration: { * encryptionStrategy: "AWS_OWNED", * }, * backupConfiguration: { * region: "us-west-1", * }, * }, * }, * source: { * regions: [ * "ap-southeast-1", * "us-east-1", * ], * scope: currentGetOrganization.then(currentGetOrganization => `OrganizationId = '${currentGetOrganization.id}'`), * sourceLogsConfiguration: { * encryptedLogGroupStrategy: "ALLOW", * logGroupSelectionCriteria: "*", * }, * }, * }, * tags: { * Name: "advanced-centralization-rule", * Environment: "production", * Team: "observability", * }, * }); * ``` * * ### Selective Log Group Filtering * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const current = aws.getCallerIdentity({}); * const currentGetOrganization = aws.organizations.getOrganization({}); * const filtered = new aws.observabilityadmin.CentralizationRuleForOrganization("filtered", { * ruleName: "filtered-centralization-rule", * rule: { * destination: { * region: "eu-west-1", * account: current.then(current => current.accountId), * }, * source: { * regions: [ * "ap-southeast-1", * "us-east-1", * ], * scope: currentGetOrganization.then(currentGetOrganization => `OrganizationId = '${currentGetOrganization.id}'`), * sourceLogsConfiguration: { * encryptedLogGroupStrategy: "ALLOW", * logGroupSelectionCriteria: "LogGroupName LIKE '/aws/lambda%'", * }, * }, * }, * tags: { * Name: "filtered-centralization-rule", * Filter: "lambda-logs", * }, * }); * ``` * * ## Import * * Using `pulumi import`, import CloudWatch Observability Admin Centralization Rule For Organization using the `rule_name`. For example: * * ```sh * $ pulumi import aws:observabilityadmin/centralizationRuleForOrganization:CentralizationRuleForOrganization example example-centralization-rule * ``` */ class CentralizationRuleForOrganization extends pulumi.CustomResource { /** * Get an existing CentralizationRuleForOrganization 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 CentralizationRuleForOrganization(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of CentralizationRuleForOrganization. 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'] === CentralizationRuleForOrganization.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["region"] = state?.region; resourceInputs["rule"] = state?.rule; resourceInputs["ruleArn"] = state?.ruleArn; resourceInputs["ruleName"] = state?.ruleName; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; resourceInputs["timeouts"] = state?.timeouts; } else { const args = argsOrState; if (args?.ruleName === undefined && !opts.urn) { throw new Error("Missing required property 'ruleName'"); } resourceInputs["region"] = args?.region; resourceInputs["rule"] = args?.rule; resourceInputs["ruleName"] = args?.ruleName; resourceInputs["tags"] = args?.tags; resourceInputs["timeouts"] = args?.timeouts; resourceInputs["ruleArn"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(CentralizationRuleForOrganization.__pulumiType, name, resourceInputs, opts); } } exports.CentralizationRuleForOrganization = CentralizationRuleForOrganization; /** @internal */ CentralizationRuleForOrganization.__pulumiType = 'aws:observabilityadmin/centralizationRuleForOrganization:CentralizationRuleForOrganization'; //# sourceMappingURL=centralizationRuleForOrganization.js.map