1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. resourcemanager
  5. Folder
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

alicloud.resourcemanager.Folder

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

    Provides a Resource Manager Folder resource. A folder is an organizational unit in a resource directory. You can use folders to build an organizational structure for resources. For information about Resource Manager Foler and how to use it, see What is Resource Manager Folder.

    NOTE: Available since v1.82.0.

    NOTE: A maximum of five levels of folders can be created under the root folder.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    import * as random from "@pulumi/random";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "tf-example";
    const _default = new random.index.Integer("default", {
        min: 10000,
        max: 99999,
    });
    const example = new alicloud.resourcemanager.Folder("example", {folderName: `${name}-${_default.result}`});
    
    import pulumi
    import pulumi_alicloud as alicloud
    import pulumi_random as random
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf-example"
    default = random.index.Integer("default",
        min=10000,
        max=99999)
    example = alicloud.resourcemanager.Folder("example", folder_name=f"{name}-{default['result']}")
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/resourcemanager"
    	"github.com/pulumi/pulumi-random/sdk/v4/go/random"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "tf-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
    			Min: 10000,
    			Max: 99999,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = resourcemanager.NewFolder(ctx, "example", &resourcemanager.FolderArgs{
    			FolderName: pulumi.Sprintf("%v-%v", name, _default.Result),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    using Random = Pulumi.Random;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "tf-example";
        var @default = new Random.Index.Integer("default", new()
        {
            Min = 10000,
            Max = 99999,
        });
    
        var example = new AliCloud.ResourceManager.Folder("example", new()
        {
            FolderName = $"{name}-{@default.Result}",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.random.integer;
    import com.pulumi.random.IntegerArgs;
    import com.pulumi.alicloud.resourcemanager.Folder;
    import com.pulumi.alicloud.resourcemanager.FolderArgs;
    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 config = ctx.config();
            final var name = config.get("name").orElse("tf-example");
            var default_ = new Integer("default", IntegerArgs.builder()
                .min(10000)
                .max(99999)
                .build());
    
            var example = new Folder("example", FolderArgs.builder()
                .folderName(String.format("%s-%s", name,default_.result()))
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: tf-example
    resources:
      default:
        type: random:integer
        properties:
          min: 10000
          max: 99999
      example:
        type: alicloud:resourcemanager:Folder
        properties:
          folderName: ${name}-${default.result}
    

    Create Folder Resource

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

    Constructor syntax

    new Folder(name: string, args: FolderArgs, opts?: CustomResourceOptions);
    @overload
    def Folder(resource_name: str,
               args: FolderArgs,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def Folder(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               folder_name: Optional[str] = None,
               parent_folder_id: Optional[str] = None)
    func NewFolder(ctx *Context, name string, args FolderArgs, opts ...ResourceOption) (*Folder, error)
    public Folder(string name, FolderArgs args, CustomResourceOptions? opts = null)
    public Folder(String name, FolderArgs args)
    public Folder(String name, FolderArgs args, CustomResourceOptions options)
    
    type: alicloud:resourcemanager:Folder
    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 FolderArgs
    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 FolderArgs
    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 FolderArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args FolderArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args FolderArgs
    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 alicloudFolderResource = new AliCloud.ResourceManager.Folder("alicloudFolderResource", new()
    {
        FolderName = "string",
        ParentFolderId = "string",
    });
    
    example, err := resourcemanager.NewFolder(ctx, "alicloudFolderResource", &resourcemanager.FolderArgs{
    	FolderName:     pulumi.String("string"),
    	ParentFolderId: pulumi.String("string"),
    })
    
    var alicloudFolderResource = new Folder("alicloudFolderResource", FolderArgs.builder()
        .folderName("string")
        .parentFolderId("string")
        .build());
    
    alicloud_folder_resource = alicloud.resourcemanager.Folder("alicloudFolderResource",
        folder_name="string",
        parent_folder_id="string")
    
    const alicloudFolderResource = new alicloud.resourcemanager.Folder("alicloudFolderResource", {
        folderName: "string",
        parentFolderId: "string",
    });
    
    type: alicloud:resourcemanager:Folder
    properties:
        folderName: string
        parentFolderId: string
    

    Folder Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Folder resource accepts the following input properties:

    FolderName string
    The name of the folder. The name must be 1 to 24 characters in length and can contain letters, digits, underscores (_), periods (.), and hyphens (-).
    ParentFolderId string
    The ID of the parent folder. If not set, the system default value will be used.
    FolderName string
    The name of the folder. The name must be 1 to 24 characters in length and can contain letters, digits, underscores (_), periods (.), and hyphens (-).
    ParentFolderId string
    The ID of the parent folder. If not set, the system default value will be used.
    folderName String
    The name of the folder. The name must be 1 to 24 characters in length and can contain letters, digits, underscores (_), periods (.), and hyphens (-).
    parentFolderId String
    The ID of the parent folder. If not set, the system default value will be used.
    folderName string
    The name of the folder. The name must be 1 to 24 characters in length and can contain letters, digits, underscores (_), periods (.), and hyphens (-).
    parentFolderId string
    The ID of the parent folder. If not set, the system default value will be used.
    folder_name str
    The name of the folder. The name must be 1 to 24 characters in length and can contain letters, digits, underscores (_), periods (.), and hyphens (-).
    parent_folder_id str
    The ID of the parent folder. If not set, the system default value will be used.
    folderName String
    The name of the folder. The name must be 1 to 24 characters in length and can contain letters, digits, underscores (_), periods (.), and hyphens (-).
    parentFolderId String
    The ID of the parent folder. If not set, the system default value will be used.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Folder Resource

    Get an existing Folder 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?: FolderState, opts?: CustomResourceOptions): Folder
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            folder_name: Optional[str] = None,
            parent_folder_id: Optional[str] = None) -> Folder
    func GetFolder(ctx *Context, name string, id IDInput, state *FolderState, opts ...ResourceOption) (*Folder, error)
    public static Folder Get(string name, Input<string> id, FolderState? state, CustomResourceOptions? opts = null)
    public static Folder get(String name, Output<String> id, FolderState 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:
    FolderName string
    The name of the folder. The name must be 1 to 24 characters in length and can contain letters, digits, underscores (_), periods (.), and hyphens (-).
    ParentFolderId string
    The ID of the parent folder. If not set, the system default value will be used.
    FolderName string
    The name of the folder. The name must be 1 to 24 characters in length and can contain letters, digits, underscores (_), periods (.), and hyphens (-).
    ParentFolderId string
    The ID of the parent folder. If not set, the system default value will be used.
    folderName String
    The name of the folder. The name must be 1 to 24 characters in length and can contain letters, digits, underscores (_), periods (.), and hyphens (-).
    parentFolderId String
    The ID of the parent folder. If not set, the system default value will be used.
    folderName string
    The name of the folder. The name must be 1 to 24 characters in length and can contain letters, digits, underscores (_), periods (.), and hyphens (-).
    parentFolderId string
    The ID of the parent folder. If not set, the system default value will be used.
    folder_name str
    The name of the folder. The name must be 1 to 24 characters in length and can contain letters, digits, underscores (_), periods (.), and hyphens (-).
    parent_folder_id str
    The ID of the parent folder. If not set, the system default value will be used.
    folderName String
    The name of the folder. The name must be 1 to 24 characters in length and can contain letters, digits, underscores (_), periods (.), and hyphens (-).
    parentFolderId String
    The ID of the parent folder. If not set, the system default value will be used.

    Import

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

    $ pulumi import alicloud:resourcemanager/folder:Folder example fd-u8B321****	
    

    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.66.0 published on Friday, Nov 15, 2024 by Pulumi