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

alicloud.resourcemanager.DelegatedAdministrator

Explore with Pulumi AI

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

    Provides a Resource Manager Delegated Administrator resource.

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

    NOTE: Available since v1.181.0.

    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 displayName = config.get("displayName") || "EAccount";
    const _default = new random.index.Integer("default", {
        min: 10000,
        max: 99999,
    });
    const example = alicloud.resourcemanager.getFolders({});
    const exampleAccount = new alicloud.resourcemanager.Account("example", {
        displayName: `${displayName}-${_default.result}`,
        folderId: example.then(example => example.ids?.[0]),
    });
    const exampleDelegatedAdministrator = new alicloud.resourcemanager.DelegatedAdministrator("example", {
        accountId: exampleAccount.id,
        servicePrincipal: "cloudfw.aliyuncs.com",
    });
    
    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"
    display_name = config.get("displayName")
    if display_name is None:
        display_name = "EAccount"
    default = random.index.Integer("default",
        min=10000,
        max=99999)
    example = alicloud.resourcemanager.get_folders()
    example_account = alicloud.resourcemanager.Account("example",
        display_name=f"{display_name}-{default['result']}",
        folder_id=example.ids[0])
    example_delegated_administrator = alicloud.resourcemanager.DelegatedAdministrator("example",
        account_id=example_account.id,
        service_principal="cloudfw.aliyuncs.com")
    
    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
    		}
    		displayName := "EAccount"
    		if param := cfg.Get("displayName"); param != "" {
    			displayName = param
    		}
    		_, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
    			Min: 10000,
    			Max: 99999,
    		})
    		if err != nil {
    			return err
    		}
    		example, err := resourcemanager.GetFolders(ctx, &resourcemanager.GetFoldersArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		exampleAccount, err := resourcemanager.NewAccount(ctx, "example", &resourcemanager.AccountArgs{
    			DisplayName: pulumi.Sprintf("%v-%v", displayName, _default.Result),
    			FolderId:    pulumi.String(example.Ids[0]),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = resourcemanager.NewDelegatedAdministrator(ctx, "example", &resourcemanager.DelegatedAdministratorArgs{
    			AccountId:        exampleAccount.ID(),
    			ServicePrincipal: pulumi.String("cloudfw.aliyuncs.com"),
    		})
    		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 displayName = config.Get("displayName") ?? "EAccount";
        var @default = new Random.Index.Integer("default", new()
        {
            Min = 10000,
            Max = 99999,
        });
    
        var example = AliCloud.ResourceManager.GetFolders.Invoke();
    
        var exampleAccount = new AliCloud.ResourceManager.Account("example", new()
        {
            DisplayName = $"{displayName}-{@default.Result}",
            FolderId = example.Apply(getFoldersResult => getFoldersResult.Ids[0]),
        });
    
        var exampleDelegatedAdministrator = new AliCloud.ResourceManager.DelegatedAdministrator("example", new()
        {
            AccountId = exampleAccount.Id,
            ServicePrincipal = "cloudfw.aliyuncs.com",
        });
    
    });
    
    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.ResourcemanagerFunctions;
    import com.pulumi.alicloud.resourcemanager.inputs.GetFoldersArgs;
    import com.pulumi.alicloud.resourcemanager.Account;
    import com.pulumi.alicloud.resourcemanager.AccountArgs;
    import com.pulumi.alicloud.resourcemanager.DelegatedAdministrator;
    import com.pulumi.alicloud.resourcemanager.DelegatedAdministratorArgs;
    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");
            final var displayName = config.get("displayName").orElse("EAccount");
            var default_ = new Integer("default", IntegerArgs.builder()
                .min(10000)
                .max(99999)
                .build());
    
            final var example = ResourcemanagerFunctions.getFolders();
    
            var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
                .displayName(String.format("%s-%s", displayName,default_.result()))
                .folderId(example.applyValue(getFoldersResult -> getFoldersResult.ids()[0]))
                .build());
    
            var exampleDelegatedAdministrator = new DelegatedAdministrator("exampleDelegatedAdministrator", DelegatedAdministratorArgs.builder()
                .accountId(exampleAccount.id())
                .servicePrincipal("cloudfw.aliyuncs.com")
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: tf-example
      displayName:
        type: string
        default: EAccount
    resources:
      default:
        type: random:integer
        properties:
          min: 10000
          max: 99999
      exampleAccount:
        type: alicloud:resourcemanager:Account
        name: example
        properties:
          displayName: ${displayName}-${default.result}
          folderId: ${example.ids[0]}
      exampleDelegatedAdministrator:
        type: alicloud:resourcemanager:DelegatedAdministrator
        name: example
        properties:
          accountId: ${exampleAccount.id}
          servicePrincipal: cloudfw.aliyuncs.com
    variables:
      example:
        fn::invoke:
          Function: alicloud:resourcemanager:getFolders
          Arguments: {}
    

    Create DelegatedAdministrator Resource

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

    Constructor syntax

    new DelegatedAdministrator(name: string, args: DelegatedAdministratorArgs, opts?: CustomResourceOptions);
    @overload
    def DelegatedAdministrator(resource_name: str,
                               args: DelegatedAdministratorArgs,
                               opts: Optional[ResourceOptions] = None)
    
    @overload
    def DelegatedAdministrator(resource_name: str,
                               opts: Optional[ResourceOptions] = None,
                               account_id: Optional[str] = None,
                               service_principal: Optional[str] = None)
    func NewDelegatedAdministrator(ctx *Context, name string, args DelegatedAdministratorArgs, opts ...ResourceOption) (*DelegatedAdministrator, error)
    public DelegatedAdministrator(string name, DelegatedAdministratorArgs args, CustomResourceOptions? opts = null)
    public DelegatedAdministrator(String name, DelegatedAdministratorArgs args)
    public DelegatedAdministrator(String name, DelegatedAdministratorArgs args, CustomResourceOptions options)
    
    type: alicloud:resourcemanager:DelegatedAdministrator
    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 DelegatedAdministratorArgs
    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 DelegatedAdministratorArgs
    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 DelegatedAdministratorArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DelegatedAdministratorArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DelegatedAdministratorArgs
    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 delegatedAdministratorResource = new AliCloud.ResourceManager.DelegatedAdministrator("delegatedAdministratorResource", new()
    {
        AccountId = "string",
        ServicePrincipal = "string",
    });
    
    example, err := resourcemanager.NewDelegatedAdministrator(ctx, "delegatedAdministratorResource", &resourcemanager.DelegatedAdministratorArgs{
    	AccountId:        pulumi.String("string"),
    	ServicePrincipal: pulumi.String("string"),
    })
    
    var delegatedAdministratorResource = new DelegatedAdministrator("delegatedAdministratorResource", DelegatedAdministratorArgs.builder()
        .accountId("string")
        .servicePrincipal("string")
        .build());
    
    delegated_administrator_resource = alicloud.resourcemanager.DelegatedAdministrator("delegatedAdministratorResource",
        account_id="string",
        service_principal="string")
    
    const delegatedAdministratorResource = new alicloud.resourcemanager.DelegatedAdministrator("delegatedAdministratorResource", {
        accountId: "string",
        servicePrincipal: "string",
    });
    
    type: alicloud:resourcemanager:DelegatedAdministrator
    properties:
        accountId: string
        servicePrincipal: string
    

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

    AccountId string
    The ID of the member account in the resource directory.
    ServicePrincipal string
    The identification of the trusted service. NOTE: Only some trusted services support delegated administrator accounts. For more information, see Supported trusted services.
    AccountId string
    The ID of the member account in the resource directory.
    ServicePrincipal string
    The identification of the trusted service. NOTE: Only some trusted services support delegated administrator accounts. For more information, see Supported trusted services.
    accountId String
    The ID of the member account in the resource directory.
    servicePrincipal String
    The identification of the trusted service. NOTE: Only some trusted services support delegated administrator accounts. For more information, see Supported trusted services.
    accountId string
    The ID of the member account in the resource directory.
    servicePrincipal string
    The identification of the trusted service. NOTE: Only some trusted services support delegated administrator accounts. For more information, see Supported trusted services.
    account_id str
    The ID of the member account in the resource directory.
    service_principal str
    The identification of the trusted service. NOTE: Only some trusted services support delegated administrator accounts. For more information, see Supported trusted services.
    accountId String
    The ID of the member account in the resource directory.
    servicePrincipal String
    The identification of the trusted service. NOTE: Only some trusted services support delegated administrator accounts. For more information, see Supported trusted services.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the DelegatedAdministrator 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 DelegatedAdministrator Resource

    Get an existing DelegatedAdministrator 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?: DelegatedAdministratorState, opts?: CustomResourceOptions): DelegatedAdministrator
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            account_id: Optional[str] = None,
            service_principal: Optional[str] = None) -> DelegatedAdministrator
    func GetDelegatedAdministrator(ctx *Context, name string, id IDInput, state *DelegatedAdministratorState, opts ...ResourceOption) (*DelegatedAdministrator, error)
    public static DelegatedAdministrator Get(string name, Input<string> id, DelegatedAdministratorState? state, CustomResourceOptions? opts = null)
    public static DelegatedAdministrator get(String name, Output<String> id, DelegatedAdministratorState 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:
    AccountId string
    The ID of the member account in the resource directory.
    ServicePrincipal string
    The identification of the trusted service. NOTE: Only some trusted services support delegated administrator accounts. For more information, see Supported trusted services.
    AccountId string
    The ID of the member account in the resource directory.
    ServicePrincipal string
    The identification of the trusted service. NOTE: Only some trusted services support delegated administrator accounts. For more information, see Supported trusted services.
    accountId String
    The ID of the member account in the resource directory.
    servicePrincipal String
    The identification of the trusted service. NOTE: Only some trusted services support delegated administrator accounts. For more information, see Supported trusted services.
    accountId string
    The ID of the member account in the resource directory.
    servicePrincipal string
    The identification of the trusted service. NOTE: Only some trusted services support delegated administrator accounts. For more information, see Supported trusted services.
    account_id str
    The ID of the member account in the resource directory.
    service_principal str
    The identification of the trusted service. NOTE: Only some trusted services support delegated administrator accounts. For more information, see Supported trusted services.
    accountId String
    The ID of the member account in the resource directory.
    servicePrincipal String
    The identification of the trusted service. NOTE: Only some trusted services support delegated administrator accounts. For more information, see Supported trusted services.

    Import

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

    $ pulumi import alicloud:resourcemanager/delegatedAdministrator:DelegatedAdministrator example <account_id>:<service_principal>
    

    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