English | 简体中文
Terraform module which creates ECS instance(s) on Alibaba Cloud.
These types of resources are supported:
| Name | Version |
|---|---|
| terraform | >= 0.12.0 |
| alicloud | >= 1.56.0 |
data "alicloud_images" "ubuntu" {
most_recent = true
name_regex = "^ubuntu_18.*64"
}
module "ecs_cluster" {
source = "alibaba/ecs-instance/alicloud"
profile = "Your-Profile-Name"
version = "~> 2.0"
region = "cn-beijing"
number_of_instances = 5
name = "my-ecs-cluster"
use_num_suffix = true
image_id = data.alicloud_images.ubuntu.ids.0
instance_type = "ecs.sn1ne.large"
vswitch_id = "vsw-fhuqie"
security_group_ids = ["sg-12345678"]
associate_public_ip_address = true
internet_max_bandwidth_out = 10
key_name = "for-ecs-cluster"
system_disk_category = "cloud_ssd"
system_disk_size = 50
tags = {
Created = "Terraform"
Environment = "dev"
}
}- Basic ECS Instance example
- ECS Instance with disk attachment example
- ECS Instance with EIP association example
- Bare-Metal ECS Instance example
- Compute-Optimized-Type-With-Fpga ECS Instance example
- Compute-Optimized-Type-With-Gpu ECS Instance example
- Visualization-Compute-Optimized-Type-With-Gpu ECS Instance example
- Super-Computing-Cluster-Cpu ECS Instance example
- x86-Architecture-Big-Data ECS Instance example
- x86-Architecture-Compute-Optimized ECS Instance example
- x86-Architecture-Entry-Level ECS Instance example
- x86-Architecture-General-Purpose ECS Instance example
- x86-Architecture-High-Clock-Speed ECS Instance example
- x86-Architecture-Local-Ssd ECS Instance example
- x86-Architecture-Memory-Optimized ECS Instance example
From the version v2.8.0, the module has removed the following provider setting:
provider "alicloud" {
profile = var.profile != "" ? var.profile : null
region = var.region != "" ? var.region : null
skip_region_validation = var.skip_region_validation
}If you still want to use the provider setting to apply this module, you can specify a supported version, like 2.7.0:
module "ecs-instance" {
source = "terraform-alicloud-modules/ecs-instance/alicloud"
version = "2.7.0"
region = "cn-hangzhou"
profile = "Your-Profile-Name"
key_name = "for-ecs-cluster"
system_disk_category = "cloud_ssd"
system_disk_size = 50
}If you want to upgrade the module to 2.8.0 or higher in-place, you can define a provider which same region with previous region:
provider "alicloud" {
region = "cn-hangzhou"
profile = "Your-Profile-Name"
}
module "ecs-instance" {
source = "terraform-alicloud-modules/ecs-instance/alicloud"
key_name = "for-ecs-cluster"
system_disk_category = "cloud_ssd"
system_disk_size = 50
}or specify an alias provider with a defined region to the module using providers:
provider "alicloud" {
region = "cn-hangzhou"
profile = "Your-Profile-Name"
alias = "hz"
}
module "ecs-instance" {
source = "terraform-alicloud-modules/ecs-instance/alicloud"
providers = {
alicloud = alicloud.hz
}
key_name = "for-ecs-cluster"
system_disk_category = "cloud_ssd"
system_disk_size = 50
}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
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.
Created and maintained by Alibaba Cloud Terraform Team(terraform@alibabacloud.com)
Apache 2 Licensed. See LICENSE for full details.