/terraform-ucloud-uhost-instance

Terraform module which creates UHost instance(s) on UCloud

Primary LanguageHCLMozilla Public License 2.0MPL-2.0

UCloud UHost Instance Terraform module

Terraform module which creates UHost instance(s) on UCloud.

These types of resources are supported:

Usage

# Create uhost instance attached with eip and cloud disk
module "uhost_instance" {
  source = "terraform-ucloud-modules/uhost_instance/ucloud"
  version = "1.0.0"

  # uhost instance
  instance_count = 2
  instance_name    = "example-complete-instance"
  password    = "ucloud_2019"
  image_name_regex = "^CentOS 7.[1-2] 64"
  image_type       = "base"
  instance_type    = "n-standard-2"
  tag     = "example-complete"
  
  # the default Web Security Group that UCloud recommend to users
  security_group = "${data.ucloud_security_groups.default.security_groups.0.id}"

  # eip
  eip_count_per_instance = 1
  eip_internet_type      = "bgp"
  eip_charge_mode        = "bandwidth"
  eip_name  = "example-complete-eip"

  # disk
  disk_count_per_instance = 1
  disk_size               = 30
  disk_type               = "ssd_data_disk"
  disk_name   = "example-complete-disk"
}

Examples

Inputs

Name Description Type Default Required
password The password of instance string - yes
availability_zone Available zone where instance and other resources are located. If not set, the first availability zone of current region will be used. string "" no
count_format Number format to use for output. string "%02d" no
image_name_regex The name regex of image to use for fetch specified image when image_id isn't set. string "^CentOS 7.4 64" no
image_type The type of image to filter image when image_id isn't set. Possible values: base, business, custom. string "base" no
image_id ID of image to use for instances. string "" no
instance_count Number of instances to launch. string "1" no
instance_type The type of instance to launch. string "n-basic-1" no
instance_name Name to be used on instances as prefix. string "TF-UHost-Instance" no
charge_type The charge type of instance and other related resources. Possible values: year, month, dynamic. string "month" no
duration The duration of purchase of the instance and other related resources string "1" no
boot_disk_type The type of system disk. Possible values: local_normal, local_ssd, cloud_normal, cloud_ssd. string "local_normal" no
local_disk_size The size of local data disk string "0" no
local_disk_type The type of local data disk. Possible values: local_normal, local_ssd. string "local_normal" no
tag The tag of instance and other related resources string "Default" no
security_group ID of security group to use for instances. If not set, the default security group will be used. string "" no
vpc_id The VPC linked to the instance string "" no
subnet_id The Subnet linked to the instance string "" no
disk_count_per_instance Number of disks attach to per instance. string "0" no
disk_name Name to be used on disks as prefix string "TF-Disk" no
disk_size The size of cloud data disk. string "30" no
disk_type The type of cloud data disk. Possible values: data_disk, ssd_data_disk. string "data_disk" no
eip_count_per_instance Number of eips assiocate to per instance. string "0" no
eip_name Name to be used on eips as prefix string "TF-EIP" no
eip_bandwidth Maximum bandwidth to the elastic public network, measured in Mbps. string "1" no
eip_internet_type The type of eip routes. Possible values: international, bgp. string "bgp" no
eip_charge_mode The charge mode of eip. Possible values: traffic, bandwidth. string "bandwidth" no

Outputs

Name Description
instance_ids List of IDs of instances
eip_ids List of IDs of eips
public_ips List of public IP addresses assigned to the instances, if applicable
disk_ids List of IDs of disks
instance_id List of IDs of instances

Authors

Module managed by mingsheng.su.

Reference