alicloud_mongodb_public_network_address
更新时间:
Provides an Alicloud MongoDB public network address resource.
For information about MongoDB public network address and how to use it, see Allocate Public Network Address for MongoDB.
-> NOTE: Available since v1.248.0.
Example Usage
variable "name" {
default = "tf-example"
}
data "alicloud_mongodb_zones" "default" {}
locals {
index = length(data.alicloud_mongodb_zones.default.zones) - 1
zone_id = data.alicloud_mongodb_zones.default.zones[local.index].id
}
resource "alicloud_vpc" "default" {
cidr_block = "10.0.0.0/8"
vpc_name = var.name
}
resource "alicloud_vswitch" "default" {
vpc_id = alicloud_vpc.default.id
zone_id = local.zone_id
cidr_block = "10.0.0.0/24"
}
resource "alicloud_mongodb_instance" "default" {
engine_version = "4.4"
storage_type = "cloud_essd1"
vswitch_id = alicloud_vswitch.default.id
db_instance_storage = "20"
vpc_id = alicloud_vpc.default.id
db_instance_class = "mdb.shard.4x.large.d"
storage_engine = "WiredTiger"
network_type = "VPC"
zone_id = local.zone_id
}
resource "alicloud_mongodb_public_network_address" "default" {
db_instance_id = alicloud_mongodb_instance.default.id
}
Argument Reference
The following arguments are supported:
db_instance_id
- (Required, ForceNew) The instance ID.
Attributes Reference
The following attributes are exported:
id
- The ID of the resource. Equal to thedb_instance_id
.replica_sets
- Replica set instance information.connection_port
- The connection port of the node.replica_set_role
- The role of the node.connection_domain
- The connection address of the node.network_type
- The network type, should be always "Public".role_id
- The id of the role.connection_type
- The connection type.
Import
MongoDB public network address can be imported using the id, e.g.
$ terraform import alicloud_mongodb_public_network_address.example <id>
该文章对您有帮助吗?