1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. resourcemanager
  5. SharedTarget
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.resourcemanager.SharedTarget

Explore with Pulumi AI

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 example = new alicloud.resourcemanager.ResourceShare("example", {resourceShareName: name});
const exampleSharedTarget = new alicloud.resourcemanager.SharedTarget("example", {
    resourceShareId: example.id,
    targetId: _default.then(_default => _default.ids?.[0]),
});
Copy
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 = alicloud.resourcemanager.ResourceShare("example", resource_share_name=name)
example_shared_target = alicloud.resourcemanager.SharedTarget("example",
    resource_share_id=example.id,
    target_id=default.ids[0])
Copy
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, &resourcemanager.GetAccountsArgs{}, nil)
		if err != nil {
			return err
		}
		example, err := resourcemanager.NewResourceShare(ctx, "example", &resourcemanager.ResourceShareArgs{
			ResourceShareName: pulumi.String(name),
		})
		if err != nil {
			return err
		}
		_, err = resourcemanager.NewSharedTarget(ctx, "example", &resourcemanager.SharedTargetArgs{
			ResourceShareId: example.ID(),
			TargetId:        pulumi.String(_default.Ids[0]),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
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 example = new AliCloud.ResourceManager.ResourceShare("example", new()
    {
        ResourceShareName = name,
    });

    var exampleSharedTarget = new AliCloud.ResourceManager.SharedTarget("example", new()
    {
        ResourceShareId = example.Id,
        TargetId = @default.Apply(@default => @default.Apply(getAccountsResult => getAccountsResult.Ids[0])),
    });

});
Copy
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 example = new ResourceShare("example", ResourceShareArgs.builder()
            .resourceShareName(name)
            .build());

        var exampleSharedTarget = new SharedTarget("exampleSharedTarget", SharedTargetArgs.builder()
            .resourceShareId(example.id())
            .targetId(default_.ids()[0])
            .build());

    }
}
Copy
configuration:
  name:
    type: string
    default: tfexample
resources:
  example:
    type: alicloud:resourcemanager:ResourceShare
    properties:
      resourceShareName: ${name}
  exampleSharedTarget:
    type: alicloud:resourcemanager:SharedTarget
    name: example
    properties:
      resourceShareId: ${example.id}
      targetId: ${default.ids[0]}
variables:
  default:
    fn::invoke:
      function: alicloud:resourcemanager:getAccounts
      arguments: {}
Copy

Create SharedTarget Resource

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

Constructor syntax

new SharedTarget(name: string, args: SharedTargetArgs, opts?: CustomResourceOptions);
@overload
def SharedTarget(resource_name: str,
                 args: SharedTargetArgs,
                 opts: Optional[ResourceOptions] = None)

@overload
def SharedTarget(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 resource_share_id: Optional[str] = None,
                 target_id: Optional[str] = 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.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. SharedTargetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. 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 This property is required. string
The unique name of the resource.
args This property is required. SharedTargetArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. SharedTargetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. SharedTargetArgs
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 sharedTargetResource = new AliCloud.ResourceManager.SharedTarget("sharedTargetResource", new()
{
    ResourceShareId = "string",
    TargetId = "string",
});
Copy
example, err := resourcemanager.NewSharedTarget(ctx, "sharedTargetResource", &resourcemanager.SharedTargetArgs{
	ResourceShareId: pulumi.String("string"),
	TargetId:        pulumi.String("string"),
})
Copy
var sharedTargetResource = new SharedTarget("sharedTargetResource", SharedTargetArgs.builder()
    .resourceShareId("string")
    .targetId("string")
    .build());
Copy
shared_target_resource = alicloud.resourcemanager.SharedTarget("sharedTargetResource",
    resource_share_id="string",
    target_id="string")
Copy
const sharedTargetResource = new alicloud.resourcemanager.SharedTarget("sharedTargetResource", {
    resourceShareId: "string",
    targetId: "string",
});
Copy
type: alicloud:resourcemanager:SharedTarget
properties:
    resourceShareId: string
    targetId: string
Copy

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

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

The SharedTarget resource accepts the following input properties:

ResourceShareId
This property is required.
Changes to this property will trigger replacement.
string
The resource share ID of resource manager.
TargetId
This property is required.
Changes to this property will trigger replacement.
string
The member account ID in resource directory.
ResourceShareId
This property is required.
Changes to this property will trigger replacement.
string
The resource share ID of resource manager.
TargetId
This property is required.
Changes to this property will trigger replacement.
string
The member account ID in resource directory.
resourceShareId
This property is required.
Changes to this property will trigger replacement.
String
The resource share ID of resource manager.
targetId
This property is required.
Changes to this property will trigger replacement.
String
The member account ID in resource directory.
resourceShareId
This property is required.
Changes to this property will trigger replacement.
string
The resource share ID of resource manager.
targetId
This property is required.
Changes to this property will trigger replacement.
string
The member account ID in resource directory.
resource_share_id
This property is required.
Changes to this property will trigger replacement.
str
The resource share ID of resource manager.
target_id
This property is required.
Changes to this property will trigger replacement.
str
The member account ID in resource directory.
resourceShareId
This property is required.
Changes to this property will trigger replacement.
String
The resource share ID of resource manager.
targetId
This property is required.
Changes to this property will trigger replacement.
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)
resources:  _:    type: alicloud:resourcemanager:SharedTarget    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 Changes to this property will trigger replacement. string
The resource share ID of resource manager.
Status string
The status of shared target.
TargetId Changes to this property will trigger replacement. string
The member account ID in resource directory.
ResourceShareId Changes to this property will trigger replacement. string
The resource share ID of resource manager.
Status string
The status of shared target.
TargetId Changes to this property will trigger replacement. string
The member account ID in resource directory.
resourceShareId Changes to this property will trigger replacement. String
The resource share ID of resource manager.
status String
The status of shared target.
targetId Changes to this property will trigger replacement. String
The member account ID in resource directory.
resourceShareId Changes to this property will trigger replacement. string
The resource share ID of resource manager.
status string
The status of shared target.
targetId Changes to this property will trigger replacement. string
The member account ID in resource directory.
resource_share_id Changes to this property will trigger replacement. str
The resource share ID of resource manager.
status str
The status of shared target.
target_id Changes to this property will trigger replacement. str
The member account ID in resource directory.
resourceShareId Changes to this property will trigger replacement. String
The resource share ID of resource manager.
status String
The status of shared target.
targetId Changes to this property will trigger replacement. 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>
Copy

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.