全部文档
当前文档

暂无内容

如果没有找到您期望的内容,请尝试其他搜索词

文档中心

ksyun_instance

最近更新时间:2019-12-20 16:41:01

Provides a KEC instance resource.

Note: Monthly instances cannot be deleted and will be released automatically after expiration.

Example Usage

data "ksyun_availability_zones" "default" {
  output_file=""
  ids=[]
}

data "ksyun_lines" "default" {
  output_file=""
  line_name="BGP"
}

resource "ksyun_vpc" "default" {
  vpc_name   = "${var.vpc_name}"
  cidr_block = "${var.vpc_cidr}"
}

resource "ksyun_subnet" "default" {
  subnet_name      = "${var.subnet_name}"
  cidr_block = "10.1.0.0/21"
  subnet_type = "Normal"
  dhcp_ip_from = "10.1.0.2"
  dhcp_ip_to = "10.1.0.253"
  vpc_id  = "${ksyun_vpc.default.id}"
  gateway_ip = "10.1.0.1"
  dns1 = "198.18.254.41"
  dns2 = "198.18.254.40"
  availability_zone = "${data.ksyun_availability_zones.default.availability_zones.0.availability_zone_name}"
}

resource "ksyun_security_group" "default" {
  vpc_id = "${ksyun_vpc.default.id}"
  security_group_name="${var.security_group_name}"
}

resource "ksyun_security_group_entry" "default" {
  description = "test1"
  security_group_id="${ksyun_security_group.default.id}"
  cidr_block="10.0.1.1/32"
  direction="in"
  protocol="ip"
  icmp_type=0
  icmp_code=0
  port_range_from=0
  port_range_to=0
}

resource "ksyun_ssh_key" "default" {
  key_name="ssh_key_tf"
  public_key=""
}

resource "ksyun_instance" "default" {
  image_id="${data.ksyun_images.centos-7_5.images.0.image_id}"
  instance_type="N3.2B"
  system_disk{
    disk_type="SSD3.0"
    disk_size=30
  }
  data_disk_gb=0
  data_disk =[
    {
      type="SSD3.0"
      size=20
      delete_with_instance=true
    }
  ]
  subnet_id="${ksyun_subnet.default.id}"
  instance_password="Xuan663222"
  keep_image_login=false
  charge_type="Daily"
  purchase_time=1
  security_group_id=["${ksyun_security_group.default.id}"]
  private_ip_address=""
  instance_name="xuan-tf-combine"
  instance_name_suffix=""
  sriov_net_support=false
  project_id=0
  data_guard_id=""
  key_id=["${ksyun_ssh_key.default.id}"]
  force_delete=true
}

Argument Reference

The following arguments are supported:

  • image_id - (Required) The ID of the image to use for the instance.

  • instance_type - (Required) The type of the instance.

  • system_disk - (Required) System disk parameters.

    • disk_type - System disk type. Valid values are Local_SSD(local SSD disk), SSD3.0 (SSD cloud disk), and EHDD(EHDD cloud disk).
    • disk_size - The size of the data disk, in GB.
  • data_disk_gb - (Optional) Local SSD disk.

  • data_disk - (Optional) The list of data disks created together with the instance.

    • type - Data disk type. Valid values are SSD3.0 (SSD cloud disk) and EHDD (EHDD cloud disk).
    • size - The size of the data disk, in GB.
    • delete_with_instance - Whether or not the data disk is deleted when the instance is terminated.
  • subnet_id - (Required) The ID of the subnet where the instance is located in the current region.

  • security_group_id - (Required) The ID of the security group to which the instance is assigned.

  • instance_password - (Optional) The password to access the instance, which is a string of 8 to 32 characters.

  • instance_name - (Optional) Instance name, which contains 2 to 64 alphanumeric characters.

  • keep_image_login - (Optional) Whether or not to keep the initial settings of the custom image.

  • charge_type - (Required) The charging type used by the instance. Valid values are Monthly, Daily, and HourlyInstantSettlement.

  • purchase_time - (Optional) Time duration that the instance is purchased for.

  • private_ip_address - (Optional) Instance private IP address, which is assigned when the instance is created.

  • sriov_net_support (Optional) Whether or not network enhancement is supported.

  • project_id - (Optional) The ID of the project to which the instance is assigned.

  • user_data - (Optional) The user data to be specified into this instance. The value must be encrypted in base64 format and cannot exceed 16 KB.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • creation_date - The time when the instance was created. The value is an ISO8601 string.
  • instance_state - Instance current status. Possible values are active, building, stopped, deleting.
文档导读
纯净模式常规模式

纯净模式

点击可全屏预览文档内容
文档反馈