alicloud_bastionhost_host_account_share_key_attachment
更新时间:
Provides a Bastion Host Account Share Key Attachment resource.
For information about Bastion Host Host Account Share Key Attachment and how to use it, see What is Host Account Share Key Attachment.
-> NOTE: Available since v1.165.0.
Example Usage
Basic Usage
variable "name" {
default = "tf_example"
}
data "alicloud_zones" "default" {
available_resource_creation = "VSwitch"
}
data "alicloud_vpcs" "default" {
name_regex = "^default-NODELETING$"
cidr_block = "10.4.0.0/16"
}
data "alicloud_vswitches" "default" {
cidr_block = "10.4.0.0/24"
vpc_id = data.alicloud_vpcs.default.ids.0
zone_id = data.alicloud_zones.default.zones.0.id
}
resource "alicloud_security_group" "default" {
vpc_id = data.alicloud_vpcs.default.ids.0
}
resource "alicloud_bastionhost_instance" "default" {
description = var.name
license_code = "bhah_ent_50_asset"
plan_code = "cloudbastion"
storage = "5"
bandwidth = "5"
period = "1"
vswitch_id = data.alicloud_vswitches.default.ids[0]
security_group_ids = [alicloud_security_group.default.id]
}
resource "alicloud_bastionhost_host" "default" {
instance_id = alicloud_bastionhost_instance.default.id
host_name = var.name
active_address_type = "Private"
host_private_address = "172.16.0.10"
os_type = "Linux"
source = "Local"
}
resource "alicloud_bastionhost_host_account" "default" {
host_account_name = var.name
host_id = alicloud_bastionhost_host.default.host_id
instance_id = alicloud_bastionhost_host.default.instance_id
protocol_name = "SSH"
password = "YourPassword12345"
}
variable "private_key" {
default = "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcEFJQkFBS0NBUUVBc25oc29SSVVwVXltSG1FVHJXUGxDbkhMa3c3N0JYTm44ZHcvbDg3eG10SUhjd2syCkRybjFDZk5jZkpJV0tSdkFaYkdKMlZTS1RiRDhPTmcyT3JvUHFGUHBLOHJ5QjJRb1NYQVRsaUVHWFhNeW1tRm8KeDBmem12THFscUxpNGZnOExhcTc5UC85aGxLU1djTWhJU0pYVTNHMS9KdEFBUmEyQXc4cXEzSVQvMkZ5NktrdwowMU9MdDdLN2pGUFRPaHhtd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mczUWkxc01MblRWeTExeVN1UEVFSCtMT2s1N3d2akNLSk5XZnM0SjVyCmg1NGw0QXZ6UVhyWWN0UlZkSmYrNjFacGFnTkdZMVBvWVJMTHJMSWRBb0dBTndydzErRzJtNWJ0YW04S2hwU1QKMzVLbmRnajlkM3N6cStrcE03aGZpZWYvcXZGTU9jWHVJQlRjRVRFVHNWNlRyTFdsZkQ2d3NrVitybDFCbEhSbwpqaXpoT3dCU2NOZ3hlbTA3TXE0cXBwYTViYVltVW5QNUlwTjRwdDNJeFVPaFQ4UitxS0h2TnJYZ1hjZGlSYXl4CjFoejhkeFoxckxselpTNHd3M001MVlzQ2dZRUFpUDEwTEUySXg5Q2wrTTdZWTZZU2I0Zkx1MGhKRy9XOGFuemIKSFExZlBrOTVFRytJVlJyRUl2ZS95MHNvOTE4VzdyL0lteWxVbG5ORHFEUWZkK3grSmVNaXBuenRsRUorRGZxdgprQ3c4dUtJUUI5akZXV0l4T0JpVktyVnB6bll6ZG9Gd2dRd3BneDBKazFDZzlIblpMQWpVWUJyUDEwUy9ORFFRClJUdldjK0VDZ1lBeGRIZWxQNG1RdkJaS1oxMlNKbHlLbFVLeW43aHhzSHVkMkphMVNtS3FWeHBERDNlR0w0Y3QKZXA1QTZ5NkF4eGViZkI0aDdYNEZ0QTBBRURPdkZDR0J1QlRvZ3ZBdUNDVUtqK2JIUG1SNG53UVYzcWZ2M3loRAp0TGkwU2FHVElta2wvbUNCUDhZaW9JUys2N0xjby9kbHphUTNGVDlxTnJieFdFWjJlaS9LVlE9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQ=="
}
resource "alicloud_bastionhost_host_share_key" "default" {
host_share_key_name = var.name
instance_id = alicloud_bastionhost_instance.default.id
private_key = var.private_key
}
resource "alicloud_bastionhost_host_account_share_key_attachment" "default" {
instance_id = alicloud_bastionhost_instance.default.id
host_share_key_id = alicloud_bastionhost_host_share_key.default.host_share_key_id
host_account_id = alicloud_bastionhost_host_account.default.host_account_id
}
Argument Reference
The following arguments are supported:
instance_id
- (Required, ForceNew) The ID of the Bastion machine instance.host_account_id
- (Required, ForceNew) The ID list of the host account.host_share_key_id
- (Required, ForceNew) The ID of the host shared key.
Attributes Reference
The following attributes are exported:
id
- The resource ID of Host Account Share Key Attachment. The value formats as<instance_id>:<host_share_key_id>:<host_account_id>
.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 1 mins) Used when create the Bastion Host Account Share Key Attachment.delete
- (Defaults to 1 mins) Used when delete the Bastion Host Account Share Key Attachment.
Import
Bastion Host Account Share Key Attachment can be imported using the id, e.g.
$ terraform import alicloud_bastionhost_host_account_share_key_attachment.example <instance_id>:<host_share_key_id>:<host_account_id>
文档内容是否对您有帮助?