Skip to content
SHC Docs

Example: alibaba-shc

terraform/examples/alibaba-shc builds three ECS instances on a VPC with one VSwitch and one security group, then bootstraps them when vault_pw is set. No platform resources.

  • modules/shc/alibaba takes a region, an optional zone_id and an instance_type per group. With zone_id unset the module picks the first zone of the region that can hold a VSwitch.
  • The Alibaba provider reads ALICLOUD_ACCESS_KEY, ALICLOUD_SECRET_KEY and ALICLOUD_REGION from the environment; the provider block is empty.
  • bootstrap = var.vault_pw == "" ? null : { ... } gates the cluster on the password, as the Linode root does.
module "shc" {
source = "../../modules/shc/alibaba"
cluster_name = var.cluster_name
region = var.region
zone_id = var.zone_id
ssh_public_key = var.ssh_public_key
node_groups = {
control = { count = 3, instance_type = var.instance_type, runtime = "docker", control_plane = true }
}
}

ALICLOUD_ACCESS_KEY, ALICLOUD_SECRET_KEY, ALICLOUD_REGION, TF_VAR_ssh_public_key and TF_VAR_vault_pw come from the environment.

Terminal window
tofu -chdir=learn/shc/terraform/examples/alibaba-shc init
tofu -chdir=learn/shc/terraform/examples/alibaba-shc apply
tofu -chdir=learn/shc/terraform/examples/alibaba-shc destroy

This page was not walked: labs run on the learning project at Hetzner only, and the module has not been applied against a live account. Track F’s Alibaba page covers the same account through the CLI.

Next: Example: cloudstack-shc.