1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. resourcemanager
  5. ResourceDirectory
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

alicloud.resourcemanager.ResourceDirectory

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

    Provides a Resource Manager Resource Directory resource. Resource Directory enables you to establish an organizational structure for the resources used by applications of your enterprise. You can plan, build, and manage the resources in a centralized manner by using only one resource directory.

    For information about Resource Manager Resource Directory and how to use it, see What is Resource Manager Resource Directory.

    NOTE: Available since v1.84.0.

    NOTE: An account can only be used to enable a resource directory after it passes enterprise real-name verification. An account that only passed individual real-name verification cannot be used to enable a resource directory.

    NOTE: Before you destroy the resource, make sure that the following requirements are met:

    • All member accounts must be removed from the resource directory.
    • All folders except the root folder must be deleted from the resource directory.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    export = async () => {
        const default = await alicloud.resourcemanager.getResourceDirectories({});
        const defaultResourceDirectory: alicloud.resourcemanager.ResourceDirectory[] = [];
        for (const range = {value: 0}; range.value < (_default.directories.length > 0 ? 0 : 1); range.value++) {
            defaultResourceDirectory.push(new alicloud.resourcemanager.ResourceDirectory(`default-${range.value}`, {status: "Enabled"}));
        }
    }
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    default = alicloud.resourcemanager.get_resource_directories()
    default_resource_directory = []
    for range in [{"value": i} for i in range(0, 0 if len(default.directories) > 0 else 1)]:
        default_resource_directory.append(alicloud.resourcemanager.ResourceDirectory(f"default-{range['value']}", status="Enabled"))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/resourcemanager"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
    _default, err := resourcemanager.GetResourceDirectories(ctx, nil, nil);
    if err != nil {
    return err
    }
    var defaultResourceDirectory []*resourcemanager.ResourceDirectory
    for index := 0; index < %!v(PANIC=Format method: fatal: A failure has occurred: unlowered conditional expression @ example.pp:5,13-52); index++ {
        key0 := index
        _ := index
    __res, err := resourcemanager.NewResourceDirectory(ctx, fmt.Sprintf("default-%v", key0), &resourcemanager.ResourceDirectoryArgs{
    Status: pulumi.String("Enabled"),
    })
    if err != nil {
    return err
    }
    defaultResourceDirectory = append(defaultResourceDirectory, __res)
    }
    return nil
    })
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(async() => 
    {
        var @default = await AliCloud.ResourceManager.GetResourceDirectories.InvokeAsync();
    
        var defaultResourceDirectory = new List<AliCloud.ResourceManager.ResourceDirectory>();
        for (var rangeIndex = 0; rangeIndex < @default.Directories.Length > 0 ? 0 : 1; rangeIndex++)
        {
            var range = new { Value = rangeIndex };
            defaultResourceDirectory.Add(new AliCloud.ResourceManager.ResourceDirectory($"default-{range.Value}", new()
            {
                Status = "Enabled",
            }));
        }
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.resourcemanager.ResourcemanagerFunctions;
    import com.pulumi.alicloud.resourcemanager.inputs.GetResourceDirectoriesArgs;
    import com.pulumi.alicloud.resourcemanager.ResourceDirectory;
    import com.pulumi.alicloud.resourcemanager.ResourceDirectoryArgs;
    import com.pulumi.codegen.internal.KeyedValue;
    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) {
            final var default = ResourcemanagerFunctions.getResourceDirectories();
    
            for (var i = 0; i < default_.directories().length() > 0 ? 0 : 1; i++) {
                new ResourceDirectory("defaultResourceDirectory-" + i, ResourceDirectoryArgs.builder()
                    .status("Enabled")
                    .build());
    
            
    }
        }
    }
    
    resources:
      defaultResourceDirectory:
        type: alicloud:resourcemanager:ResourceDirectory
        name: default
        properties:
          status: Enabled
        options: {}
    variables:
      default:
        fn::invoke:
          Function: alicloud:resourcemanager:getResourceDirectories
          Arguments: {}
    

    Create ResourceDirectory Resource

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

    Constructor syntax

    new ResourceDirectory(name: string, args?: ResourceDirectoryArgs, opts?: CustomResourceOptions);
    @overload
    def ResourceDirectory(resource_name: str,
                          args: Optional[ResourceDirectoryArgs] = None,
                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def ResourceDirectory(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          member_deletion_status: Optional[str] = None,
                          status: Optional[str] = None)
    func NewResourceDirectory(ctx *Context, name string, args *ResourceDirectoryArgs, opts ...ResourceOption) (*ResourceDirectory, error)
    public ResourceDirectory(string name, ResourceDirectoryArgs? args = null, CustomResourceOptions? opts = null)
    public ResourceDirectory(String name, ResourceDirectoryArgs args)
    public ResourceDirectory(String name, ResourceDirectoryArgs args, CustomResourceOptions options)
    
    type: alicloud:resourcemanager:ResourceDirectory
    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 ResourceDirectoryArgs
    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 ResourceDirectoryArgs
    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 ResourceDirectoryArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ResourceDirectoryArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ResourceDirectoryArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

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

    var resourceDirectoryResource = new AliCloud.ResourceManager.ResourceDirectory("resourceDirectoryResource", new()
    {
        MemberDeletionStatus = "string",
        Status = "string",
    });
    
    example, err := resourcemanager.NewResourceDirectory(ctx, "resourceDirectoryResource", &resourcemanager.ResourceDirectoryArgs{
    	MemberDeletionStatus: pulumi.String("string"),
    	Status:               pulumi.String("string"),
    })
    
    var resourceDirectoryResource = new ResourceDirectory("resourceDirectoryResource", ResourceDirectoryArgs.builder()
        .memberDeletionStatus("string")
        .status("string")
        .build());
    
    resource_directory_resource = alicloud.resourcemanager.ResourceDirectory("resourceDirectoryResource",
        member_deletion_status="string",
        status="string")
    
    const resourceDirectoryResource = new alicloud.resourcemanager.ResourceDirectory("resourceDirectoryResource", {
        memberDeletionStatus: "string",
        status: "string",
    });
    
    type: alicloud:resourcemanager:ResourceDirectory
    properties:
        memberDeletionStatus: string
        status: string
    

    ResourceDirectory 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 ResourceDirectory resource accepts the following input properties:

    MemberDeletionStatus string
    Specifies whether to enable the member deletion feature. Valid values:Enabled and Disabled.
    Status string
    The status of control policy. Valid values:Enabled and Disabled.
    MemberDeletionStatus string
    Specifies whether to enable the member deletion feature. Valid values:Enabled and Disabled.
    Status string
    The status of control policy. Valid values:Enabled and Disabled.
    memberDeletionStatus String
    Specifies whether to enable the member deletion feature. Valid values:Enabled and Disabled.
    status String
    The status of control policy. Valid values:Enabled and Disabled.
    memberDeletionStatus string
    Specifies whether to enable the member deletion feature. Valid values:Enabled and Disabled.
    status string
    The status of control policy. Valid values:Enabled and Disabled.
    member_deletion_status str
    Specifies whether to enable the member deletion feature. Valid values:Enabled and Disabled.
    status str
    The status of control policy. Valid values:Enabled and Disabled.
    memberDeletionStatus String
    Specifies whether to enable the member deletion feature. Valid values:Enabled and Disabled.
    status String
    The status of control policy. Valid values:Enabled and Disabled.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    MasterAccountId string
    The ID of the master account.
    MasterAccountName string
    The name of the master account.
    RootFolderId string
    The ID of the root folder.
    Id string
    The provider-assigned unique ID for this managed resource.
    MasterAccountId string
    The ID of the master account.
    MasterAccountName string
    The name of the master account.
    RootFolderId string
    The ID of the root folder.
    id String
    The provider-assigned unique ID for this managed resource.
    masterAccountId String
    The ID of the master account.
    masterAccountName String
    The name of the master account.
    rootFolderId String
    The ID of the root folder.
    id string
    The provider-assigned unique ID for this managed resource.
    masterAccountId string
    The ID of the master account.
    masterAccountName string
    The name of the master account.
    rootFolderId string
    The ID of the root folder.
    id str
    The provider-assigned unique ID for this managed resource.
    master_account_id str
    The ID of the master account.
    master_account_name str
    The name of the master account.
    root_folder_id str
    The ID of the root folder.
    id String
    The provider-assigned unique ID for this managed resource.
    masterAccountId String
    The ID of the master account.
    masterAccountName String
    The name of the master account.
    rootFolderId String
    The ID of the root folder.

    Look up Existing ResourceDirectory Resource

    Get an existing ResourceDirectory 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?: ResourceDirectoryState, opts?: CustomResourceOptions): ResourceDirectory
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            master_account_id: Optional[str] = None,
            master_account_name: Optional[str] = None,
            member_deletion_status: Optional[str] = None,
            root_folder_id: Optional[str] = None,
            status: Optional[str] = None) -> ResourceDirectory
    func GetResourceDirectory(ctx *Context, name string, id IDInput, state *ResourceDirectoryState, opts ...ResourceOption) (*ResourceDirectory, error)
    public static ResourceDirectory Get(string name, Input<string> id, ResourceDirectoryState? state, CustomResourceOptions? opts = null)
    public static ResourceDirectory get(String name, Output<String> id, ResourceDirectoryState 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:
    MasterAccountId string
    The ID of the master account.
    MasterAccountName string
    The name of the master account.
    MemberDeletionStatus string
    Specifies whether to enable the member deletion feature. Valid values:Enabled and Disabled.
    RootFolderId string
    The ID of the root folder.
    Status string
    The status of control policy. Valid values:Enabled and Disabled.
    MasterAccountId string
    The ID of the master account.
    MasterAccountName string
    The name of the master account.
    MemberDeletionStatus string
    Specifies whether to enable the member deletion feature. Valid values:Enabled and Disabled.
    RootFolderId string
    The ID of the root folder.
    Status string
    The status of control policy. Valid values:Enabled and Disabled.
    masterAccountId String
    The ID of the master account.
    masterAccountName String
    The name of the master account.
    memberDeletionStatus String
    Specifies whether to enable the member deletion feature. Valid values:Enabled and Disabled.
    rootFolderId String
    The ID of the root folder.
    status String
    The status of control policy. Valid values:Enabled and Disabled.
    masterAccountId string
    The ID of the master account.
    masterAccountName string
    The name of the master account.
    memberDeletionStatus string
    Specifies whether to enable the member deletion feature. Valid values:Enabled and Disabled.
    rootFolderId string
    The ID of the root folder.
    status string
    The status of control policy. Valid values:Enabled and Disabled.
    master_account_id str
    The ID of the master account.
    master_account_name str
    The name of the master account.
    member_deletion_status str
    Specifies whether to enable the member deletion feature. Valid values:Enabled and Disabled.
    root_folder_id str
    The ID of the root folder.
    status str
    The status of control policy. Valid values:Enabled and Disabled.
    masterAccountId String
    The ID of the master account.
    masterAccountName String
    The name of the master account.
    memberDeletionStatus String
    Specifies whether to enable the member deletion feature. Valid values:Enabled and Disabled.
    rootFolderId String
    The ID of the root folder.
    status String
    The status of control policy. Valid values:Enabled and Disabled.

    Import

    Resource Manager Resource Directory can be imported using the id, e.g.

    $ pulumi import alicloud:resourcemanager/resourceDirectory:ResourceDirectory example rd-s3****
    

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

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi