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]),
});
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])
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
})
}
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])),
});
});
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());
}
}
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: {}
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 resource share ID of resource manager.
- Target
Id string - The member account ID in resource directory.
- string
- The resource share ID of resource manager.
- Target
Id string - The member account ID in resource directory.
- String
- The resource share ID of resource manager.
- target
Id String - The member account ID in resource directory.
- string
- The resource share ID of resource manager.
- target
Id string - The member account ID in resource directory.
- str
- The resource share ID of resource manager.
- target_
id str - The member account ID in resource directory.
- String
- The resource share ID of resource manager.
- target
Id 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:
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.
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.