创建一个云数据库实例
CodeSample小助手
2020-01-09
简介:
本文介绍如何使用Terraform创建一个云数据库实例。
操作步骤
- 创建terraform.tf文件,输入以下内容,并保存在当前的执行目录中。
说明 需要为每个Terraform项目创建一个独立的执行目录。
resource "alicloud_db_instance" "instance" {
engine = "MySQL"
engine_version = "5.6"
instance_type = "rds.mysql.t1.small"
instance_storage = "10"
}
- 运行terraform apply开始创建。出现类似下面的日志,说明创建成功。
alicloud_db_instance.instance: Creating...
connection_string: "" => "<computed>"
engine: "" => "MySQL"
engine_version: "" => "5.6"
instance_charge_type: "" => "Postpaid"
instance_storage: "" => "10"
instance_type: "" => "rds.mysql.t1.small"
parameters.#: "" => "<computed>"
port: "" => "<computed>"
security_ips.#: "" => "<computed>"
zone_id: "" => "<computed>"
alicloud_db_instance.instance: Still creating... (10s elapsed)
alicloud_db_instance.instance: Still creating... (20s elapsed)
alicloud_db_instance.instance: Still creating... (30s elapsed)
alicloud_db_instance.instance: Still creating... (40s elapsed)
alicloud_db_instance.instance: Still creating... (50s elapsed)
alicloud_db_instance.instance: Creation complete after 54s (ID: rm-bp146322j394658x4)