1. Packages
  2. AWS Classic
  3. API Docs
  4. directoryservice
  5. SharedDirectory

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.40.0 published on Wednesday, Jun 12, 2024 by Pulumi

aws.directoryservice.SharedDirectory

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.40.0 published on Wednesday, Jun 12, 2024 by Pulumi

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

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.directoryservice.Directory("example", {
        name: "tf-example",
        password: "SuperSecretPassw0rd",
        type: "MicrosoftAD",
        edition: "Standard",
        vpcSettings: {
            vpcId: exampleAwsVpc.id,
            subnetIds: exampleAwsSubnet.map(__item => __item.id),
        },
    });
    const exampleSharedDirectory = new aws.directoryservice.SharedDirectory("example", {
        directoryId: example.id,
        notes: "You wanna have a catch?",
        target: {
            id: receiver.accountId,
        },
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.directoryservice.Directory("example",
        name="tf-example",
        password="SuperSecretPassw0rd",
        type="MicrosoftAD",
        edition="Standard",
        vpc_settings=aws.directoryservice.DirectoryVpcSettingsArgs(
            vpc_id=example_aws_vpc["id"],
            subnet_ids=[__item["id"] for __item in example_aws_subnet],
        ))
    example_shared_directory = aws.directoryservice.SharedDirectory("example",
        directory_id=example.id,
        notes="You wanna have a catch?",
        target=aws.directoryservice.SharedDirectoryTargetArgs(
            id=receiver["accountId"],
        ))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/directoryservice"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
    example, err := directoryservice.NewDirectory(ctx, "example", &directoryservice.DirectoryArgs{
    Name: pulumi.String("tf-example"),
    Password: pulumi.String("SuperSecretPassw0rd"),
    Type: pulumi.String("MicrosoftAD"),
    Edition: pulumi.String("Standard"),
    VpcSettings: &directoryservice.DirectoryVpcSettingsArgs{
    VpcId: pulumi.Any(exampleAwsVpc.Id),
    SubnetIds: %!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ example.pp:7,17-39),
    },
    })
    if err != nil {
    return err
    }
    _, err = directoryservice.NewSharedDirectory(ctx, "example", &directoryservice.SharedDirectoryArgs{
    DirectoryId: example.ID(),
    Notes: pulumi.String("You wanna have a catch?"),
    Target: &directoryservice.SharedDirectoryTargetArgs{
    Id: pulumi.Any(receiver.AccountId),
    },
    })
    if err != nil {
    return err
    }
    return nil
    })
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.DirectoryService.Directory("example", new()
        {
            Name = "tf-example",
            Password = "SuperSecretPassw0rd",
            Type = "MicrosoftAD",
            Edition = "Standard",
            VpcSettings = new Aws.DirectoryService.Inputs.DirectoryVpcSettingsArgs
            {
                VpcId = exampleAwsVpc.Id,
                SubnetIds = exampleAwsSubnet.Select(__item => __item.Id).ToList(),
            },
        });
    
        var exampleSharedDirectory = new Aws.DirectoryService.SharedDirectory("example", new()
        {
            DirectoryId = example.Id,
            Notes = "You wanna have a catch?",
            Target = new Aws.DirectoryService.Inputs.SharedDirectoryTargetArgs
            {
                Id = receiver.AccountId,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.directoryservice.Directory;
    import com.pulumi.aws.directoryservice.DirectoryArgs;
    import com.pulumi.aws.directoryservice.inputs.DirectoryVpcSettingsArgs;
    import com.pulumi.aws.directoryservice.SharedDirectory;
    import com.pulumi.aws.directoryservice.SharedDirectoryArgs;
    import com.pulumi.aws.directoryservice.inputs.SharedDirectoryTargetArgs;
    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 Directory("example", DirectoryArgs.builder()
                .name("tf-example")
                .password("SuperSecretPassw0rd")
                .type("MicrosoftAD")
                .edition("Standard")
                .vpcSettings(DirectoryVpcSettingsArgs.builder()
                    .vpcId(exampleAwsVpc.id())
                    .subnetIds(exampleAwsSubnet.stream().map(element -> element.id()).collect(toList()))
                    .build())
                .build());
    
            var exampleSharedDirectory = new SharedDirectory("exampleSharedDirectory", SharedDirectoryArgs.builder()
                .directoryId(example.id())
                .notes("You wanna have a catch?")
                .target(SharedDirectoryTargetArgs.builder()
                    .id(receiver.accountId())
                    .build())
                .build());
    
        }
    }
    
    Coming soon!
    

    Create SharedDirectory Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new SharedDirectory(name: string, args: SharedDirectoryArgs, opts?: CustomResourceOptions);
    @overload
    def SharedDirectory(resource_name: str,
                        args: SharedDirectoryArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def SharedDirectory(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        directory_id: Optional[str] = None,
                        target: Optional[SharedDirectoryTargetArgs] = None,
                        method: Optional[str] = None,
                        notes: Optional[str] = None)
    func NewSharedDirectory(ctx *Context, name string, args SharedDirectoryArgs, opts ...ResourceOption) (*SharedDirectory, error)
    public SharedDirectory(string name, SharedDirectoryArgs args, CustomResourceOptions? opts = null)
    public SharedDirectory(String name, SharedDirectoryArgs args)
    public SharedDirectory(String name, SharedDirectoryArgs args, CustomResourceOptions options)
    
    type: aws:directoryservice:SharedDirectory
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args SharedDirectoryArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args SharedDirectoryArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args SharedDirectoryArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SharedDirectoryArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SharedDirectoryArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var sharedDirectoryResource = new Aws.DirectoryService.SharedDirectory("sharedDirectoryResource", new()
    {
        DirectoryId = "string",
        Target = new Aws.DirectoryService.Inputs.SharedDirectoryTargetArgs
        {
            Id = "string",
            Type = "string",
        },
        Method = "string",
        Notes = "string",
    });
    
    example, err := directoryservice.NewSharedDirectory(ctx, "sharedDirectoryResource", &directoryservice.SharedDirectoryArgs{
    	DirectoryId: pulumi.String("string"),
    	Target: &directoryservice.SharedDirectoryTargetArgs{
    		Id:   pulumi.String("string"),
    		Type: pulumi.String("string"),
    	},
    	Method: pulumi.String("string"),
    	Notes:  pulumi.String("string"),
    })
    
    var sharedDirectoryResource = new SharedDirectory("sharedDirectoryResource", SharedDirectoryArgs.builder()
        .directoryId("string")
        .target(SharedDirectoryTargetArgs.builder()
            .id("string")
            .type("string")
            .build())
        .method("string")
        .notes("string")
        .build());
    
    shared_directory_resource = aws.directoryservice.SharedDirectory("sharedDirectoryResource",
        directory_id="string",
        target=aws.directoryservice.SharedDirectoryTargetArgs(
            id="string",
            type="string",
        ),
        method="string",
        notes="string")
    
    const sharedDirectoryResource = new aws.directoryservice.SharedDirectory("sharedDirectoryResource", {
        directoryId: "string",
        target: {
            id: "string",
            type: "string",
        },
        method: "string",
        notes: "string",
    });
    
    type: aws:directoryservice:SharedDirectory
    properties:
        directoryId: string
        method: string
        notes: string
        target:
            id: string
            type: string
    

    SharedDirectory Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The SharedDirectory resource accepts the following input properties:

    DirectoryId string
    Identifier of the Managed Microsoft AD directory that you want to share with other accounts.
    Target SharedDirectoryTarget

    Identifier for the directory consumer account with whom the directory is to be shared. See below.

    The following arguments are optional:

    Method string
    Method used when sharing a directory. Valid values are ORGANIZATIONS and HANDSHAKE. Default is HANDSHAKE.
    Notes string
    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.
    DirectoryId string
    Identifier of the Managed Microsoft AD directory that you want to share with other accounts.
    Target SharedDirectoryTargetArgs

    Identifier for the directory consumer account with whom the directory is to be shared. See below.

    The following arguments are optional:

    Method string
    Method used when sharing a directory. Valid values are ORGANIZATIONS and HANDSHAKE. Default is HANDSHAKE.
    Notes string
    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.
    directoryId String
    Identifier of the Managed Microsoft AD directory that you want to share with other accounts.
    target SharedDirectoryTarget

    Identifier for the directory consumer account with whom the directory is to be shared. See below.

    The following arguments are optional:

    method String
    Method used when sharing a directory. Valid values are ORGANIZATIONS and HANDSHAKE. Default is HANDSHAKE.
    notes String
    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.
    directoryId string
    Identifier of the Managed Microsoft AD directory that you want to share with other accounts.
    target SharedDirectoryTarget

    Identifier for the directory consumer account with whom the directory is to be shared. See below.

    The following arguments are optional:

    method string
    Method used when sharing a directory. Valid values are ORGANIZATIONS and HANDSHAKE. Default is HANDSHAKE.
    notes string
    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.
    directory_id str
    Identifier of the Managed Microsoft AD directory that you want to share with other accounts.
    target SharedDirectoryTargetArgs

    Identifier for the directory consumer account with whom the directory is to be shared. See below.

    The following arguments are optional:

    method str
    Method used when sharing a directory. Valid values are ORGANIZATIONS and HANDSHAKE. Default is HANDSHAKE.
    notes str
    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.
    directoryId String
    Identifier of the Managed Microsoft AD directory that you want to share with other accounts.
    target Property Map

    Identifier for the directory consumer account with whom the directory is to be shared. See below.

    The following arguments are optional:

    method String
    Method used when sharing a directory. Valid values are ORGANIZATIONS and HANDSHAKE. Default is HANDSHAKE.
    notes String
    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.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the SharedDirectory resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    SharedDirectoryId string
    Identifier of the directory that is stored in the directory consumer account that corresponds to the shared directory in the owner account.
    Id string
    The provider-assigned unique ID for this managed resource.
    SharedDirectoryId string
    Identifier of the directory that is stored in the directory consumer account that corresponds to the shared directory in the owner account.
    id String
    The provider-assigned unique ID for this managed resource.
    sharedDirectoryId String
    Identifier of the directory that is stored in the directory consumer account that corresponds to the shared directory in the owner account.
    id string
    The provider-assigned unique ID for this managed resource.
    sharedDirectoryId string
    Identifier of the directory that is stored in the directory consumer account that corresponds to the shared directory in the owner account.
    id str
    The provider-assigned unique ID for this managed resource.
    shared_directory_id str
    Identifier of the directory that is stored in the directory consumer account that corresponds to the shared directory in the owner account.
    id String
    The provider-assigned unique ID for this managed resource.
    sharedDirectoryId String
    Identifier of the directory that is stored in the directory consumer account that corresponds to the shared directory in the owner account.

    Look up Existing SharedDirectory Resource

    Get an existing SharedDirectory resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: SharedDirectoryState, opts?: CustomResourceOptions): SharedDirectory
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            directory_id: Optional[str] = None,
            method: Optional[str] = None,
            notes: Optional[str] = None,
            shared_directory_id: Optional[str] = None,
            target: Optional[SharedDirectoryTargetArgs] = None) -> SharedDirectory
    func GetSharedDirectory(ctx *Context, name string, id IDInput, state *SharedDirectoryState, opts ...ResourceOption) (*SharedDirectory, error)
    public static SharedDirectory Get(string name, Input<string> id, SharedDirectoryState? state, CustomResourceOptions? opts = null)
    public static SharedDirectory get(String name, Output<String> id, SharedDirectoryState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    DirectoryId string
    Identifier of the Managed Microsoft AD directory that you want to share with other accounts.
    Method string
    Method used when sharing a directory. Valid values are ORGANIZATIONS and HANDSHAKE. Default is HANDSHAKE.
    Notes string
    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.
    SharedDirectoryId string
    Identifier of the directory that is stored in the directory consumer account that corresponds to the shared directory in the owner account.
    Target SharedDirectoryTarget

    Identifier for the directory consumer account with whom the directory is to be shared. See below.

    The following arguments are optional:

    DirectoryId string
    Identifier of the Managed Microsoft AD directory that you want to share with other accounts.
    Method string
    Method used when sharing a directory. Valid values are ORGANIZATIONS and HANDSHAKE. Default is HANDSHAKE.
    Notes string
    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.
    SharedDirectoryId string
    Identifier of the directory that is stored in the directory consumer account that corresponds to the shared directory in the owner account.
    Target SharedDirectoryTargetArgs

    Identifier for the directory consumer account with whom the directory is to be shared. See below.

    The following arguments are optional:

    directoryId String
    Identifier of the Managed Microsoft AD directory that you want to share with other accounts.
    method String
    Method used when sharing a directory. Valid values are ORGANIZATIONS and HANDSHAKE. Default is HANDSHAKE.
    notes String
    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.
    sharedDirectoryId String
    Identifier of the directory that is stored in the directory consumer account that corresponds to the shared directory in the owner account.
    target SharedDirectoryTarget

    Identifier for the directory consumer account with whom the directory is to be shared. See below.

    The following arguments are optional:

    directoryId string
    Identifier of the Managed Microsoft AD directory that you want to share with other accounts.
    method string
    Method used when sharing a directory. Valid values are ORGANIZATIONS and HANDSHAKE. Default is HANDSHAKE.
    notes string
    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.
    sharedDirectoryId string
    Identifier of the directory that is stored in the directory consumer account that corresponds to the shared directory in the owner account.
    target SharedDirectoryTarget

    Identifier for the directory consumer account with whom the directory is to be shared. See below.

    The following arguments are optional:

    directory_id str
    Identifier of the Managed Microsoft AD directory that you want to share with other accounts.
    method str
    Method used when sharing a directory. Valid values are ORGANIZATIONS and HANDSHAKE. Default is HANDSHAKE.
    notes str
    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.
    shared_directory_id str
    Identifier of the directory that is stored in the directory consumer account that corresponds to the shared directory in the owner account.
    target SharedDirectoryTargetArgs

    Identifier for the directory consumer account with whom the directory is to be shared. See below.

    The following arguments are optional:

    directoryId String
    Identifier of the Managed Microsoft AD directory that you want to share with other accounts.
    method String
    Method used when sharing a directory. Valid values are ORGANIZATIONS and HANDSHAKE. Default is HANDSHAKE.
    notes String
    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.
    sharedDirectoryId String
    Identifier of the directory that is stored in the directory consumer account that corresponds to the shared directory in the owner account.
    target Property Map

    Identifier for the directory consumer account with whom the directory is to be shared. See below.

    The following arguments are optional:

    Supporting Types

    SharedDirectoryTarget, SharedDirectoryTargetArgs

    Id string
    Identifier of the directory consumer account.
    Type string
    Type of identifier to be used in the id field. Valid value is ACCOUNT. Default is ACCOUNT.
    Id string
    Identifier of the directory consumer account.
    Type string
    Type of identifier to be used in the id field. Valid value is ACCOUNT. Default is ACCOUNT.
    id String
    Identifier of the directory consumer account.
    type String
    Type of identifier to be used in the id field. Valid value is ACCOUNT. Default is ACCOUNT.
    id string
    Identifier of the directory consumer account.
    type string
    Type of identifier to be used in the id field. Valid value is ACCOUNT. Default is ACCOUNT.
    id str
    Identifier of the directory consumer account.
    type str
    Type of identifier to be used in the id field. Valid value is ACCOUNT. Default is ACCOUNT.
    id String
    Identifier of the directory consumer account.
    type String
    Type of identifier to be used in the id field. Valid value is ACCOUNT. Default is ACCOUNT.

    Import

    Using pulumi import, import Directory Service Shared Directories using the owner directory ID/shared directory ID. For example:

    $ pulumi import aws:directoryservice/sharedDirectory:SharedDirectory example d-1234567890/d-9267633ece
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.40.0 published on Wednesday, Jun 12, 2024 by Pulumi