All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.aws.cfg.kotlin.OrganizationCustomRuleArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.57.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.cfg.kotlin

import com.pulumi.aws.cfg.OrganizationCustomRuleArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Manages a Config Organization Custom 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 `excluded_accounts` argument.
 * > **NOTE:** The proper Lambda permission to allow the AWS Config service invoke the Lambda Function must be in place before the rule will successfully create or update. See also the `aws.lambda.Permission` resource.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const example = new aws.lambda.Permission("example", {
 *     action: "lambda:InvokeFunction",
 *     "function": exampleAwsLambdaFunction.arn,
 *     principal: "config.amazonaws.com",
 *     statementId: "AllowExecutionFromConfig",
 * });
 * const exampleOrganization = new aws.organizations.Organization("example", {
 *     awsServiceAccessPrincipals: ["config-multiaccountsetup.amazonaws.com"],
 *     featureSet: "ALL",
 * });
 * const exampleOrganizationCustomRule = new aws.cfg.OrganizationCustomRule("example", {
 *     lambdaFunctionArn: exampleAwsLambdaFunction.arn,
 *     name: "example",
 *     triggerTypes: ["ConfigurationItemChangeNotification"],
 * }, {
 *     dependsOn: [
 *         example,
 *         exampleOrganization,
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * example = aws.lambda_.Permission("example",
 *     action="lambda:InvokeFunction",
 *     function=example_aws_lambda_function["arn"],
 *     principal="config.amazonaws.com",
 *     statement_id="AllowExecutionFromConfig")
 * example_organization = aws.organizations.Organization("example",
 *     aws_service_access_principals=["config-multiaccountsetup.amazonaws.com"],
 *     feature_set="ALL")
 * example_organization_custom_rule = aws.cfg.OrganizationCustomRule("example",
 *     lambda_function_arn=example_aws_lambda_function["arn"],
 *     name="example",
 *     trigger_types=["ConfigurationItemChangeNotification"],
 *     opts = pulumi.ResourceOptions(depends_on=[
 *             example,
 *             example_organization,
 *         ]))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Aws.Lambda.Permission("example", new()
 *     {
 *         Action = "lambda:InvokeFunction",
 *         Function = exampleAwsLambdaFunction.Arn,
 *         Principal = "config.amazonaws.com",
 *         StatementId = "AllowExecutionFromConfig",
 *     });
 *     var exampleOrganization = new Aws.Organizations.Organization("example", new()
 *     {
 *         AwsServiceAccessPrincipals = new[]
 *         {
 *             "config-multiaccountsetup.amazonaws.com",
 *         },
 *         FeatureSet = "ALL",
 *     });
 *     var exampleOrganizationCustomRule = new Aws.Cfg.OrganizationCustomRule("example", new()
 *     {
 *         LambdaFunctionArn = exampleAwsLambdaFunction.Arn,
 *         Name = "example",
 *         TriggerTypes = new[]
 *         {
 *             "ConfigurationItemChangeNotification",
 *         },
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             example,
 *             exampleOrganization,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cfg"
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda"
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/organizations"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := lambda.NewPermission(ctx, "example", &lambda.PermissionArgs{
 * 			Action:      pulumi.String("lambda:InvokeFunction"),
 * 			Function:    pulumi.Any(exampleAwsLambdaFunction.Arn),
 * 			Principal:   pulumi.String("config.amazonaws.com"),
 * 			StatementId: pulumi.String("AllowExecutionFromConfig"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleOrganization, err := organizations.NewOrganization(ctx, "example", &organizations.OrganizationArgs{
 * 			AwsServiceAccessPrincipals: pulumi.StringArray{
 * 				pulumi.String("config-multiaccountsetup.amazonaws.com"),
 * 			},
 * 			FeatureSet: pulumi.String("ALL"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = cfg.NewOrganizationCustomRule(ctx, "example", &cfg.OrganizationCustomRuleArgs{
 * 			LambdaFunctionArn: pulumi.Any(exampleAwsLambdaFunction.Arn),
 * 			Name:              pulumi.String("example"),
 * 			TriggerTypes: pulumi.StringArray{
 * 				pulumi.String("ConfigurationItemChangeNotification"),
 * 			},
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			example,
 * 			exampleOrganization,
 * 		}))
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.aws.lambda.Permission;
 * import com.pulumi.aws.lambda.PermissionArgs;
 * import com.pulumi.aws.organizations.Organization;
 * import com.pulumi.aws.organizations.OrganizationArgs;
 * import com.pulumi.aws.cfg.OrganizationCustomRule;
 * import com.pulumi.aws.cfg.OrganizationCustomRuleArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * import java.util.List;
 * import java.util.ArrayList;
 * 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 Permission("example", PermissionArgs.builder()
 *             .action("lambda:InvokeFunction")
 *             .function(exampleAwsLambdaFunction.arn())
 *             .principal("config.amazonaws.com")
 *             .statementId("AllowExecutionFromConfig")
 *             .build());
 *         var exampleOrganization = new Organization("exampleOrganization", OrganizationArgs.builder()
 *             .awsServiceAccessPrincipals("config-multiaccountsetup.amazonaws.com")
 *             .featureSet("ALL")
 *             .build());
 *         var exampleOrganizationCustomRule = new OrganizationCustomRule("exampleOrganizationCustomRule", OrganizationCustomRuleArgs.builder()
 *             .lambdaFunctionArn(exampleAwsLambdaFunction.arn())
 *             .name("example")
 *             .triggerTypes("ConfigurationItemChangeNotification")
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(
 *                     example,
 *                     exampleOrganization)
 *                 .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: aws:lambda:Permission
 *     properties:
 *       action: lambda:InvokeFunction
 *       function: ${exampleAwsLambdaFunction.arn}
 *       principal: config.amazonaws.com
 *       statementId: AllowExecutionFromConfig
 *   exampleOrganization:
 *     type: aws:organizations:Organization
 *     name: example
 *     properties:
 *       awsServiceAccessPrincipals:
 *         - config-multiaccountsetup.amazonaws.com
 *       featureSet: ALL
 *   exampleOrganizationCustomRule:
 *     type: aws:cfg:OrganizationCustomRule
 *     name: example
 *     properties:
 *       lambdaFunctionArn: ${exampleAwsLambdaFunction.arn}
 *       name: example
 *       triggerTypes:
 *         - ConfigurationItemChangeNotification
 *     options:
 *       dependson:
 *         - ${example}
 *         - ${exampleOrganization}
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import Config Organization Custom Rules using the name. For example:
 * ```sh
 * $ pulumi import aws:cfg/organizationCustomRule:OrganizationCustomRule example example
 * ```
 * @property description Description of the rule
 * @property excludedAccounts List of AWS account identifiers to exclude from the rule
 * @property inputParameters A string in JSON format that is passed to the AWS Config Rule Lambda Function
 * @property lambdaFunctionArn Amazon Resource Name (ARN) of the rule Lambda Function
 * @property maximumExecutionFrequency The 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`.
 * @property name The name of the rule
 * @property resourceIdScope Identifier of the AWS resource to evaluate
 * @property resourceTypesScopes List of types of AWS resources to evaluate
 * @property tagKeyScope Tag key of AWS resources to evaluate
 * @property tagValueScope Tag value of AWS resources to evaluate
 * @property triggerTypes List of notification types that trigger AWS Config to run an evaluation for the rule. Valid values: `ConfigurationItemChangeNotification`, `OversizedConfigurationItemChangeNotification`, and `ScheduledNotification`
 */
public data class OrganizationCustomRuleArgs(
    public val description: Output? = null,
    public val excludedAccounts: Output>? = null,
    public val inputParameters: Output? = null,
    public val lambdaFunctionArn: Output? = null,
    public val maximumExecutionFrequency: Output? = null,
    public val name: Output? = null,
    public val resourceIdScope: Output? = null,
    public val resourceTypesScopes: Output>? = null,
    public val tagKeyScope: Output? = null,
    public val tagValueScope: Output? = null,
    public val triggerTypes: Output>? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.aws.cfg.OrganizationCustomRuleArgs =
        com.pulumi.aws.cfg.OrganizationCustomRuleArgs.builder()
            .description(description?.applyValue({ args0 -> args0 }))
            .excludedAccounts(excludedAccounts?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .inputParameters(inputParameters?.applyValue({ args0 -> args0 }))
            .lambdaFunctionArn(lambdaFunctionArn?.applyValue({ args0 -> args0 }))
            .maximumExecutionFrequency(maximumExecutionFrequency?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .resourceIdScope(resourceIdScope?.applyValue({ args0 -> args0 }))
            .resourceTypesScopes(resourceTypesScopes?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .tagKeyScope(tagKeyScope?.applyValue({ args0 -> args0 }))
            .tagValueScope(tagValueScope?.applyValue({ args0 -> args0 }))
            .triggerTypes(triggerTypes?.applyValue({ args0 -> args0.map({ args0 -> args0 }) })).build()
}

/**
 * Builder for [OrganizationCustomRuleArgs].
 */
@PulumiTagMarker
public class OrganizationCustomRuleArgsBuilder internal constructor() {
    private var description: Output? = null

    private var excludedAccounts: Output>? = null

    private var inputParameters: Output? = null

    private var lambdaFunctionArn: Output? = null

    private var maximumExecutionFrequency: Output? = null

    private var name: Output? = null

    private var resourceIdScope: Output? = null

    private var resourceTypesScopes: Output>? = null

    private var tagKeyScope: Output? = null

    private var tagValueScope: Output? = null

    private var triggerTypes: Output>? = null

    /**
     * @param value Description of the rule
     */
    @JvmName("dbjiuatopolwbsas")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value List of AWS account identifiers to exclude from the rule
     */
    @JvmName("djttjtvinngsfdjl")
    public suspend fun excludedAccounts(`value`: Output>) {
        this.excludedAccounts = value
    }

    @JvmName("sixmsowawbwxhkvw")
    public suspend fun excludedAccounts(vararg values: Output) {
        this.excludedAccounts = Output.all(values.asList())
    }

    /**
     * @param values List of AWS account identifiers to exclude from the rule
     */
    @JvmName("bpuambvwfxguiqgf")
    public suspend fun excludedAccounts(values: List>) {
        this.excludedAccounts = Output.all(values)
    }

    /**
     * @param value A string in JSON format that is passed to the AWS Config Rule Lambda Function
     */
    @JvmName("bsecaemejnuqngax")
    public suspend fun inputParameters(`value`: Output) {
        this.inputParameters = value
    }

    /**
     * @param value Amazon Resource Name (ARN) of the rule Lambda Function
     */
    @JvmName("jmuypjmadoyftfls")
    public suspend fun lambdaFunctionArn(`value`: Output) {
        this.lambdaFunctionArn = value
    }

    /**
     * @param value The 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`.
     */
    @JvmName("cuosibkabarlcpgl")
    public suspend fun maximumExecutionFrequency(`value`: Output) {
        this.maximumExecutionFrequency = value
    }

    /**
     * @param value The name of the rule
     */
    @JvmName("qxxenshwiqblutrc")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value Identifier of the AWS resource to evaluate
     */
    @JvmName("hchfholpdcqgoxde")
    public suspend fun resourceIdScope(`value`: Output) {
        this.resourceIdScope = value
    }

    /**
     * @param value List of types of AWS resources to evaluate
     */
    @JvmName("cywicwnikcfkbmvp")
    public suspend fun resourceTypesScopes(`value`: Output>) {
        this.resourceTypesScopes = value
    }

    @JvmName("dsnrlsrowkeiaecg")
    public suspend fun resourceTypesScopes(vararg values: Output) {
        this.resourceTypesScopes = Output.all(values.asList())
    }

    /**
     * @param values List of types of AWS resources to evaluate
     */
    @JvmName("yhcxqiwslhcypxyt")
    public suspend fun resourceTypesScopes(values: List>) {
        this.resourceTypesScopes = Output.all(values)
    }

    /**
     * @param value Tag key of AWS resources to evaluate
     */
    @JvmName("visrbmrtvmnxxvad")
    public suspend fun tagKeyScope(`value`: Output) {
        this.tagKeyScope = value
    }

    /**
     * @param value Tag value of AWS resources to evaluate
     */
    @JvmName("xdrvqnpbxbbvhdsx")
    public suspend fun tagValueScope(`value`: Output) {
        this.tagValueScope = value
    }

    /**
     * @param value List of notification types that trigger AWS Config to run an evaluation for the rule. Valid values: `ConfigurationItemChangeNotification`, `OversizedConfigurationItemChangeNotification`, and `ScheduledNotification`
     */
    @JvmName("wilwdkqnwguloqvb")
    public suspend fun triggerTypes(`value`: Output>) {
        this.triggerTypes = value
    }

    @JvmName("rajjneyycqvbvqnv")
    public suspend fun triggerTypes(vararg values: Output) {
        this.triggerTypes = Output.all(values.asList())
    }

    /**
     * @param values List of notification types that trigger AWS Config to run an evaluation for the rule. Valid values: `ConfigurationItemChangeNotification`, `OversizedConfigurationItemChangeNotification`, and `ScheduledNotification`
     */
    @JvmName("wgbkgmntmmpqxqyh")
    public suspend fun triggerTypes(values: List>) {
        this.triggerTypes = Output.all(values)
    }

    /**
     * @param value Description of the rule
     */
    @JvmName("blgqtfyjpvdsauhp")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value List of AWS account identifiers to exclude from the rule
     */
    @JvmName("tsvuevrijpybjloi")
    public suspend fun excludedAccounts(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.excludedAccounts = mapped
    }

    /**
     * @param values List of AWS account identifiers to exclude from the rule
     */
    @JvmName("lahixasrgormyqww")
    public suspend fun excludedAccounts(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.excludedAccounts = mapped
    }

    /**
     * @param value A string in JSON format that is passed to the AWS Config Rule Lambda Function
     */
    @JvmName("ifwkynqjrcsnjxin")
    public suspend fun inputParameters(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.inputParameters = mapped
    }

    /**
     * @param value Amazon Resource Name (ARN) of the rule Lambda Function
     */
    @JvmName("tlstalpjcbbcuybv")
    public suspend fun lambdaFunctionArn(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.lambdaFunctionArn = mapped
    }

    /**
     * @param value The 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`.
     */
    @JvmName("ikfilonafujefahn")
    public suspend fun maximumExecutionFrequency(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.maximumExecutionFrequency = mapped
    }

    /**
     * @param value The name of the rule
     */
    @JvmName("kxwppusnkrseresg")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value Identifier of the AWS resource to evaluate
     */
    @JvmName("mjkxoknuusxhjcfa")
    public suspend fun resourceIdScope(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceIdScope = mapped
    }

    /**
     * @param value List of types of AWS resources to evaluate
     */
    @JvmName("edrgaheuslrffjjc")
    public suspend fun resourceTypesScopes(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceTypesScopes = mapped
    }

    /**
     * @param values List of types of AWS resources to evaluate
     */
    @JvmName("aoxabbhdssvuegaj")
    public suspend fun resourceTypesScopes(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.resourceTypesScopes = mapped
    }

    /**
     * @param value Tag key of AWS resources to evaluate
     */
    @JvmName("rwfmpogcaqewkqcu")
    public suspend fun tagKeyScope(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tagKeyScope = mapped
    }

    /**
     * @param value Tag value of AWS resources to evaluate
     */
    @JvmName("gtolmrgaexcbuxug")
    public suspend fun tagValueScope(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tagValueScope = mapped
    }

    /**
     * @param value List of notification types that trigger AWS Config to run an evaluation for the rule. Valid values: `ConfigurationItemChangeNotification`, `OversizedConfigurationItemChangeNotification`, and `ScheduledNotification`
     */
    @JvmName("swxhrdsfwqttcbsn")
    public suspend fun triggerTypes(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.triggerTypes = mapped
    }

    /**
     * @param values List of notification types that trigger AWS Config to run an evaluation for the rule. Valid values: `ConfigurationItemChangeNotification`, `OversizedConfigurationItemChangeNotification`, and `ScheduledNotification`
     */
    @JvmName("rtxigvycwldjnevg")
    public suspend fun triggerTypes(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.triggerTypes = mapped
    }

    internal fun build(): OrganizationCustomRuleArgs = OrganizationCustomRuleArgs(
        description = description,
        excludedAccounts = excludedAccounts,
        inputParameters = inputParameters,
        lambdaFunctionArn = lambdaFunctionArn,
        maximumExecutionFrequency = maximumExecutionFrequency,
        name = name,
        resourceIdScope = resourceIdScope,
        resourceTypesScopes = resourceTypesScopes,
        tagKeyScope = tagKeyScope,
        tagValueScope = tagValueScope,
        triggerTypes = triggerTypes,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy