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";
import * as random from "@pulumi/random";
const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const _default = alicloud.resourcemanager.getAccounts({});
const defaultInteger = new random.index.Integer("default", {
min: 10000,
max: 99999,
});
const defaultResourceShare = new alicloud.resourcemanager.ResourceShare("default", {resourceShareName: `${name}-${defaultInteger.result}`});
const defaultSharedTarget = new alicloud.resourcemanager.SharedTarget("default", {
resourceShareId: defaultResourceShare.id,
targetId: _default.then(_default => _default.ids?.[0]),
});
import pulumi
import pulumi_alicloud as alicloud
import pulumi_random as random
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
default = alicloud.resourcemanager.get_accounts()
default_integer = random.index.Integer("default",
min=10000,
max=99999)
default_resource_share = alicloud.resourcemanager.ResourceShare("default", resource_share_name=f"{name}-{default_integer['result']}")
default_shared_target = alicloud.resourcemanager.SharedTarget("default",
resource_share_id=default_resource_share.id,
target_id=default.ids[0])
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 := "terraform-example"
if param := cfg.Get("name"); param != "" {
name = param
}
_default, err := resourcemanager.GetAccounts(ctx, &resourcemanager.GetAccountsArgs{}, nil)
if err != nil {
return err
}
defaultInteger, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
Min: 10000,
Max: 99999,
})
if err != nil {
return err
}
defaultResourceShare, err := resourcemanager.NewResourceShare(ctx, "default", &resourcemanager.ResourceShareArgs{
ResourceShareName: pulumi.Sprintf("%v-%v", name, defaultInteger.Result),
})
if err != nil {
return err
}
_, err = resourcemanager.NewSharedTarget(ctx, "default", &resourcemanager.SharedTargetArgs{
ResourceShareId: defaultResourceShare.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;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "terraform-example";
var @default = AliCloud.ResourceManager.GetAccounts.Invoke();
var defaultInteger = new Random.Index.Integer("default", new()
{
Min = 10000,
Max = 99999,
});
var defaultResourceShare = new AliCloud.ResourceManager.ResourceShare("default", new()
{
ResourceShareName = $"{name}-{defaultInteger.Result}",
});
var defaultSharedTarget = new AliCloud.ResourceManager.SharedTarget("default", new()
{
ResourceShareId = defaultResourceShare.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.random.Integer;
import com.pulumi.random.IntegerArgs;
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("terraform-example");
final var default = ResourcemanagerFunctions.getAccounts(GetAccountsArgs.builder()
.build());
var defaultInteger = new Integer("defaultInteger", IntegerArgs.builder()
.min(10000)
.max(99999)
.build());
var defaultResourceShare = new ResourceShare("defaultResourceShare", ResourceShareArgs.builder()
.resourceShareName(String.format("%s-%s", name,defaultInteger.result()))
.build());
var defaultSharedTarget = new SharedTarget("defaultSharedTarget", SharedTargetArgs.builder()
.resourceShareId(defaultResourceShare.id())
.targetId(default_.ids()[0])
.build());
}
}
configuration:
name:
type: string
default: terraform-example
resources:
defaultInteger:
type: random:Integer
name: default
properties:
min: 10000
max: 99999
defaultResourceShare:
type: alicloud:resourcemanager:ResourceShare
name: default
properties:
resourceShareName: ${name}-${defaultInteger.result}
defaultSharedTarget:
type: alicloud:resourcemanager:SharedTarget
name: default
properties:
resourceShareId: ${defaultResourceShare.id}
targetId: ${default.ids[0]}
variables:
default:
fn::invoke:
function: alicloud:resourcemanager:getAccounts
arguments: {}
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 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.
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",
});
example, err := resourcemanager.NewSharedTarget(ctx, "sharedTargetResource", &resourcemanager.SharedTargetArgs{
ResourceShareId: pulumi.String("string"),
TargetId: pulumi.String("string"),
})
var sharedTargetResource = new SharedTarget("sharedTargetResource", SharedTargetArgs.builder()
.resourceShareId("string")
.targetId("string")
.build());
shared_target_resource = alicloud.resourcemanager.SharedTarget("sharedTargetResource",
resource_share_id="string",
target_id="string")
const sharedTargetResource = new alicloud.resourcemanager.SharedTarget("sharedTargetResource", {
resourceShareId: "string",
targetId: "string",
});
type: alicloud:resourcemanager:SharedTarget
properties:
resourceShareId: string
targetId: string
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:
- string
- The ID of the resource share.
- Target
Id string - The ID of the principal.
- string
- The ID of the resource share.
- Target
Id string - The ID of the principal.
- String
- The ID of the resource share.
- target
Id String - The ID of the principal.
- string
- The ID of the resource share.
- target
Id string - The ID of the principal.
- str
- The ID of the resource share.
- target_
id str - The ID of the principal.
- String
- The ID of the resource share.
- target
Id String - The ID of the principal.
Outputs
All input properties are implicitly available as output properties. Additionally, the SharedTarget resource produces the following output properties:
- Create
Time string - (Available since v1.259.0) The time when the association of the entity was created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Status string
- The status of shared target.
- Create
Time string - (Available since v1.259.0) The time when the association of the entity was created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Status string
- The status of shared target.
- create
Time String - (Available since v1.259.0) The time when the association of the entity was created.
- id String
- The provider-assigned unique ID for this managed resource.
- status String
- The status of shared target.
- create
Time string - (Available since v1.259.0) The time when the association of the entity was created.
- id string
- The provider-assigned unique ID for this managed resource.
- status string
- The status of shared target.
- create_
time str - (Available since v1.259.0) The time when the association of the entity was created.
- id str
- The provider-assigned unique ID for this managed resource.
- status str
- The status of shared target.
- create
Time String - (Available since v1.259.0) The time when the association of the entity was created.
- 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,
create_time: Optional[str] = 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
- 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.
- Create
Time string - (Available since v1.259.0) The time when the association of the entity was created.
- string
- The ID of the resource share.
- Status string
- The status of shared target.
- Target
Id string - The ID of the principal.
- Create
Time string - (Available since v1.259.0) The time when the association of the entity was created.
- string
- The ID of the resource share.
- Status string
- The status of shared target.
- Target
Id string - The ID of the principal.
- create
Time String - (Available since v1.259.0) The time when the association of the entity was created.
- String
- The ID of the resource share.
- status String
- The status of shared target.
- target
Id String - The ID of the principal.
- create
Time string - (Available since v1.259.0) The time when the association of the entity was created.
- string
- The ID of the resource share.
- status string
- The status of shared target.
- target
Id string - The ID of the principal.
- create_
time str - (Available since v1.259.0) The time when the association of the entity was created.
- str
- The ID of the resource share.
- status str
- The status of shared target.
- target_
id str - The ID of the principal.
- create
Time String - (Available since v1.259.0) The time when the association of the entity was created.
- String
- The ID of the resource share.
- status String
- The status of shared target.
- target
Id String - The ID of the principal.
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>
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.