一键批量部署 OpenClaw(1) $%^&+{}[]:;'<>,.?/且不能以斜线号/开头" } variable "instancecount" { type number default 1 description "创建OpenClaw的云主机数量" } variable "bandwidth" { type number default 5 description "带宽大小,传递时会自动创建弹性IP并绑定,单位为Mbit/s,取值范围:[1, 2000],为了保证使用体验,建议至少设置成5" } 资源定义 创建vpc resource "ctyunvpc" "vpctest" { name var.vpcname cidr "192.168.0.0/16" description "terraform测试使用" enableipv6 true } 在vpc下创建子网 resource "ctyunsubnet" "subnettest" { vpcid ctyunvpc.vpctest.id name "subnetforopenclaw" cidr "192.168.1.0/24" description "terraform测试使用" dns [ "114.114.114.114", "8.8.8.8" ] enableipv6 true } 查询flavor data "ctyunecsflavors" "ctyunecsflavorsopenclaw" { azname var.azname name var.flavorname } 按需开通多台云主机 resource "ctyunecs" "ecstest" { count var.instancecount instancename "${var.instancename}${count.index + 1}" displayname "${var.instancename}${count.index + 1}" flavorid data.ctyunecsflavors.ctyunecsflavorsopenclaw.flavors[0].id imageid var.imageid systemdisktype "sata" systemdisksize 40 vpcid ctyunvpc.vpctest.id cycletype "ondemand" subnetid ctyunsubnet.subnettest.id azname var.azname bandwidth var.bandwidth password var.password securitygroupids [ctyunsecuritygroup.securitygroupopenclawtest.id] }
来自: