1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. resourcemanager
  5. SharedResource
Alibaba Cloud v3.52.1 published on Thursday, Apr 4, 2024 by Pulumi

alicloud.resourcemanager.SharedResource

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.52.1 published on Thursday, Apr 4, 2024 by Pulumi

    Provides a Resource Manager Shared Resource resource.

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

    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 exampleZones = alicloud.getZones({
        availableResourceCreation: "VSwitch",
    });
    const exampleNetwork = new alicloud.vpc.Network("exampleNetwork", {
        vpcName: name,
        cidrBlock: "192.168.0.0/16",
    });
    const exampleSwitch = new alicloud.vpc.Switch("exampleSwitch", {
        zoneId: exampleZones.then(exampleZones => exampleZones.zones?.[0]?.id),
        cidrBlock: "192.168.0.0/16",
        vpcId: exampleNetwork.id,
        vswitchName: name,
    });
    const exampleResourceShare = new alicloud.resourcemanager.ResourceShare("exampleResourceShare", {resourceShareName: name});
    const exampleSharedResource = new alicloud.resourcemanager.SharedResource("exampleSharedResource", {
        resourceId: exampleSwitch.id,
        resourceShareId: exampleResourceShare.id,
        resourceType: "VSwitch",
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tfexample"
    example_zones = alicloud.get_zones(available_resource_creation="VSwitch")
    example_network = alicloud.vpc.Network("exampleNetwork",
        vpc_name=name,
        cidr_block="192.168.0.0/16")
    example_switch = alicloud.vpc.Switch("exampleSwitch",
        zone_id=example_zones.zones[0].id,
        cidr_block="192.168.0.0/16",
        vpc_id=example_network.id,
        vswitch_name=name)
    example_resource_share = alicloud.resourcemanager.ResourceShare("exampleResourceShare", resource_share_name=name)
    example_shared_resource = alicloud.resourcemanager.SharedResource("exampleSharedResource",
        resource_id=example_switch.id,
        resource_share_id=example_resource_share.id,
        resource_type="VSwitch")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/resourcemanager"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
    	"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
    		}
    		exampleZones, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
    			AvailableResourceCreation: pulumi.StringRef("VSwitch"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		exampleNetwork, err := vpc.NewNetwork(ctx, "exampleNetwork", &vpc.NetworkArgs{
    			VpcName:   pulumi.String(name),
    			CidrBlock: pulumi.String("192.168.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleSwitch, err := vpc.NewSwitch(ctx, "exampleSwitch", &vpc.SwitchArgs{
    			ZoneId:      pulumi.String(exampleZones.Zones[0].Id),
    			CidrBlock:   pulumi.String("192.168.0.0/16"),
    			VpcId:       exampleNetwork.ID(),
    			VswitchName: pulumi.String(name),
    		})
    		if err != nil {
    			return err
    		}
    		exampleResourceShare, err := resourcemanager.NewResourceShare(ctx, "exampleResourceShare", &resourcemanager.ResourceShareArgs{
    			ResourceShareName: pulumi.String(name),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = resourcemanager.NewSharedResource(ctx, "exampleSharedResource", &resourcemanager.SharedResourceArgs{
    			ResourceId:      exampleSwitch.ID(),
    			ResourceShareId: exampleResourceShare.ID(),
    			ResourceType:    pulumi.String("VSwitch"),
    		})
    		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 exampleZones = AliCloud.GetZones.Invoke(new()
        {
            AvailableResourceCreation = "VSwitch",
        });
    
        var exampleNetwork = new AliCloud.Vpc.Network("exampleNetwork", new()
        {
            VpcName = name,
            CidrBlock = "192.168.0.0/16",
        });
    
        var exampleSwitch = new AliCloud.Vpc.Switch("exampleSwitch", new()
        {
            ZoneId = exampleZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
            CidrBlock = "192.168.0.0/16",
            VpcId = exampleNetwork.Id,
            VswitchName = name,
        });
    
        var exampleResourceShare = new AliCloud.ResourceManager.ResourceShare("exampleResourceShare", new()
        {
            ResourceShareName = name,
        });
    
        var exampleSharedResource = new AliCloud.ResourceManager.SharedResource("exampleSharedResource", new()
        {
            ResourceId = exampleSwitch.Id,
            ResourceShareId = exampleResourceShare.Id,
            ResourceType = "VSwitch",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.AlicloudFunctions;
    import com.pulumi.alicloud.inputs.GetZonesArgs;
    import com.pulumi.alicloud.vpc.Network;
    import com.pulumi.alicloud.vpc.NetworkArgs;
    import com.pulumi.alicloud.vpc.Switch;
    import com.pulumi.alicloud.vpc.SwitchArgs;
    import com.pulumi.alicloud.resourcemanager.ResourceShare;
    import com.pulumi.alicloud.resourcemanager.ResourceShareArgs;
    import com.pulumi.alicloud.resourcemanager.SharedResource;
    import com.pulumi.alicloud.resourcemanager.SharedResourceArgs;
    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 exampleZones = AlicloudFunctions.getZones(GetZonesArgs.builder()
                .availableResourceCreation("VSwitch")
                .build());
    
            var exampleNetwork = new Network("exampleNetwork", NetworkArgs.builder()        
                .vpcName(name)
                .cidrBlock("192.168.0.0/16")
                .build());
    
            var exampleSwitch = new Switch("exampleSwitch", SwitchArgs.builder()        
                .zoneId(exampleZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
                .cidrBlock("192.168.0.0/16")
                .vpcId(exampleNetwork.id())
                .vswitchName(name)
                .build());
    
            var exampleResourceShare = new ResourceShare("exampleResourceShare", ResourceShareArgs.builder()        
                .resourceShareName(name)
                .build());
    
            var exampleSharedResource = new SharedResource("exampleSharedResource", SharedResourceArgs.builder()        
                .resourceId(exampleSwitch.id())
                .resourceShareId(exampleResourceShare.id())
                .resourceType("VSwitch")
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: tfexample
    resources:
      exampleNetwork:
        type: alicloud:vpc:Network
        properties:
          vpcName: ${name}
          cidrBlock: 192.168.0.0/16
      exampleSwitch:
        type: alicloud:vpc:Switch
        properties:
          zoneId: ${exampleZones.zones[0].id}
          cidrBlock: 192.168.0.0/16
          vpcId: ${exampleNetwork.id}
          vswitchName: ${name}
      exampleResourceShare:
        type: alicloud:resourcemanager:ResourceShare
        properties:
          resourceShareName: ${name}
      exampleSharedResource:
        type: alicloud:resourcemanager:SharedResource
        properties:
          resourceId: ${exampleSwitch.id}
          resourceShareId: ${exampleResourceShare.id}
          resourceType: VSwitch
    variables:
      exampleZones:
        fn::invoke:
          Function: alicloud:getZones
          Arguments:
            availableResourceCreation: VSwitch
    

    Create SharedResource Resource

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

    Constructor syntax

    new SharedResource(name: string, args: SharedResourceArgs, opts?: CustomResourceOptions);
    @overload
    def SharedResource(resource_name: str,
                       args: SharedResourceArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def SharedResource(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       resource_id: Optional[str] = None,
                       resource_share_id: Optional[str] = None,
                       resource_type: Optional[str] = None)
    func NewSharedResource(ctx *Context, name string, args SharedResourceArgs, opts ...ResourceOption) (*SharedResource, error)
    public SharedResource(string name, SharedResourceArgs args, CustomResourceOptions? opts = null)
    public SharedResource(String name, SharedResourceArgs args)
    public SharedResource(String name, SharedResourceArgs args, CustomResourceOptions options)
    
    type: alicloud:resourcemanager:SharedResource
    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 SharedResourceArgs
    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 SharedResourceArgs
    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 SharedResourceArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SharedResourceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SharedResourceArgs
    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 sharedResourceResource = new AliCloud.ResourceManager.SharedResource("sharedResourceResource", new()
    {
        ResourceId = "string",
        ResourceShareId = "string",
        ResourceType = "string",
    });
    
    example, err := resourcemanager.NewSharedResource(ctx, "sharedResourceResource", &resourcemanager.SharedResourceArgs{
    	ResourceId:      pulumi.String("string"),
    	ResourceShareId: pulumi.String("string"),
    	ResourceType:    pulumi.String("string"),
    })
    
    var sharedResourceResource = new SharedResource("sharedResourceResource", SharedResourceArgs.builder()        
        .resourceId("string")
        .resourceShareId("string")
        .resourceType("string")
        .build());
    
    shared_resource_resource = alicloud.resourcemanager.SharedResource("sharedResourceResource",
        resource_id="string",
        resource_share_id="string",
        resource_type="string")
    
    const sharedResourceResource = new alicloud.resourcemanager.SharedResource("sharedResourceResource", {
        resourceId: "string",
        resourceShareId: "string",
        resourceType: "string",
    });
    
    type: alicloud:resourcemanager:SharedResource
    properties:
        resourceId: string
        resourceShareId: string
        resourceType: string
    

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

    ResourceId string
    The resource ID need shared.
    ResourceShareId string
    The resource share ID of resource manager.
    ResourceType string
    The resource type of should shared. Valid values:
    ResourceId string
    The resource ID need shared.
    ResourceShareId string
    The resource share ID of resource manager.
    ResourceType string
    The resource type of should shared. Valid values:
    resourceId String
    The resource ID need shared.
    resourceShareId String
    The resource share ID of resource manager.
    resourceType String
    The resource type of should shared. Valid values:
    resourceId string
    The resource ID need shared.
    resourceShareId string
    The resource share ID of resource manager.
    resourceType string
    The resource type of should shared. Valid values:
    resource_id str
    The resource ID need shared.
    resource_share_id str
    The resource share ID of resource manager.
    resource_type str
    The resource type of should shared. Valid values:
    resourceId String
    The resource ID need shared.
    resourceShareId String
    The resource share ID of resource manager.
    resourceType String
    The resource type of should shared. Valid values:

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of the Shared Resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of the Shared Resource.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the Shared Resource.
    id string
    The provider-assigned unique ID for this managed resource.
    status string
    The status of the Shared Resource.
    id str
    The provider-assigned unique ID for this managed resource.
    status str
    The status of the Shared Resource.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the Shared Resource.

    Look up Existing SharedResource Resource

    Get an existing SharedResource 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?: SharedResourceState, opts?: CustomResourceOptions): SharedResource
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            resource_id: Optional[str] = None,
            resource_share_id: Optional[str] = None,
            resource_type: Optional[str] = None,
            status: Optional[str] = None) -> SharedResource
    func GetSharedResource(ctx *Context, name string, id IDInput, state *SharedResourceState, opts ...ResourceOption) (*SharedResource, error)
    public static SharedResource Get(string name, Input<string> id, SharedResourceState? state, CustomResourceOptions? opts = null)
    public static SharedResource get(String name, Output<String> id, SharedResourceState 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:
    ResourceId string
    The resource ID need shared.
    ResourceShareId string
    The resource share ID of resource manager.
    ResourceType string
    The resource type of should shared. Valid values:
    Status string
    The status of the Shared Resource.
    ResourceId string
    The resource ID need shared.
    ResourceShareId string
    The resource share ID of resource manager.
    ResourceType string
    The resource type of should shared. Valid values:
    Status string
    The status of the Shared Resource.
    resourceId String
    The resource ID need shared.
    resourceShareId String
    The resource share ID of resource manager.
    resourceType String
    The resource type of should shared. Valid values:
    status String
    The status of the Shared Resource.
    resourceId string
    The resource ID need shared.
    resourceShareId string
    The resource share ID of resource manager.
    resourceType string
    The resource type of should shared. Valid values:
    status string
    The status of the Shared Resource.
    resource_id str
    The resource ID need shared.
    resource_share_id str
    The resource share ID of resource manager.
    resource_type str
    The resource type of should shared. Valid values:
    status str
    The status of the Shared Resource.
    resourceId String
    The resource ID need shared.
    resourceShareId String
    The resource share ID of resource manager.
    resourceType String
    The resource type of should shared. Valid values:
    status String
    The status of the Shared Resource.

    Import

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

    $ pulumi import alicloud:resourcemanager/sharedResource:SharedResource example <resource_share_id>:<resource_id>:<resource_type>
    

    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.52.1 published on Thursday, Apr 4, 2024 by Pulumi