alicloud.resourcemanager.ResourceDirectory
Explore with Pulumi AI
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 tmp0 float64
if pulumi.Float64(len(_default.Directories)) > 0 {
tmp0 = 0
} else {
tmp0 = 1
}
var defaultResourceDirectory []*resourcemanager.ResourceDirectory
for index := 0; index < tmp0; 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:
- Member
Deletion stringStatus - Specifies whether to enable the member deletion feature. Valid values:
Enabled
andDisabled
. - Status string
- The status of control policy. Valid values:
Enabled
andDisabled
.
- Member
Deletion stringStatus - Specifies whether to enable the member deletion feature. Valid values:
Enabled
andDisabled
. - Status string
- The status of control policy. Valid values:
Enabled
andDisabled
.
- member
Deletion StringStatus - Specifies whether to enable the member deletion feature. Valid values:
Enabled
andDisabled
. - status String
- The status of control policy. Valid values:
Enabled
andDisabled
.
- member
Deletion stringStatus - Specifies whether to enable the member deletion feature. Valid values:
Enabled
andDisabled
. - status string
- The status of control policy. Valid values:
Enabled
andDisabled
.
- member_
deletion_ strstatus - Specifies whether to enable the member deletion feature. Valid values:
Enabled
andDisabled
. - status str
- The status of control policy. Valid values:
Enabled
andDisabled
.
- member
Deletion StringStatus - Specifies whether to enable the member deletion feature. Valid values:
Enabled
andDisabled
. - status String
- The status of control policy. Valid values:
Enabled
andDisabled
.
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.
- Master
Account stringId - The ID of the master account.
- Master
Account stringName - The name of the master account.
- Root
Folder stringId - The ID of the root folder.
- Id string
- The provider-assigned unique ID for this managed resource.
- Master
Account stringId - The ID of the master account.
- Master
Account stringName - The name of the master account.
- Root
Folder stringId - The ID of the root folder.
- id String
- The provider-assigned unique ID for this managed resource.
- master
Account StringId - The ID of the master account.
- master
Account StringName - The name of the master account.
- root
Folder StringId - The ID of the root folder.
- id string
- The provider-assigned unique ID for this managed resource.
- master
Account stringId - The ID of the master account.
- master
Account stringName - The name of the master account.
- root
Folder stringId - The ID of the root folder.
- id str
- The provider-assigned unique ID for this managed resource.
- master_
account_ strid - The ID of the master account.
- master_
account_ strname - The name of the master account.
- root_
folder_ strid - The ID of the root folder.
- id String
- The provider-assigned unique ID for this managed resource.
- master
Account StringId - The ID of the master account.
- master
Account StringName - The name of the master account.
- root
Folder StringId - 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.
- Master
Account stringId - The ID of the master account.
- Master
Account stringName - The name of the master account.
- Member
Deletion stringStatus - Specifies whether to enable the member deletion feature. Valid values:
Enabled
andDisabled
. - Root
Folder stringId - The ID of the root folder.
- Status string
- The status of control policy. Valid values:
Enabled
andDisabled
.
- Master
Account stringId - The ID of the master account.
- Master
Account stringName - The name of the master account.
- Member
Deletion stringStatus - Specifies whether to enable the member deletion feature. Valid values:
Enabled
andDisabled
. - Root
Folder stringId - The ID of the root folder.
- Status string
- The status of control policy. Valid values:
Enabled
andDisabled
.
- master
Account StringId - The ID of the master account.
- master
Account StringName - The name of the master account.
- member
Deletion StringStatus - Specifies whether to enable the member deletion feature. Valid values:
Enabled
andDisabled
. - root
Folder StringId - The ID of the root folder.
- status String
- The status of control policy. Valid values:
Enabled
andDisabled
.
- master
Account stringId - The ID of the master account.
- master
Account stringName - The name of the master account.
- member
Deletion stringStatus - Specifies whether to enable the member deletion feature. Valid values:
Enabled
andDisabled
. - root
Folder stringId - The ID of the root folder.
- status string
- The status of control policy. Valid values:
Enabled
andDisabled
.
- master_
account_ strid - The ID of the master account.
- master_
account_ strname - The name of the master account.
- member_
deletion_ strstatus - Specifies whether to enable the member deletion feature. Valid values:
Enabled
andDisabled
. - root_
folder_ strid - The ID of the root folder.
- status str
- The status of control policy. Valid values:
Enabled
andDisabled
.
- master
Account StringId - The ID of the master account.
- master
Account StringName - The name of the master account.
- member
Deletion StringStatus - Specifies whether to enable the member deletion feature. Valid values:
Enabled
andDisabled
. - root
Folder StringId - The ID of the root folder.
- status String
- The status of control policy. Valid values:
Enabled
andDisabled
.
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.