Provides a AnalyticDB for PostgreSQL instance resource supports replica set instances only. the AnalyticDB for PostgreSQL provides stable, reliable, and automatic scalable database services. You can see detail product introduction here
Basic Usage
variable "name" {
default = "tf-example"
}
data "alicloud_resource_manager_resource_groups" "default" {
}
data "alicloud_gpdb_zones" "default" {
}
data "alicloud_vpcs" "default" {
# You need to modify name_regex to an existing VPC under your account
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"
payment_type = "PayAsYouGo"
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"
}
}
The following arguments are supported:
engine
- (Required, ForceNew) The database engine used by the instance. Value options can refer to the latest docs CreateDBInstance EngineVersion
.engine_version
- (Required, ForceNew) The version of the database engine used by the instance.vswitch_id
- (Required, ForceNew) The vswitch id.db_instance_class
- (Optional, ForceNew) The db instance class. see Instance specifications.
ip_whitelist
The ip_whitelist supports the following:
ip_group_attribute
- (Optional) The value of this parameter is empty by default. The attribute of the whitelist group.
If the value contains hidden
, this white list item will not output.ip_group_name
- (Optional) IP whitelist group name.security_ip_list
- (Optional) List of IP addresses allowed to access all databases of an instance. The list contains up to 1,000 IP addresses, separated by commas. Supported formats include 0.0.0.0/0, 10.23.12.24 (IP), and 10.23.12.24/24 (Classless Inter-Domain Routing (CIDR) mode. /24 represents the length of the prefix in an IP address. The range of the prefix length is [1,32]). System default to ["127.0.0.1"]
.The following attributes are exported:
id
- The resource ID in terraform of AnalyticDB for PostgreSQL.status
- The status of the instance.connection_string
- (Available since v1.196.0) The connection string of the instance.port
- (Available since v1.196.0) The connection port of the instance.The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 60 mins) Used when create the DB Instance.update
- (Defaults to 60 mins) Used when update the DB Instance.delete
- (Defaults to 10 mins) Used when update the DB Instance.AnalyticDB for PostgreSQL can be imported using the id, e.g.
$ terraform import alicloud_gpdb_instance.example <id>