1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. resourcemanager
  5. DelegatedAdministrator
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

alicloud.resourcemanager.DelegatedAdministrator

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 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.RandomInteger("default", {
        min: 10000,
        max: 99999,
    });
    const exampleFolder = new alicloud.resourcemanager.Folder("exampleFolder", {folderName: pulumi.interpolate`${name}-${_default.result}`});
    const exampleAccount = new alicloud.resourcemanager.Account("exampleAccount", {
        displayName: pulumi.interpolate`${displayName}-${_default.result}`,
        folderId: exampleFolder.id,
    });
    const exampleDelegatedAdministrator = new alicloud.resourcemanager.DelegatedAdministrator("exampleDelegatedAdministrator", {
        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.RandomInteger("default",
        min=10000,
        max=99999)
    example_folder = alicloud.resourcemanager.Folder("exampleFolder", folder_name=default.result.apply(lambda result: f"{name}-{result}"))
    example_account = alicloud.resourcemanager.Account("exampleAccount",
        display_name=default.result.apply(lambda result: f"{display_name}-{result}"),
        folder_id=example_folder.id)
    example_delegated_administrator = alicloud.resourcemanager.DelegatedAdministrator("exampleDelegatedAdministrator",
        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.NewRandomInteger(ctx, "default", &random.RandomIntegerArgs{
    			Min: pulumi.Int(10000),
    			Max: pulumi.Int(99999),
    		})
    		if err != nil {
    			return err
    		}
    		exampleFolder, err := resourcemanager.NewFolder(ctx, "exampleFolder", &resourcemanager.FolderArgs{
    			FolderName: _default.Result.ApplyT(func(result int) (string, error) {
    				return fmt.Sprintf("%v-%v", name, result), nil
    			}).(pulumi.StringOutput),
    		})
    		if err != nil {
    			return err
    		}
    		exampleAccount, err := resourcemanager.NewAccount(ctx, "exampleAccount", &resourcemanager.AccountArgs{
    			DisplayName: _default.Result.ApplyT(func(result int) (string, error) {
    				return fmt.Sprintf("%v-%v", displayName, result), nil
    			}).(pulumi.StringOutput),
    			FolderId: exampleFolder.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = resourcemanager.NewDelegatedAdministrator(ctx, "exampleDelegatedAdministrator", &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.RandomInteger("default", new()
        {
            Min = 10000,
            Max = 99999,
        });
    
        var exampleFolder = new AliCloud.ResourceManager.Folder("exampleFolder", new()
        {
            FolderName = @default.Result.Apply(result => $"{name}-{result}"),
        });
    
        var exampleAccount = new AliCloud.ResourceManager.Account("exampleAccount", new()
        {
            DisplayName = @default.Result.Apply(result => $"{displayName}-{result}"),
            FolderId = exampleFolder.Id,
        });
    
        var exampleDelegatedAdministrator = new AliCloud.ResourceManager.DelegatedAdministrator("exampleDelegatedAdministrator", 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.RandomInteger;
    import com.pulumi.random.RandomIntegerArgs;
    import com.pulumi.alicloud.resourcemanager.Folder;
    import com.pulumi.alicloud.resourcemanager.FolderArgs;
    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 RandomInteger("default", RandomIntegerArgs.builder()        
                .min(10000)
                .max(99999)
                .build());
    
            var exampleFolder = new Folder("exampleFolder", FolderArgs.builder()        
                .folderName(default_.result().applyValue(result -> String.format("%s-%s", name,result)))
                .build());
    
            var exampleAccount = new Account("exampleAccount", AccountArgs.builder()        
                .displayName(default_.result().applyValue(result -> String.format("%s-%s", displayName,result)))
                .folderId(exampleFolder.id())
                .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:RandomInteger
        properties:
          min: 10000
          max: 99999
      exampleFolder:
        type: alicloud:resourcemanager:Folder
        properties:
          folderName: ${name}-${default.result}
      exampleAccount:
        type: alicloud:resourcemanager:Account
        properties:
          displayName: ${displayName}-${default.result}
          folderId: ${exampleFolder.id}
      exampleDelegatedAdministrator:
        type: alicloud:resourcemanager:DelegatedAdministrator
        properties:
          accountId: ${exampleAccount.id}
          servicePrincipal: cloudfw.aliyuncs.com
    

    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.

    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

    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.53.0 published on Wednesday, Apr 17, 2024 by Pulumi