Provides a Bastion Host User resource.
For information about Bastion Host User and how to use it, see What is User.
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_user" "local_user" {
instance_id = alicloud_bastionhost_instance.default.id
mobile_country_code = "CN"
mobile = "13312345678"
password = "YourPassword-123"
source = "Local"
user_name = "${var.name}_local_user"
}
resource "alicloud_ram_user" "user" {
name = "${var.name}_bastionhost_user"
display_name = "${var.name}_bastionhost_user"
mobile = "86-18688888888"
email = "hello.uuu@aaa.com"
comments = "yoyoyo"
force = true
}
data "alicloud_account" "default" {}
resource "alicloud_bastionhost_user" "ram_user" {
instance_id = alicloud_bastionhost_instance.default.id
source = "Ram"
source_user_id = data.alicloud_account.default.id
user_name = alicloud_ram_user.user.name
}
The following arguments are supported:
comment
- (Optional) Specify the New of the User That Created the Remark Information. Supports up to 500 Characters.display_name
- (Optional) Specify the New Created the User's Display Name. Supports up to 128 Characters.email
- (Optional) Specify the New User's Mailbox.instance_id
- (Required, ForceNew) You Want to Query the User the Bastion Host ID of.mobile
- (Optional) Specify the New of the User That Created a Different Mobile Phone Number from Your.mobile_country_code
- (Optional) Specify the New Create User Mobile Phone Number of the International Domain Name. The Default Value Is the CN. Valid Values:
password
- (Optional, Sensitive) Specify the New User's Password. Supports up to 128 Characters. Description of the New User as the Source of the Local User That Is, Source Value for Local, this Parameter Is Required.source
- (Required, ForceNew) Specify the New of the User That Created the Source. Valid Values:
The following attributes are exported:
id
- The resource ID of User. The value formats as <instance_id>:<user_id>
.user_id
- The User ID.The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 5 mins) Used when create the User.update
- (Defaults to 5 mins) Used when update the User.delete
- (Defaults to 5 mins) Used when delete the User.Bastion Host User can be imported using the id, e.g.
$ terraform import alicloud_bastionhost_user.example <instance_id>:<user_id>