@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
128 lines • 7.04 kB
JavaScript
;
// *** 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.OrganizationCustomPolicyRule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a Config Organization Custom Policy Rule. More information about these rules can be found in the [Enabling AWS Config Rules Across all Accounts in Your Organization](https://docs.aws.amazon.com/config/latest/developerguide/config-rule-multi-account-deployment.html) and [AWS Config Managed Rules](https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config_use-managed-rules.html) documentation. For working with Organization Managed Rules (those invoking an AWS managed rule), see the `aws_config_organization_managed__rule` resource.
*
* > **NOTE:** This resource must be created in the Organization master account and rules will include the master account unless its ID is added to the `excludedAccounts` argument.
*
* ## Example Usage
*
* ### Basic Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.cfg.OrganizationCustomPolicyRule("example", {
* name: "example_rule_name",
* policyRuntime: "guard-2.x.x",
* policyText: `let status = ['ACTIVE']
*
* rule tableisactive when
* resourceType == "AWS::DynamoDB::Table" {
* configuration.tableStatus == %status
* }
*
* rule checkcompliance when
* resourceType == "AWS::DynamoDB::Table"
* tableisactive {
* let pitr = supplementaryConfiguration.ContinuousBackupsDescription.pointInTimeRecoveryDescription.pointInTimeRecoveryStatus
* %pitr == "ENABLED"
* }
* `,
* resourceTypesScopes: ["AWS::DynamoDB::Table"],
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import a Config Organization Custom Policy Rule using the `name` argument. For example:
*
* ```sh
* $ pulumi import aws:cfg/organizationCustomPolicyRule:OrganizationCustomPolicyRule example example_rule_name
* ```
*/
class OrganizationCustomPolicyRule extends pulumi.CustomResource {
/**
* Get an existing OrganizationCustomPolicyRule 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 OrganizationCustomPolicyRule(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of OrganizationCustomPolicyRule. 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'] === OrganizationCustomPolicyRule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state ? state.arn : undefined;
resourceInputs["debugLogDeliveryAccounts"] = state ? state.debugLogDeliveryAccounts : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["excludedAccounts"] = state ? state.excludedAccounts : undefined;
resourceInputs["inputParameters"] = state ? state.inputParameters : undefined;
resourceInputs["maximumExecutionFrequency"] = state ? state.maximumExecutionFrequency : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["policyRuntime"] = state ? state.policyRuntime : undefined;
resourceInputs["policyText"] = state ? state.policyText : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["resourceIdScope"] = state ? state.resourceIdScope : undefined;
resourceInputs["resourceTypesScopes"] = state ? state.resourceTypesScopes : undefined;
resourceInputs["tagKeyScope"] = state ? state.tagKeyScope : undefined;
resourceInputs["tagValueScope"] = state ? state.tagValueScope : undefined;
resourceInputs["triggerTypes"] = state ? state.triggerTypes : undefined;
}
else {
const args = argsOrState;
if ((!args || args.policyRuntime === undefined) && !opts.urn) {
throw new Error("Missing required property 'policyRuntime'");
}
if ((!args || args.policyText === undefined) && !opts.urn) {
throw new Error("Missing required property 'policyText'");
}
if ((!args || args.triggerTypes === undefined) && !opts.urn) {
throw new Error("Missing required property 'triggerTypes'");
}
resourceInputs["debugLogDeliveryAccounts"] = args ? args.debugLogDeliveryAccounts : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["excludedAccounts"] = args ? args.excludedAccounts : undefined;
resourceInputs["inputParameters"] = args ? args.inputParameters : undefined;
resourceInputs["maximumExecutionFrequency"] = args ? args.maximumExecutionFrequency : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["policyRuntime"] = args ? args.policyRuntime : undefined;
resourceInputs["policyText"] = args ? args.policyText : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["resourceIdScope"] = args ? args.resourceIdScope : undefined;
resourceInputs["resourceTypesScopes"] = args ? args.resourceTypesScopes : undefined;
resourceInputs["tagKeyScope"] = args ? args.tagKeyScope : undefined;
resourceInputs["tagValueScope"] = args ? args.tagValueScope : undefined;
resourceInputs["triggerTypes"] = args ? args.triggerTypes : undefined;
resourceInputs["arn"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(OrganizationCustomPolicyRule.__pulumiType, name, resourceInputs, opts);
}
}
exports.OrganizationCustomPolicyRule = OrganizationCustomPolicyRule;
/** @internal */
OrganizationCustomPolicyRule.__pulumiType = 'aws:cfg/organizationCustomPolicyRule:OrganizationCustomPolicyRule';
//# sourceMappingURL=organizationCustomPolicyRule.js.map