Provides a AnalyticDB for PostgreSQL (GPDB) DB Instance Plan resource.
For information about AnalyticDB for PostgreSQL (GPDB) DB Instance Plan and how to use it, see What is DB Instance Plan.
Basic Usage
provider "alicloud" {
region = "cn-hangzhou"
}
variable "name" {
default = "tf-example"
}
data "alicloud_gpdb_zones" "default" {
}
data "alicloud_vpcs" "default" {
name_regex = "^default-NODELETING$"
}
data "alicloud_vswitches" "default" {
vpc_id = data.alicloud_vpcs.default.ids.0
zone_id = data.alicloud_gpdb_zones.default.ids.0
}
resource "alicloud_gpdb_instance" "default" {
db_instance_category = "HighAvailability"
db_instance_class = "gpdb.group.segsdx1"
db_instance_mode = "StorageElastic"
description = var.name
engine = "gpdb"
engine_version = "6.0"
zone_id = data.alicloud_gpdb_zones.default.ids.0
instance_network_type = "VPC"
instance_spec = "2C16G"
master_node_num = 1
payment_type = "PayAsYouGo"
private_ip_address = "1.1.1.1"
seg_storage_type = "cloud_essd"
seg_node_num = 4
storage_size = 50
vpc_id = data.alicloud_vpcs.default.ids.0
vswitch_id = data.alicloud_vswitches.default.ids[0]
ip_whitelist {
security_ip_list = "127.0.0.1"
}
}
resource "alicloud_gpdb_db_instance_plan" "default" {
db_instance_plan_name = var.name
plan_desc = var.name
plan_type = "PauseResume"
plan_schedule_type = "Regular"
plan_config {
resume {
plan_cron_time = "0 0 0 1/1 * ? "
}
pause {
plan_cron_time = "0 0 10 1/1 * ? "
}
}
db_instance_id = alicloud_gpdb_instance.default.id
}
The following arguments are supported:
db_instance_id
- (Required, ForceNew) The ID of the GPDB instance.db_instance_plan_name
- (Required) The name of the Plan.plan_type
- (Required, ForceNew) The type of the Plan. Valid values: PauseResume
, Resize
.plan_schedule_type
- (Required, ForceNew) The execution mode of the plan. Valid values: Postpone
, Regular
.plan_start_date
- (Optional) The start time of the Plan.plan_end_date
- (Optional) The end time of the Plan.plan_desc
- (Optional) The description of the Plan.status
- (Optional) The Status of the Plan. Valid values: active
, cancel
.plan_config
- (Required, Set) The execution information of the plan. See plan_config
below.plan_config
The plan_config supports the following:
resume
- (Optional, Set) Resume instance plan config. See resume
below.pause
- (Optional, Set) Pause instance plan config. See pause
below.scale_in
- (Optional, Set) Scale In instance plan config. See scale_in
below.scale_out
- (Optional, Set) Scale out instance plan config. See scale_out
below.plan_config-resume
The resume supports the following:
execute_time
- (Optional) The executed time of the Plan.plan_cron_time
- (Optional) The Cron Time of the plan.plan_config-pause
The pause supports the following:
execute_time
- (Optional) The executed time of the Plan.plan_cron_time
- (Optional) The Cron Time of the plan.plan_config-scale_in
The scale_in supports the following:
segment_node_num
- (Optional) The segment Node Num of the Plan.execute_time
- (Optional) The executed time of the Plan.plan_cron_time
- (Optional) The Cron Time of the plan.plan_config-scale_out
The scale_out supports the following:
segment_node_num
- (Optional) The segment Node Num of the Plan.execute_time
- (Optional) The executed time of the Plan.plan_cron_time
- (Optional) The Cron Time of the plan.The following attributes are exported:
id
- The resource ID in terraform of DB Instance Plan. It formats as <db_instance_id>:<plan_id>
.plan_id
- The ID of the plan.The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 1 mins) Used when create the DB Instance Plan.update
- (Defaults to 1 mins) Used when update the DB Instance Plan.delete
- (Defaults to 1 mins) Used when delete the DB Instance Plan.GPDB DB Instance Plan can be imported using the id, e.g.
$ terraform import alicloud_gpdb_db_instance_plan.example <db_instance_id>:<plan_id>