From c3cf30071348391d4c35aa35b2c098061382d86e Mon Sep 17 00:00:00 2001 From: wuzhuanhong Date: Mon, 21 Jul 2025 19:07:29 +0800 Subject: [PATCH] chore(examples/cbh): adjust script and readme of the best practices --- examples/cbh/basic-instance/README.md | 100 ++++++++++++---- examples/cbh/basic-instance/main.tf | 72 +++++------ examples/cbh/basic-instance/providers.tf | 14 +++ examples/cbh/basic-instance/terraform.tfvars | 5 + examples/cbh/basic-instance/variables.tf | 102 ++++++++++++++++ examples/cbh/basic-instance/varible.tf | 36 ------ examples/cbh/ha-instance/README.md | 118 +++++++++++-------- examples/cbh/ha-instance/main.tf | 73 ++++++------ examples/cbh/ha-instance/providers.tf | 14 +++ examples/cbh/ha-instance/terraform.tfvars | 5 + examples/cbh/ha-instance/variables.tf | 108 +++++++++++++++++ examples/cbh/ha-instance/varible.tf | 36 ------ 12 files changed, 472 insertions(+), 211 deletions(-) create mode 100644 examples/cbh/basic-instance/providers.tf create mode 100644 examples/cbh/basic-instance/terraform.tfvars create mode 100644 examples/cbh/basic-instance/variables.tf delete mode 100644 examples/cbh/basic-instance/varible.tf create mode 100644 examples/cbh/ha-instance/providers.tf create mode 100644 examples/cbh/ha-instance/terraform.tfvars create mode 100644 examples/cbh/ha-instance/variables.tf delete mode 100644 examples/cbh/ha-instance/varible.tf diff --git a/examples/cbh/basic-instance/README.md b/examples/cbh/basic-instance/README.md index 95ed0fb8b46..cb166550177 100644 --- a/examples/cbh/basic-instance/README.md +++ b/examples/cbh/basic-instance/README.md @@ -1,37 +1,91 @@ # Create a CBH basic instance -This example creates a CBH basic instance. The CBH dedicated instance requires a VPC, -Subnet and security group. In this example, we all create them in the simplest -way. You can replace them with resources already created in Huawei Cloud. +This example provides best practice code for using Terraform to create a CBH basic instance in HuaweiCloud. -To run, configure your HuaweiCloud provider as described in the -[document](https://registry.terraform.io/providers/huaweicloud/huaweicloud/latest/docs). +## Prerequisites -## The CBH instance configuration +* A Huawei Cloud account +* Terraform installed +* Huawei Cloud access key and secret key (AK/SK) -| Attributes | Value | -|---------------|-----------------| -| name | Cbh_demo | -| flavor_id | cbh.basic.50 | -| password | Cbh@Huawei123 | -| charging_mode | prePaid | -| period_unit | mouth | -| period | 1 | +## Required Variables + +### Authentication Variables + +* `region_name` - The region where the CBH instance is located +* `access_key` - The access key of the IAM user +* `secret_key` - The secret key of the IAM user + +### Resource Variables + +#### Required Variables + +* `vpc_name` - The name of the VPC +* `subnet_name` - The name of the subnet +* `security_group_name` - The name of the security group +* `instance_name` - The name of the CBH instance +* `instance_flavor_id` - The flavor ID of the CBH instance +* `instance_flavor_type` - The flavor type of the CBH instance +* `instance_password` - The login password of the CBH instance + +#### Optional Variables + +* `availability_zone` - The availability zone of the CBH instance (default: "") +* `vpc_cidr` - The CIDR block of the VPC (default: "192.168.0.0/16") +* `subnet_cidr` - The CIDR block of the subnet (default: "") +* `subnet_gateway_ip` - The gateway IP of the subnet (default: "") +* `charging_mode` - The charging mode of the CBH instance (default: "prePaid") +* `period_unit` - The charging period unit of the CBH instance (default: "month") +* `period` - The charging period of the CBH instance (default: 1) +* `auto_renew` - Whether to enable auto-renew for the CBH instance (default: "false") ## Usage -```shell -terraform init -terraform plan -terraform apply -terraform destroy -``` +* Copy this example script to your `main.tf`. +* Create a `terraform.tfvars` file and fill in the required variables: + + ```hcl + vpc_name = "your_vpc_name" + subnet_name = "your_subnet_name" + security_group_name = "your_security_group_name" + instance_name = "your_cbh_instance_name" + instance_flavor_id = "your_cbh_instance_flavor_id" + instance_password = "your_cbh_instance_password" + ``` + +* Initialize Terraform: + + ```bash + terraform init + ``` + +* Review the Terraform plan: + + ```bash + terraform plan + ``` + +* Apply the configuration: + + ```bash + terraform apply + ``` + +* To clean up the resources: + + ```bash + terraform destroy + ``` + +## Notes -It takes about 15 minutes to create a CBH basic instance. +* Make sure to keep your credentials secure and never commit them to version control +* It takes about 15 minutes to create a CBH basic instance +* All resources will be created in the specified region ## Requirements | Name | Version | |-------------|-----------| -| terraform | >= 0.12.0 | -| huaweicloud | >= 1.40.0 | +| terraform | >= 1.1.0 | +| huaweicloud | >= 1.64.3 | diff --git a/examples/cbh/basic-instance/main.tf b/examples/cbh/basic-instance/main.tf index 7f368af31f5..d85662bed8f 100644 --- a/examples/cbh/basic-instance/main.tf +++ b/examples/cbh/basic-instance/main.tf @@ -1,45 +1,47 @@ -# This example demonstrates how to create a CBH basic instance in Huawei Cloud using Terraform. -# It includes the creation of a VPC, subnet, security group, and the CBH instance itself. -# The example also includes the necessary variables and outputs for the created resources. - -#List the availability zones -data "huaweicloud_availability_zones" "default" {} +data "huaweicloud_cbh_availability_zones" "test" { + count = var.availability_zone == "" ? 1 : 0 +} -#create a VPC -resource "huaweicloud_vpc" "default" { - name = "cbh_vpc" - cidr = "192.168.0.0/16" +data "huaweicloud_cbh_flavors" "test" { + count = var.instance_flavor_id == "" ? 1 : 0 + type = var.instance_flavor_type } -#Create a subnet -resource "huaweicloud_vpc_subnet" "default" { - name = "cbh_subnet" - cidr = "192.168.0.0/20" - gateway_ip = "192.168.0.1" - vpc_id = huaweicloud_vpc.default.id +resource "huaweicloud_vpc" "test" { + name = var.vpc_name + cidr = var.vpc_cidr } -#create a security group -resource "huaweicloud_networking_secgroup" "default" { - name = "cbh_security_group" +resource "huaweicloud_vpc_subnet" "test" { + vpc_id = huaweicloud_vpc.test.id + name = var.subnet_name + cidr = var.subnet_cidr == "" ? cidrsubnet(huaweicloud_vpc.test.cidr, 8, 0) : var.subnet_cidr + gateway_ip = var.subnet_gateway_ip == "" ? cidrhost(cidrsubnet(huaweicloud_vpc.test.cidr, 8, 0), 1) : var.subnet_gateway_ip } -#create a CBH basic instance -resource "huaweicloud_cbh_instance" "cbh_demo" { - name = var.name - flavor_id = var.flavor_id - vpc_id = huaweicloud_vpc.default.id - subnet_id = huaweicloud_vpc_subnet.default.id - security_group_id = huaweicloud_networking_secgroup.default.id - availability_zone = data.huaweicloud_availability_zones.default.names[0] - password = var.password - charging_mode = var.charging_mode - period_unit = var.period_unit - period = var.period +resource "huaweicloud_networking_secgroup" "test" { + name = var.security_group_name + delete_default_rules = true } -#output the CBH instance ID -output "cbh_instance_id" { - value = huaweicloud_cbh_instance.cbh_demo.id - description = "The ID of the CBH instance." +resource "huaweicloud_cbh_instance" "test" { + name = var.instance_name + flavor_id = var.instance_flavor_id == "" ? try(data.huaweicloud_cbh_flavors.test[0].flavors[0].id, null) : var.instance_flavor_id + vpc_id = huaweicloud_vpc.test.id + subnet_id = huaweicloud_vpc_subnet.test.id + security_group_id = huaweicloud_networking_secgroup.test.id + availability_zone = var.availability_zone == "" ? try(data.huaweicloud_cbh_availability_zones.test[0].availability_zones[0].name, null) : var.availability_zone + password = var.instance_password + charging_mode = var.charging_mode + period_unit = var.period_unit + period = var.period + auto_renew = var.auto_renew + + # If you want to change some of the following parameters, you need to remove the corresponding fields from "lifecycle.ignore_changes". + lifecycle { + ignore_changes = [ + flavor_id, + availability_zone, + ] + } } diff --git a/examples/cbh/basic-instance/providers.tf b/examples/cbh/basic-instance/providers.tf new file mode 100644 index 00000000000..0511ea6f893 --- /dev/null +++ b/examples/cbh/basic-instance/providers.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + huaweicloud = { + source = "huaweicloud/huaweicloud" + version = ">=1.64.3" + } + } +} + +provider "huaweicloud" { + region = var.region_name + access_key = var.access_key + secret_key = var.secret_key +} diff --git a/examples/cbh/basic-instance/terraform.tfvars b/examples/cbh/basic-instance/terraform.tfvars new file mode 100644 index 00000000000..263f5a40b67 --- /dev/null +++ b/examples/cbh/basic-instance/terraform.tfvars @@ -0,0 +1,5 @@ +vpc_name = "tf_test_cbh_instance_vpc" +subnet_name = "tf_test_cbh_instance_subnet" +security_group_name = "tf_test_cbh_instance_security_group" +instance_name = "tf_test_cbh_instance" +instance_password = "YourCBHInstancePassword!" diff --git a/examples/cbh/basic-instance/variables.tf b/examples/cbh/basic-instance/variables.tf new file mode 100644 index 00000000000..d0dcc8298f1 --- /dev/null +++ b/examples/cbh/basic-instance/variables.tf @@ -0,0 +1,102 @@ +# Variable definitions for authentication +variable "region_name" { + description = "The region where the CBH instance is located" + type = string +} + +variable "access_key" { + description = "The access key of the IAM user" + type = string +} + +variable "secret_key" { + description = "The secret key of the IAM user" + type = string +} + +# Variable definitions for resources/data sources +variable "availability_zone" { + description = "The availability zone to which the CBH instance belongs" + type = string + default = "" +} + +variable "instance_flavor_id" { + description = "The flavor ID of the CBH instance" + type = string + default = "" +} + +variable "instance_flavor_type" { + description = "The flavor type of the CBH instance" + type = string + default = "basic" +} + +variable "vpc_name" { + description = "The name of the VPC" + type = string +} + +variable "vpc_cidr" { + description = "The CIDR block of the VPC" + type = string + default = "192.168.0.0/16" +} + +variable "subnet_name" { + description = "The name of the subnet" + type = string +} + +variable "subnet_cidr" { + description = "The CIDR block of the subnet" + type = string + default = "" +} + +variable "subnet_gateway_ip" { + description = "The gateway IP of the subnet" + type = string + default = "" +} + +variable "security_group_name" { + description = "The name of the security group" + type = string +} + +variable "instance_name" { + description = "The name of the CBH instance" + type = string +} + +variable "instance_password" { + description = "The login password of the CBH instance" + type = string + sensitive = true +} + +variable "charging_mode" { + description = "The charging mode of the CBH instance" + type = string + default = "prePaid" +} + +variable "period_unit" { + description = "The charging period unit of the CBH instance" + type = string + default = "month" +} + +variable "period" { + description = "The charging period of the CBH instance" + type = number + default = 1 +} + +variable "auto_renew" { + description = "Whether to enable auto-renew for the CBH instance" + type = string + default = "false" +} diff --git a/examples/cbh/basic-instance/varible.tf b/examples/cbh/basic-instance/varible.tf deleted file mode 100644 index 62b743452c3..00000000000 --- a/examples/cbh/basic-instance/varible.tf +++ /dev/null @@ -1,36 +0,0 @@ -variable name { - type = string - default = "Cbh_demo" - description = "The name of the CBH instance." -} - -variable flavor_id { - type = string - default = "cbh.basic.50" - description = "The product ID of the CBH server." -} - -variable password { - type = string - default = "Cbh@Huawei123" - description = "The password for logging in the management console." - sensitive = true -} - -variable charging_mode { - type = string - default = "prePaid" - description = "The charging mode of the CBH instance." -} - -variable period_unit { - type = string - default = "month" - description = "The charging period unit of the CBH instance." -} - -variable period { - type = number - default = 1 - description = "The charging period of the CBH instance." -} diff --git a/examples/cbh/ha-instance/README.md b/examples/cbh/ha-instance/README.md index b7d275de54f..8d3b68d97d5 100644 --- a/examples/cbh/ha-instance/README.md +++ b/examples/cbh/ha-instance/README.md @@ -1,68 +1,92 @@ # Create a CBH HA instance -This example creates a CBH HA instance. The CBH dedicated instance requires a VPC, -Subnet and security group. In this example, we all create them in the simplest -way. You can replace them with resources already created in Huawei Cloud. +This example provides best practice code for using Terraform to create a high-availability CBH HA instance in HuaweiCloud. -Compared with the CBH basic instance, the most notable difference of the CBH HA instance -lies in the necessity of clearly designating the primary and backup availability zones. +## Prerequisites -To run, configure your HuaweiCloud provider as described in the -[document](https://registry.terraform.io/providers/huaweicloud/huaweicloud/latest/docs). +* A HuaweiCloud account +* Terraform installed +* HuaweiCloud access key and secret key (AK/SK) -## The CBH HA instance configuration +## Required Variables -| Attributes | Value | -|---------------|-----------------| -| name | Cbh_HA_demo | -| flavor_id | cbh.basic.50 | -| password | Cbh@Huawei123 | -| charging_mode | prePaid | -| period_unit | mouth | -| period | 1 | +### Authentication Variables -### FAQ +* `region_name` - The region where the CBH HA instance is located +* `access_key` - The access key of the IAM user +* `secret_key` - The secret key of the IAM user -- **How can we configure the availability zones of the CBH HA instance?** +### Resource Variables - If your business requires high performance (e.g., low network latency), deploy primary and standby - availability zones in the same region. This ensures fast and stable network connections. - The expected `master_availability_zone`、`slave_availability_zone` can be obtained in the following way. +#### Required Variables - ```hcl - data "huaweicloud_cbh_instance" "cbh_HA_demo" { - master_availability_zone = data.huaweicloud_availability_zones.default.names[0] - slave_availability_zone = data.huaweicloud_availability_zones.default.names[0] - } - ``` +* `vpc_name` - The name of the VPC +* `subnet_name` - The name of the subnet +* `security_group_name` - The name of the security group +* `instance_name` - The name of the CBH HA instance +* `instance_password` - The login password for the CBH HA instance - For disaster recovery priorities, place primary and standby zones in different regions. - This improves system resilience against failures as follow: +#### Optional Variables - ```hcl - data "huaweicloud_cbh_instance" "cbh_HA_demo" { - master_availability_zone = data.huaweicloud_availability_zones.default.names[0] - slave_availability_zone = data.huaweicloud_availability_zones.default.names[1] - } - ``` - - Note: Cross-region deployment may slow down system performance. - Carefully evaluate performance trade-offs and disaster recovery needs during planning. +* `master_availability_zone` - The availability zone name of the master instance (default: "") +* `slave_availability_zone` - The availability zone name of the slave instance (default: "") +* `instance_flavor_id` - The flavor ID of the CBH HA instance (default: "") +* `instance_flavor_type` - The flavor type of the CBH HA instance (default: "basic") +* `vpc_cidr` - The CIDR block of the VPC (default: "192.168.0.0/16") +* `subnet_cidr` - The CIDR block of the subnet (default: "") +* `subnet_gateway_ip` - The gateway IP address of the subnet (default: "") +* `charging_mode` - The charging mode of the CBH HA instance (default: "prePaid") +* `period_unit` - The charging period unit of the CBH HA instance (default: "month") +* `period` - The charging period of the CBH HA instance (default: 1) +* `auto_renew` - Whether to enable auto-renew for the CBH HA instance (default: "false") ## Usage -```shell -terraform init -terraform plan -terraform apply -terraform destroy -``` +* Copy this example script to your `main.tf`. +* Create a `terraform.tfvars` file and fill in the required variables: + + ```hcl + vpc_name = "your_vpc_name" + subnet_name = "your_subnet_name" + security_group_name = "your_security_group_name" + instance_name = "your_cbh_ha_instance_name" + instance_flavor_id = "your_cbh_ha_instance_flavor_id" + instance_password = "your_cbh_ha_instance_password" + ``` + +* Initialize Terraform: + + ```bash + terraform init + ``` + +* Review the Terraform plan: + + ```bash + terraform plan + ``` + +* Apply the configuration: + + ```bash + terraform apply + ``` + +* To clean up the resources: + + ```bash + terraform destroy + ``` + +## Note -It takes about 30 minutes to create a CBH HA instance with primary-backup mode. +* Make sure to keep your credentials secure and never commit them to version control +* The creation of the CBH HA instance takes about 30 minutes +* All resources will be created in the specified region ## Requirements | Name | Version | |-------------|-----------| -| terraform | >= 0.12.0 | -| huaweicloud | >= 1.40.0 | +| terraform | >= 1.1.0 | +| huaweicloud | >= 1.64.3 | diff --git a/examples/cbh/ha-instance/main.tf b/examples/cbh/ha-instance/main.tf index 8f76d7a12d1..e2de08a71ef 100644 --- a/examples/cbh/ha-instance/main.tf +++ b/examples/cbh/ha-instance/main.tf @@ -1,45 +1,50 @@ -# This example demonstrates how to create a CBH HA instance in Huawei Cloud using Terraform. -# It includes the creation of a VPC, subnet, security group, and the CBH instance itself. -# The example also includes the necessary variables and outputs for the created resources. +data "huaweicloud_cbh_availability_zones" "test" { + count = var.master_availability_zone == "" || var.slave_availability_zone == "" ? 1 : 0 +} -#List the availability zones -data "huaweicloud_availability_zones" "default" {} +data "huaweicloud_cbh_flavors" "test" { + count = var.instance_flavor_id == "" ? 1 : 0 -#create a VPC -resource "huaweicloud_vpc" "default" { - name = "cbh_vpc" - cidr = "192.168.0.0/16" + type = var.instance_flavor_type } -#Create a subnet -resource "huaweicloud_vpc_subnet" "default" { - name = "cbh_subnet" - cidr = "192.168.0.0/20" - gateway_ip = "192.168.0.1" - vpc_id = huaweicloud_vpc.default.id +resource "huaweicloud_vpc" "test" { + name = var.vpc_name + cidr = var.vpc_cidr } -#create a security group -resource "huaweicloud_networking_secgroup" "default" { - name = "cbh_security_group" +resource "huaweicloud_vpc_subnet" "test" { + vpc_id = huaweicloud_vpc.test.id + name = var.subnet_name + cidr = var.subnet_cidr == "" ? cidrsubnet(huaweicloud_vpc.test.cidr, 8, 0) : var.subnet_cidr + gateway_ip = var.subnet_gateway_ip == "" ? cidrhost(cidrsubnet(huaweicloud_vpc.test.cidr, 8, 0), 1) : var.subnet_gateway_ip } -resource "huaweicloud_cbh_instance" "cbh_HA_demo" { - name = var.name - flavor_id = var.flavor_id - vpc_id = huaweicloud_vpc.default.id - subnet_id = huaweicloud_vpc_subnet.default.id - security_group_id = huaweicloud_networking_secgroup.default.id - master_availability_zone = data.huaweicloud_availability_zones.default.names[0] - slave_availability_zone = data.huaweicloud_availability_zones.default.names[0] - password = var.password - charging_mode = var.charging_mode - period_unit = var.period_unit - period = var.period +resource "huaweicloud_networking_secgroup" "test" { + name = var.security_group_name + delete_default_rules = true } -#output the CBH instance ID -output "cbh_instance_id" { - value = huaweicloud_cbh_instance.cbh_HA_demo.id - description = "The ID of the CBH HA instance." +resource "huaweicloud_cbh_ha_instance" "test" { + name = var.instance_name + flavor_id = var.instance_flavor_id == "" ? try(data.huaweicloud_cbh_flavors.test[0].flavors[0].id, null) : var.instance_flavor_id + vpc_id = huaweicloud_vpc.test.id + subnet_id = huaweicloud_vpc_subnet.test.id + security_group_id = huaweicloud_networking_secgroup.test.id + master_availability_zone = var.master_availability_zone == "" ? try(data.huaweicloud_cbh_availability_zones.test[0].availability_zones[0].name, null) : var.master_availability_zone + slave_availability_zone = var.slave_availability_zone == "" ? try(data.huaweicloud_cbh_availability_zones.test[0].availability_zones[1].name, null) : var.slave_availability_zone + password = var.instance_password + charging_mode = var.charging_mode + period_unit = var.period_unit + period = var.period + auto_renew = var.auto_renew + + # If you want to change some of the following parameters, you need to remove the corresponding fields from "lifecycle.ignore_changes". + lifecycle { + ignore_changes = [ + flavor_id, + master_availability_zone, + slave_availability_zone, + ] + } } diff --git a/examples/cbh/ha-instance/providers.tf b/examples/cbh/ha-instance/providers.tf new file mode 100644 index 00000000000..0511ea6f893 --- /dev/null +++ b/examples/cbh/ha-instance/providers.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + huaweicloud = { + source = "huaweicloud/huaweicloud" + version = ">=1.64.3" + } + } +} + +provider "huaweicloud" { + region = var.region_name + access_key = var.access_key + secret_key = var.secret_key +} diff --git a/examples/cbh/ha-instance/terraform.tfvars b/examples/cbh/ha-instance/terraform.tfvars new file mode 100644 index 00000000000..de343deb8fb --- /dev/null +++ b/examples/cbh/ha-instance/terraform.tfvars @@ -0,0 +1,5 @@ +vpc_name = "tf_test_cbh_ha_vpc" +subnet_name = "tf_test_cbh_ha_subnet" +security_group_name = "tf_test_cbh_ha_sg" +instance_name = "tf_test_cbh_ha_instance" +instance_password = "YourCBHHAInstancePassword!" diff --git a/examples/cbh/ha-instance/variables.tf b/examples/cbh/ha-instance/variables.tf new file mode 100644 index 00000000000..8fc42dfede3 --- /dev/null +++ b/examples/cbh/ha-instance/variables.tf @@ -0,0 +1,108 @@ +# Variable definitions for authentication +variable "region_name" { + description = "The region where the CBH HA instance is located" + type = string +} + +variable "access_key" { + description = "The access key of the IAM user" + type = string +} + +variable "secret_key" { + description = "The secret key of the IAM user" + type = string +} + +# Variable definitions for resources/data sources +variable "master_availability_zone" { + description = "The availability zone name of the master instance" + type = string + default = "" +} + +variable "slave_availability_zone" { + description = "The availability zone name of the slave instance" + type = string + default = "" +} + +variable "instance_flavor_id" { + description = "The flavor ID of the CBH HA instance" + type = string + default = "" +} + +variable "instance_flavor_type" { + description = "The flavor type of the CBH HA instance" + type = string + default = "basic" +} + +variable "vpc_name" { + description = "The name of the VPC" + type = string +} + +variable "vpc_cidr" { + description = "The CIDR block of the VPC" + type = string + default = "192.168.0.0/16" +} + +variable "subnet_name" { + description = "The name of the subnet" + type = string +} + +variable "subnet_cidr" { + description = "The CIDR block of the subnet" + type = string + default = "" +} + +variable "subnet_gateway_ip" { + description = "The gateway IP address of the subnet" + type = string + default = "" +} + +variable "security_group_name" { + description = "The name of the security group" + type = string +} + +variable "instance_name" { + description = "The name of the CBH HA instance" + type = string +} + +variable "instance_password" { + description = "The login password for the CBH HA instance" + type = string + sensitive = true +} + +variable "charging_mode" { + description = "The charging mode of the CBH HA instance" + type = string + default = "prePaid" +} + +variable "period_unit" { + description = "The charging period unit of the CBH HA instance" + type = string + default = "month" +} + +variable "period" { + description = "The charging period of the CBH HA instance" + type = number + default = 1 +} + +variable "auto_renew" { + description = "Whether to enable auto-renew for the CBH HA instance" + type = string + default = "false" +} diff --git a/examples/cbh/ha-instance/varible.tf b/examples/cbh/ha-instance/varible.tf deleted file mode 100644 index a38ddd85fb4..00000000000 --- a/examples/cbh/ha-instance/varible.tf +++ /dev/null @@ -1,36 +0,0 @@ -variable name { - type = string - default = "Cbh_HA_demo" - description = "The name of the CBH(HA) instance." -} - -variable flavor_id { - type = string - default = "cbh.basic.50" - description = "The product ID of the CBH(HA) server." -} - -variable password { - type = string - default = "Cbh@Huawei123" - description = "The password for logging in the management console." - sensitive = true -} - -variable charging_mode { - type = string - default = "prePaid" - description = "The charging mode of the CBH(HA) instance." -} - -variable period_unit { - type = string - default = "month" - description = "The charging period unit of the CBH(HA) instance." -} - -variable period { - type = number - default = 1 - description = "The charging period of the CBH(HA) instance." -}