Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

alibabacloud-automation/terraform-alicloud-ecs-spot-instance

Repository files navigation

Deprecated

Thank you for your interest in Alibaba Cloud Terraform Module. This Module will be out of maintenance as of today and will be officially taken offline in the future. We recommend you to use terraform-alicloud-ecs-instance as an alternative. More available Modules can be searched in Alibaba Cloud Terraform Module.

Thank you again for your understanding and cooperation.

Alibaba Cloud ECS Spot Instance Terraform Module

terraform-alicloud-ecs-spot-instance

English | 简体中文

Terraform module for creating Spot instance(s) on Alibaba Cloud.

These types of resources are supported:

Usage

module "ecs_spot_instance" {
  source                      = "terraform-alicloud-modules/ecs-spot-instance/alicloud"
  instance_type_family        = "ecs.g6"
  vswitch_id                  = "vsw-fhuqie"
  security_group_ids          = ["sg-12345678"]
  associate_public_ip_address = true
  internet_max_bandwidth_out  = 10
  
  #######################
  #spot strategy setting#
  #######################
  spot_strategy               = "SpotWithPriceLimit"
  spot_price_limit            = 0.5
}

Examples

Notes

From the version v1.1.0, the module has removed the following provider setting:

provider "alicloud" {
  profile                 = var.profile != "" ? var.profile : null
  shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null
  region                  = var.region != "" ? var.region : null
  skip_region_validation  = var.skip_region_validation
  configuration_source    = "terraform-alicloud-modules/ecs-spot-instance"
}

If you still want to use the provider setting to apply this module, you can specify a supported version, like 1.0.0:

module "ecs_spot_instance" {
  source  = "terraform-alicloud-modules/ecs-spot-instance/alicloud"
  version     = "1.0.0"
  region      = "cn-beijing"
  profile     = "Your-Profile-Name"
  instance_type_family        = "ecs.g6"
  vswitch_id                  = "vsw-fhuqie"
  // ...
}

If you want to upgrade the module to 1.1.0 or higher in-place, you can define a provider which same region with previous region:

provider "alicloud" {
  region  = "cn-beijing"
  profile = "Your-Profile-Name"
}
module "ecs_spot_instance" {
  source  = "terraform-alicloud-modules/ecs-spot-instance/alicloud"
  instance_type_family        = "ecs.g6"
  vswitch_id                  = "vsw-fhuqie"
  // ...
}

or specify an alias provider with a defined region to the module using providers:

provider "alicloud" {
  region  = "cn-beijing"
  profile = "Your-Profile-Name"
  alias   = "bj"
}
module "ecs_spot_instance" {
  source  = "terraform-alicloud-modules/ecs-spot-instance/alicloud"
  providers = {
    alicloud = alicloud.bj
  }
  instance_type_family        = "ecs.g6"
  vswitch_id                  = "vsw-fhuqie"
  // ...
}

and then run terraform init and terraform apply to make the defined provider effect to the existing module state.

More details see How to use provider in the module

Terraform versions

Name Version
terraform >= 0.13.0
alicloud >= 1.56.0

Submit Issues

If you have any problems when using this module, please opening a provider issue and let us know.

Note: There does not recommend to open an issue on this repo.

Authors

Created and maintained by Alibaba Cloud Terraform Team(terraform@alibabacloud.com)

License

Apache 2 Licensed. See LICENSE for full details.

Reference