alicloud_gpdb_instance
更新时间:
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
-> NOTE: Available since v1.47.0.
Example Usage
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"
}
}
Argument Reference
The following arguments are supported:
engine
- (Required, ForceNew) The database engine used by the instance. Value options can refer to the latest docs CreateDBInstanceEngineVersion
.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. -> NOTE: This parameter must be passed in to create a storage reservation mode instance.db_instance_category
- (Optional, ForceNew) The db instance category. Valid values:Basic
,HighAvailability
. -> NOTE: This parameter must be passed in to create a storage reservation mode instance.db_instance_mode
- (Required, ForceNew) The db instance mode. Valid values:StorageElastic
,Serverless
,Classic
.instance_spec
- (Optional) The specification of segment nodes.- When
db_instance_category
isHighAvailability
, Valid values:2C16G
,4C32G
,16C128G
. - When
db_instance_category
isBasic
, Valid values:2C8G
,4C16G
,8C32G
,16C64G
. - When
db_instance_category
isServerless
, Valid values:4C16G
,8C32G
. -> NOTE: This parameter must be passed to create a storage elastic mode instance and a serverless version instance.
- When
storage_size
- (Optional, Int) The storage capacity. Unit: GB. Valid values:50
to4000
. -> NOTE: This parameter must be passed in to create a storage reservation mode instance.instance_network_type
- (Optional, ForceNew) The network type of the instance. Valid values:VPC
.vpc_id
- (Optional, ForceNew) The vpc ID of the resource.zone_id
- (Optional, ForceNew) The zone ID of the instance.instance_group_count
- (Optional, ForceNew, Int) The number of nodes. Valid values:2
,4
,8
,12
,16
,24
,32
,64
,96
,128
.payment_type
- (Optional, ForceNew) The billing method of the instance. Valid values:Subscription
,PayAsYouGo
.period
- (Optional) The duration that you will buy the resource, in month. required whenpayment_type
isSubscription
. Valid values:Year
,Month
.resource_group_id
- (Optional) The ID of the enterprise resource group to which the instance belongs.master_cu
- (Optional, Int, Available since v1.213.0) The amount of coordinator node resources. Valid values:2
,4
,8
,16
,32
.seg_node_num
- (Optional, Int) Calculate the number of nodes. Valid values:2
to512
. The value range of the high-availability version of the storage elastic mode is4
to512
, and the value must be a multiple of4
. The value range of the basic version of the storage elastic mode is2
to512
, and the value must be a multiple of2
. The-Serverless version has a value range of2
to512
. The value must be a multiple of2
. -> NOTE: This parameter must be passed in to create a storage elastic mode instance and a Serverless version instance. During the public beta of the Serverless version (from 0101, 2022 to 0131, 2022), a maximum of 12 compute nodes can be created.seg_storage_type
- (Optional) The seg storage type. Valid values:cloud_essd
,cloud_efficiency
. -> NOTE: This parameter must be passed in to create a storage elastic mode instance. Storage Elastic Mode Basic Edition instances only support ESSD cloud disks.create_sample_data
- (Optional, Bool) Whether to load the sample dataset after the instance is created. Valid values:true
,false
.ssl_enabled
- (Optional, Int, Available since v1.188.0) Enable or disable SSL. Valid values:0
and1
.encryption_type
- (Optional, ForceNew, Available since v1.207.2) The encryption type. Valid values:CloudDisk
. -> NOTE: Disk encryption cannot be disabled after it is enabled.encryption_key
- (Optional, ForceNew, Available since v1.207.2) The ID of the encryption key. -> NOTE: Ifencryption_type
is set toCloudDisk
, you must specify an encryption key that resides in the same region as the cloud disk that is specified by EncryptionType. Otherwise, leave this parameter empty.vector_configuration_status
- (Optional, Available since v1.207.2) Specifies whether to enable vector engine optimization. Default value:disabled
. Valid values:enabled
anddisabled
.maintain_start_time
- (Optional) The start time of the maintenance window for the instance. in the format of HH:mmZ (UTC time), for example 02:00Z.maintain_end_time
- (Optional) The end time of the maintenance window for the instance. in the format of HH:mmZ (UTC time), for example 03:00Z. start time should be later than end time.used_time
- (Optional) The used time. When the parameterperiod
isYear
, theused_time
value is1
to3
. When the parameterperiod
isMonth
, theused_time
value is1
to9
.description
- (Optional) The description of the instance.tags
- (Optional) A mapping of tags to assign to the resource.ip_whitelist
- (Optional, Set, Available since v1.187.0) The ip whitelist. Seeip_whitelist
below. Default to creating a whitelist group with the group name "default" and security_ip_list "127.0.0.1".security_ip_list
- (Optional, List, Deprecated since v1.187.0) Fieldsecurity_ip_list
has been deprecated from provider version 1.187.0. New fieldip_whitelist
instead.instance_charge_type
- (Optional, ForceNew, Deprecated since v1.187.0) Fieldinstance_charge_type
has been deprecated from provider version 1.187.0. New fieldpayment_type
instead.availability_zone
- (Optional, ForceNew, Deprecated since v1.187.0) Fieldavailability_zone
has been deprecated from provider version 1.187.0. New fieldzone_id
instead.master_node_num
- (Optional, Int, Deprecated since v1.213.0) The number of Master nodes. NOTE: Fieldmaster_node_num
has been deprecated from provider version 1.213.0.private_ip_address
- (Optional, Deprecated since v1.213.0) The private ip address. NOTE: Fieldprivate_ip_address
has been deprecated from provider version 1.213.0.resource_management_mode
- (Optional, Available since v1.225.0) Resource management mode. Valid values:resourceGroup
,resourceQueue
.parameters
- (Optional, Set, Available since v1.231.0) The parameters. Seeparameters
below.
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 containshidden
, 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"]
.
parameters
The parameters supports the following:
name
- (Required, Available since v1.231.0) The name of the parameter.value
- (Required, Available since v1.231.0) The value of the parameter.
Attributes Reference
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.parameters
- (Available since v1.231.0) A list of parameters. Each element contains the following attributes:default_value
- (Available since v1.231.0) The default value of the parameter.force_restart_instance
- (Available since v1.231.0) Whether to force restart the instance to config the parameter.parameter_description
- (Available since v1.231.0) The description of the parameter.optional_range
- (Available since v1.231.0) The optional range of the parameter.is_changeable_config
- (Available since v1.231.0) Whether the parameter is changeable.
Timeouts
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.
Import
AnalyticDB for PostgreSQL can be imported using the id, e.g.
$ terraform import alicloud_gpdb_instance.example <id>
文档内容是否对您有帮助?