ControlTowerControl class

Allows the application of pre-defined controls to organizational units. For more information on usage, please see the AWS Control Tower User Guide.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const current = aws.getRegion({});
const example = aws.organizations.getOrganization({});
const exampleGetOrganizationalUnits = example.then(example => aws.organizations.getOrganizationalUnits({
    parentId: example.roots?.[0]?.id,
}));
const exampleControlTowerControl = new aws.controltower.ControlTowerControl("example", {
    parameters: [{
        key: "AllowedRegions",
        value: JSON.stringify(["us-east-1"]),
    }],
    controlIdentifier: current.then(current => `arn:aws:controltower:${current.region}::control/AWS-GR_EC2_VOLUME_INUSE_CHECK`),
    targetIdentifier: exampleGetOrganizationalUnits.then(exampleGetOrganizationalUnits => .filter(x => x.name == "Infrastructure").map(x => (x.arn))[0]),
});
import pulumi
import json
import pulumi_aws as aws

current = aws.get_region()
example = aws.organizations.get_organization()
example_get_organizational_units = aws.organizations.get_organizational_units(parent_id=example.roots[0].id)
example_control_tower_control = aws.controltower.ControlTowerControl("example",
    parameters=[{
        "key": "AllowedRegions",
        "value": json.dumps(["us-east-1"]),
    }],
    control_identifier=f"arn:aws:controltower:{current.region}::control/AWS-GR_EC2_VOLUME_INUSE_CHECK",
    target_identifier=[x.arn for x in example_get_organizational_units.children if x.name == "Infrastructure"][0])
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var current = Aws.GetRegion.Invoke();

    var example = Aws.Organizations.GetOrganization.Invoke();

    var exampleGetOrganizationalUnits = Aws.Organizations.GetOrganizationalUnits.Invoke(new()
    {
        ParentId = example.Apply(getOrganizationResult => getOrganizationResult.Roots[0]?.Id),
    });

    var exampleControlTowerControl = new Aws.ControlTower.ControlTowerControl("example", new()
    {
        Parameters = new[]
        {
            new Aws.ControlTower.Inputs.ControlTowerControlParameterArgs
            {
                Key = "AllowedRegions",
                Value = JsonSerializer.Serialize(new[]
                {
                    "us-east-1",
                }),
            },
        },
        ControlIdentifier = $"arn:aws:controltower:{current.Apply(getRegionResult => getRegionResult.Region)}::control/AWS-GR_EC2_VOLUME_INUSE_CHECK",
        TargetIdentifier = .Where(x => x.Name == "Infrastructure").Select(x =>
        {
            return x.Arn;
        }).ToList()[0],
    });

});
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

data "aws_getregion" "current" {
}
data "aws_organizations_getorganization" "example" {
}
data "aws_organizations_getorganizationalunits" "exampleGetOrganizationalUnits" {
  parent_id = data.aws_organizations_getorganization.example.roots[0].id
}

resource "aws_controltower_controltowercontrol" "example" {
  parameters {
    key   = "AllowedRegions"
    value = jsonencode(["us-east-1"])
  }
  control_identifier ="arn:aws:controltower:${data.aws_getregion.current.region}::control/AWS-GR_EC2_VOLUME_INUSE_CHECK"
  target_identifier  = [for x in data.aws_organizations_getorganizationalunits.exampleGetOrganizationalUnits.children : x.arn if x.name == "Infrastructure"][0]
}

Import

Using pulumi import, import Control Tower Controls using their organizational_unit_arn/control_identifier. For example:

$ pulumi import aws:controltower/controlTowerControl:ControlTowerControl example arn:aws:organizations::123456789101:ou/o-qqaejywet/ou-qg5o-ufbhdtv3,arn:aws:controltower:us-east-1::control/WTDSMKDKDNLE

Constructors

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

Properties

arn ↔ Output<String>
The ARN of the EnabledControl resource.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
controlIdentifier ↔ Output<String>
The ARN of the control. Only Strongly recommended and Elective controls are permitted, with the exception of the Region deny guardrail.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
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
parameters ↔ Output<List<ControlTowerControlParameter>?>
Parameter values which are specified to configure the control when you enable it. See Parameters for more details.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
targetIdentifier ↔ Output<String>
The ARN of the organizational unit.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
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, {ControlTowerControlState? state, CustomResourceOptions? options}) → ControlTowerControl
Gets an existing ControlTowerControl resource's state with the given name and id.