1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. resourcemanager
  5. SharedTarget
Alibaba Cloud v3.51.0 published on Saturday, Mar 23, 2024 by Pulumi

alicloud.resourcemanager.SharedTarget

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.51.0 published on Saturday, Mar 23, 2024 by Pulumi

    Provides a Resource Manager Shared Target resource.

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

    NOTE: Available since v1.111.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "tfexample";
    const default = alicloud.resourcemanager.getAccounts({});
    const exampleResourceShare = new alicloud.resourcemanager.ResourceShare("exampleResourceShare", {resourceShareName: name});
    const exampleSharedTarget = new alicloud.resourcemanager.SharedTarget("exampleSharedTarget", {
        resourceShareId: exampleResourceShare.id,
        targetId: _default.then(_default => _default.ids?.[0]),
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tfexample"
    default = alicloud.resourcemanager.get_accounts()
    example_resource_share = alicloud.resourcemanager.ResourceShare("exampleResourceShare", resource_share_name=name)
    example_shared_target = alicloud.resourcemanager.SharedTarget("exampleSharedTarget",
        resource_share_id=example_resource_share.id,
        target_id=default.ids[0])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/resourcemanager"
    	"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 := "tfexample"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_default, err := resourcemanager.GetAccounts(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		exampleResourceShare, err := resourcemanager.NewResourceShare(ctx, "exampleResourceShare", &resourcemanager.ResourceShareArgs{
    			ResourceShareName: pulumi.String(name),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = resourcemanager.NewSharedTarget(ctx, "exampleSharedTarget", &resourcemanager.SharedTargetArgs{
    			ResourceShareId: exampleResourceShare.ID(),
    			TargetId:        pulumi.String(_default.Ids[0]),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "tfexample";
        var @default = AliCloud.ResourceManager.GetAccounts.Invoke();
    
        var exampleResourceShare = new AliCloud.ResourceManager.ResourceShare("exampleResourceShare", new()
        {
            ResourceShareName = name,
        });
    
        var exampleSharedTarget = new AliCloud.ResourceManager.SharedTarget("exampleSharedTarget", new()
        {
            ResourceShareId = exampleResourceShare.Id,
            TargetId = @default.Apply(@default => @default.Apply(getAccountsResult => getAccountsResult.Ids[0])),
        });
    
    });
    
    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.GetAccountsArgs;
    import com.pulumi.alicloud.resourcemanager.ResourceShare;
    import com.pulumi.alicloud.resourcemanager.ResourceShareArgs;
    import com.pulumi.alicloud.resourcemanager.SharedTarget;
    import com.pulumi.alicloud.resourcemanager.SharedTargetArgs;
    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("tfexample");
            final var default = ResourcemanagerFunctions.getAccounts();
    
            var exampleResourceShare = new ResourceShare("exampleResourceShare", ResourceShareArgs.builder()        
                .resourceShareName(name)
                .build());
    
            var exampleSharedTarget = new SharedTarget("exampleSharedTarget", SharedTargetArgs.builder()        
                .resourceShareId(exampleResourceShare.id())
                .targetId(default_.ids()[0])
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: tfexample
    resources:
      exampleResourceShare:
        type: alicloud:resourcemanager:ResourceShare
        properties:
          resourceShareName: ${name}
      exampleSharedTarget:
        type: alicloud:resourcemanager:SharedTarget
        properties:
          resourceShareId: ${exampleResourceShare.id}
          targetId: ${default.ids[0]}
    variables:
      default:
        fn::invoke:
          Function: alicloud:resourcemanager:getAccounts
          Arguments: {}
    

    Create SharedTarget Resource

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

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

    ResourceShareId string
    The resource share ID of resource manager.
    TargetId string
    The member account ID in resource directory.
    ResourceShareId string
    The resource share ID of resource manager.
    TargetId string
    The member account ID in resource directory.
    resourceShareId String
    The resource share ID of resource manager.
    targetId String
    The member account ID in resource directory.
    resourceShareId string
    The resource share ID of resource manager.
    targetId string
    The member account ID in resource directory.
    resource_share_id str
    The resource share ID of resource manager.
    target_id str
    The member account ID in resource directory.
    resourceShareId String
    The resource share ID of resource manager.
    targetId String
    The member account ID in resource directory.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of shared target.
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of shared target.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of shared target.
    id string
    The provider-assigned unique ID for this managed resource.
    status string
    The status of shared target.
    id str
    The provider-assigned unique ID for this managed resource.
    status str
    The status of shared target.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of shared target.

    Look up Existing SharedTarget Resource

    Get an existing SharedTarget 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?: SharedTargetState, opts?: CustomResourceOptions): SharedTarget
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            resource_share_id: Optional[str] = None,
            status: Optional[str] = None,
            target_id: Optional[str] = None) -> SharedTarget
    func GetSharedTarget(ctx *Context, name string, id IDInput, state *SharedTargetState, opts ...ResourceOption) (*SharedTarget, error)
    public static SharedTarget Get(string name, Input<string> id, SharedTargetState? state, CustomResourceOptions? opts = null)
    public static SharedTarget get(String name, Output<String> id, SharedTargetState 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:
    ResourceShareId string
    The resource share ID of resource manager.
    Status string
    The status of shared target.
    TargetId string
    The member account ID in resource directory.
    ResourceShareId string
    The resource share ID of resource manager.
    Status string
    The status of shared target.
    TargetId string
    The member account ID in resource directory.
    resourceShareId String
    The resource share ID of resource manager.
    status String
    The status of shared target.
    targetId String
    The member account ID in resource directory.
    resourceShareId string
    The resource share ID of resource manager.
    status string
    The status of shared target.
    targetId string
    The member account ID in resource directory.
    resource_share_id str
    The resource share ID of resource manager.
    status str
    The status of shared target.
    target_id str
    The member account ID in resource directory.
    resourceShareId String
    The resource share ID of resource manager.
    status String
    The status of shared target.
    targetId String
    The member account ID in resource directory.

    Import

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

    $ pulumi import alicloud:resourcemanager/sharedTarget:SharedTarget example <resource_share_id>:<target_id>
    

    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.51.0 published on Saturday, Mar 23, 2024 by Pulumi