» alicloud_gpdb_connection

Provides a connection resource to allocate an Internet connection string for instance.

» Example Usage

variable "creation" {
  default = "Gpdb"
}

variable "name" {
  default = "gpdbConnectionBasic"
}

data "alicloud_zones" "default" {
  available_resource_creation = "${var.creation}"
}

resource "alicloud_vpc" "default" {
  name       = "${var.name}"
  cidr_block = "172.16.0.0/16"
}

resource "alicloud_vswitch" "default" {
  vpc_id            = "${alicloud_vpc.default.id}"
  cidr_block        = "172.16.0.0/24"
  availability_zone = "${data.alicloud_zones.default.zones.0.id}"
  name              = "${var.name}"
}

resource "alicloud_gpdb_instance" "default" {
  vswitch_id           = "${alicloud_vswitch.default.id}"
  engine               = "gpdb"
  engine_version       = "4.3"
  instance_class       = "gpdb.group.segsdx2"
  instance_group_count = "2"
  description          = "${var.name}"
}

resource "alicloud_gpdb_connection" "default" {
  instance_id       = "${alicloud_gpdb_instance.default.id}"
  connection_prefix = "testAbc"
}

» Argument Reference

The following arguments are supported:

  • instance_id - (Required, ForceNew) The Id of instance that can run database.
  • connection_prefix - (ForceNew) Prefix of an Internet connection string. It must be checked for uniqueness. It may consist of lowercase letters, numbers, and underlines, and must start with a letter and have no more than 30 characters. Default to + '-tf'.
  • port - (Optional) Internet connection port. Valid value: [3200-3999]. Default to 3306.

» Attributes Reference

The following attributes are exported:

  • id - The current instance connection resource ID. Composed of instance ID and connection string with format <instance_id>:<connection_prefix>.
  • connection_string - Connection instance string.
  • ip_address - The ip address of connection string.

» Import

AnalyticDB for PostgreSQL's connection can be imported using the id, e.g.

$ terraform import alicloud_gpdb_connection.example abc12345678