OrganizationCustomPolicyRule class

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 and AWS Config Managed Rules documentation. For working with Organization Managed Rules (those invoking an AWS managed rule), see the aws.cfg.OrganizationManagedRule 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

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 pulumi
import pulumi_aws as aws

example = aws.cfg.OrganizationCustomPolicyRule("example",
    name="example_rule_name",
    policy_runtime="guard-2.x.x",
    policy_text="""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\"
    }
""",
    resource_types_scopes=["AWS::DynamoDB::Table"])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.Cfg.OrganizationCustomPolicyRule("example", new()
    {
        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 = new[]
        {
            "AWS::DynamoDB::Table",
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/cfg"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := cfg.NewOrganizationCustomPolicyRule(ctx, "example", &cfg.OrganizationCustomPolicyRuleArgs{
			Name:          pulumi.String("example_rule_name"),
			PolicyRuntime: pulumi.String("guard-2.x.x"),
			PolicyText: pulumi.String(`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: pulumi.StringArray{
				pulumi.String("AWS::DynamoDB::Table"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_cfg_organizationcustompolicyrule" "example" {
  name                  = "example_rule_name"
  policy_runtime        = "guard-2.x.x"
  policy_text           = "let status = ['ACTIVE']\n\nrule tableisactive when\n    resourceType == \\\"AWS::DynamoDB::Table\\\" {\n    configuration.tableStatus == %status\n}\n\nrule checkcompliance when\n    resourceType == \\\"AWS::DynamoDB::Table\\\"\n    tableisactive {\n        let pitr = supplementaryConfiguration.ContinuousBackupsDescription.pointInTimeRecoveryDescription.pointInTimeRecoveryStatus\n        %pitr == \\\"ENABLED\\\"\n    }\n"
  resource_types_scopes = ["AWS::DynamoDB::Table"]
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cfg.OrganizationCustomPolicyRule;
import com.pulumi.aws.cfg.OrganizationCustomPolicyRuleArgs;
import java.util.ArrayList;
import java.util.Arrays;
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) {
        var example = new OrganizationCustomPolicyRule("example", OrganizationCustomPolicyRuleArgs.builder()
            .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")
            .build());

    }
}
resources:
  example:
    type: aws:cfg:OrganizationCustomPolicyRule
    properties:
      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

Identity Schema

Required

  • name (String) Name of the rule.

Optional

  • accountId (String) AWS Account where this resource is managed.
  • region (String) Region where this resource is managed.

Using pulumi import, import Config Organization Custom Policy Rules using the name. For example:

$ pulumi import aws:cfg/organizationCustomPolicyRule:OrganizationCustomPolicyRule example example

Constructors

OrganizationCustomPolicyRule(String name, {OrganizationCustomPolicyRuleArgs? args, CustomResourceOptions? options})
Creates a new OrganizationCustomPolicyRule. name The Pulumi resource name. args Arguments used to configure this OrganizationCustomPolicyRule. The set of arguments for OrganizationCustomPolicyRule. options Resource options controlling this resource's behavior.
OrganizationCustomPolicyRule.reference(String urn)
Creates a typed reference to an existing OrganizationCustomPolicyRule resource.

Properties

arn ↔ Output<String>
ARN of the rule.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
debugLogDeliveryAccounts ↔ Output<List<String>?>
List of accounts that you can enable debug logging for. The list is null when debug logging is enabled for all accounts.
latefinal
description ↔ Output<String?>
Description of the rule.
latefinal
excludedAccounts ↔ Output<List<String>?>
List of AWS account identifiers to exclude from the rule.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
inputParameters ↔ Output<String?>
A string in JSON format that is passed to the AWS Config Rule Lambda Function.
latefinal
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
maximumExecutionFrequency ↔ Output<String?>
Maximum frequency with which AWS Config runs evaluations for a rule, if the rule is triggered at a periodic frequency. Defaults to TwentyFour_Hours for periodic frequency triggered rules. Valid values: One_Hour, Three_Hours, Six_Hours, Twelve_Hours, or TwentyFour_Hours.
latefinal
name ↔ Output<String>
Name of the rule.
latefinal
policyRuntime ↔ Output<String>
Runtime system for policy rules.
latefinal
policyText ↔ Output<String>
Policy definition containing the rule logic.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceIdScope ↔ Output<String?>
Identifier of the AWS resource to evaluate.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
resourceTypesScopes ↔ Output<List<String>?>
List of types of AWS resources to evaluate.
latefinal
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tagKeyScope ↔ Output<String?>
Tag key of AWS resources to evaluate.
latefinal
tagValueScope ↔ Output<String?>
Tag value of AWS resources to evaluate.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
triggerTypes ↔ Output<List<String>>
List of notification types that trigger AWS Config to run an evaluation for the rule. Valid values: ConfigurationItemChangeNotification, OversizedConfigurationItemChangeNotification.
latefinal
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {OrganizationCustomPolicyRuleState? state, CustomResourceOptions? options}) → OrganizationCustomPolicyRule
Gets an existing OrganizationCustomPolicyRule resource's state with the given name and id.