alicloud_resource_manager_shared_resource

更新时间:

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


variable "name" {
  default = "terraform-example"
}

data "alicloud_zones" "default" {
  available_resource_creation = "VSwitch"
}

resource "random_integer" "default" {
  min = 10000
  max = 99999
}

resource "alicloud_vpc" "default" {
  vpc_name   = "${var.name}-${random_integer.default.result}"
  cidr_block = "192.168.0.0/16"
}

resource "alicloud_vswitch" "default" {
  zone_id      = data.alicloud_zones.default.zones.0.id
  cidr_block   = "192.168.0.0/16"
  vpc_id       = alicloud_vpc.default.id
  vswitch_name = "${var.name}-${random_integer.default.result}"
}

resource "alicloud_resource_manager_resource_share" "default" {
  resource_share_name = "${var.name}-${random_integer.default.result}"
}

resource "alicloud_resource_manager_shared_resource" "default" {
  resource_share_id = alicloud_resource_manager_resource_share.default.id
  resource_id       = alicloud_vswitch.default.id
  resource_type     = "VSwitch"
}

Argument Reference

The following arguments are supported:

  • resource_id - (Required, ForceNew) The ID of the shared resource.
  • resource_share_id - (Required, ForceNew) The ID of the resource share.
  • resource_type - (Required, ForceNew) The type of the shared resource. Valid values:
    • VSwitch.
    • The following types are added after v1.173.0: ROSTemplate and ServiceCatalogPortfolio.
    • The following types are added after v1.192.0: PrefixList and Image.
    • The following types are added after v1.194.1: PublicIpAddressPool.
    • The following types are added after v1.208.0: KMSInstance.
    • The following types are added after v1.240.0: Snapshot.
    • For more information about the types of resources that can be shared, see Services that work with Resource Sharing

Attributes Reference

The following attributes are exported:

  • id - The ID of the resource supplied above.The value is formulated as <resource_share_id>:<resource_id>:<resource_type>.
  • create_time - (Available since v1.259.0) The time when the shared resource was associated with the resource share.
  • status - The status of the Shared Resource.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 10 mins) Used when create the Shared Resource.
  • delete - (Defaults to 10 mins) Used when delete the Shared Resource.

Import

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

$ terraform import alicloud_resource_manager_shared_resource.example <resource_share_id>:<resource_id>:<resource_type>