Skip to content

Resource: awsDirectoryServiceSharedDirectory

Manages a directory in your account (directory owner) shared with another account (directory consumer).

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsDirectoryServiceDirectoryExample =
  new aws.directoryServiceDirectory.DirectoryServiceDirectory(this, "example", {
    edition: "Standard",
    name: "tf-example",
    password: "SuperSecretPassw0rd",
    type: "MicrosoftAD",
    vpcSettings: {
      subnetIds: "${aws_subnet.example[*].id}",
      vpcId: "${aws_vpc.example.id}",
    },
  });
const awsDirectoryServiceSharedDirectoryExample =
  new aws.directoryServiceSharedDirectory.DirectoryServiceSharedDirectory(
    this,
    "example_1",
    {
      directoryId: awsDirectoryServiceDirectoryExample.id,
      notes: "You wanna have a catch?",
      target: {
        id: "${data.aws_caller_identity.receiver.account_id}",
      },
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsDirectoryServiceSharedDirectoryExample.overrideLogicalId("example");

Argument Reference

The following arguments are required:

  • directoryId - (Required) Identifier of the Managed Microsoft AD directory that you want to share with other accounts.
  • target - (Required) Identifier for the directory consumer account with whom the directory is to be shared. See below.

The following arguments are optional:

  • method - (Optional) Method used when sharing a directory. Valid values are organizations and handshake. Default is handshake.
  • notes - (Optional, Sensitive) Message sent by the directory owner to the directory consumer to help the directory consumer administrator determine whether to approve or reject the share invitation.

target

  • id - (Required) Identifier of the directory consumer account.
  • type - (Optional) Type of identifier to be used in the id field. Valid value is account. Default is account.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - Identifier of the shared directory.
  • sharedDirectoryId - Identifier of the directory that is stored in the directory consumer account that corresponds to the shared directory in the owner account.

Timeouts

awsDirectoryServiceSharedDirectory provides the following Timeouts configuration options:

  • delete - (Default 60Minutes) Used for shared directory deletion

Import

Directory Service Shared Directories can be imported using the owner directory ID/shared directory ID, e.g.,

$ terraform import aws_directory_service_shared_directory.example d-1234567890/d-9267633ece