alicloud.mongodb.ShardingNetworkPublicAddress
Explore with Pulumi AI
Provides a MongoDB Sharding Network Public Address resource.
For information about MongoDB Sharding Network Public Address and how to use it, see What is Sharding Network Public Address.
NOTE: Available since v1.149.0.
NOTE: This operation supports sharded cluster instances only.
Example Usage
Basic Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "terraform-example";
var defaultZones = AliCloud.MongoDB.GetZones.Invoke();
var index = defaultZones.Apply(getZonesResult => getZonesResult.Zones).Length.Apply(length => length - 1);
var zoneId = defaultZones.Apply(getZonesResult => getZonesResult.Zones)[index].Id;
var defaultNetwork = new AliCloud.Vpc.Network("defaultNetwork", new()
{
VpcName = name,
CidrBlock = "172.17.3.0/24",
});
var defaultSwitch = new AliCloud.Vpc.Switch("defaultSwitch", new()
{
VswitchName = name,
CidrBlock = "172.17.3.0/24",
VpcId = defaultNetwork.Id,
ZoneId = zoneId,
});
var defaultShardingInstance = new AliCloud.MongoDB.ShardingInstance("defaultShardingInstance", new()
{
ZoneId = zoneId,
VswitchId = defaultSwitch.Id,
EngineVersion = "4.2",
ShardLists = new[]
{
new AliCloud.MongoDB.Inputs.ShardingInstanceShardListArgs
{
NodeClass = "dds.shard.mid",
NodeStorage = 10,
},
new AliCloud.MongoDB.Inputs.ShardingInstanceShardListArgs
{
NodeClass = "dds.shard.standard",
NodeStorage = 20,
ReadonlyReplicas = 1,
},
},
MongoLists = new[]
{
new AliCloud.MongoDB.Inputs.ShardingInstanceMongoListArgs
{
NodeClass = "dds.mongos.mid",
},
new AliCloud.MongoDB.Inputs.ShardingInstanceMongoListArgs
{
NodeClass = "dds.mongos.mid",
},
},
});
var example = new AliCloud.MongoDB.ShardingNetworkPublicAddress("example", new()
{
DbInstanceId = defaultShardingInstance.Id,
NodeId = defaultShardingInstance.MongoLists.Apply(mongoLists => mongoLists[0].NodeId),
});
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/mongodb"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "terraform-example"
if param := cfg.Get("name"); param != "" {
name = param
}
defaultZones, err := mongodb.GetZones(ctx, nil, nil)
if err != nil {
return err
}
index := len(defaultZones.Zones) - 1
zoneId := defaultZones.Zones[index].Id
defaultNetwork, err := vpc.NewNetwork(ctx, "defaultNetwork", &vpc.NetworkArgs{
VpcName: pulumi.String(name),
CidrBlock: pulumi.String("172.17.3.0/24"),
})
if err != nil {
return err
}
defaultSwitch, err := vpc.NewSwitch(ctx, "defaultSwitch", &vpc.SwitchArgs{
VswitchName: pulumi.String(name),
CidrBlock: pulumi.String("172.17.3.0/24"),
VpcId: defaultNetwork.ID(),
ZoneId: *pulumi.String(zoneId),
})
if err != nil {
return err
}
defaultShardingInstance, err := mongodb.NewShardingInstance(ctx, "defaultShardingInstance", &mongodb.ShardingInstanceArgs{
ZoneId: *pulumi.String(zoneId),
VswitchId: defaultSwitch.ID(),
EngineVersion: pulumi.String("4.2"),
ShardLists: mongodb.ShardingInstanceShardListArray{
&mongodb.ShardingInstanceShardListArgs{
NodeClass: pulumi.String("dds.shard.mid"),
NodeStorage: pulumi.Int(10),
},
&mongodb.ShardingInstanceShardListArgs{
NodeClass: pulumi.String("dds.shard.standard"),
NodeStorage: pulumi.Int(20),
ReadonlyReplicas: pulumi.Int(1),
},
},
MongoLists: mongodb.ShardingInstanceMongoListArray{
&mongodb.ShardingInstanceMongoListArgs{
NodeClass: pulumi.String("dds.mongos.mid"),
},
&mongodb.ShardingInstanceMongoListArgs{
NodeClass: pulumi.String("dds.mongos.mid"),
},
},
})
if err != nil {
return err
}
_, err = mongodb.NewShardingNetworkPublicAddress(ctx, "example", &mongodb.ShardingNetworkPublicAddressArgs{
DbInstanceId: defaultShardingInstance.ID(),
NodeId: defaultShardingInstance.MongoLists.ApplyT(func(mongoLists []mongodb.ShardingInstanceMongoList) (*string, error) {
return &mongoLists[0].NodeId, nil
}).(pulumi.StringPtrOutput),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.mongodb.MongodbFunctions;
import com.pulumi.alicloud.mongodb.inputs.GetZonesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.mongodb.ShardingInstance;
import com.pulumi.alicloud.mongodb.ShardingInstanceArgs;
import com.pulumi.alicloud.mongodb.inputs.ShardingInstanceShardListArgs;
import com.pulumi.alicloud.mongodb.inputs.ShardingInstanceMongoListArgs;
import com.pulumi.alicloud.mongodb.ShardingNetworkPublicAddress;
import com.pulumi.alicloud.mongodb.ShardingNetworkPublicAddressArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var config = ctx.config();
final var name = config.get("name").orElse("terraform-example");
final var defaultZones = MongodbFunctions.getZones();
final var index = defaultZones.applyValue(getZonesResult -> getZonesResult.zones()).length() - 1;
final var zoneId = defaultZones.applyValue(getZonesResult -> getZonesResult.zones())[index].id();
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
.vpcName(name)
.cidrBlock("172.17.3.0/24")
.build());
var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
.vswitchName(name)
.cidrBlock("172.17.3.0/24")
.vpcId(defaultNetwork.id())
.zoneId(zoneId)
.build());
var defaultShardingInstance = new ShardingInstance("defaultShardingInstance", ShardingInstanceArgs.builder()
.zoneId(zoneId)
.vswitchId(defaultSwitch.id())
.engineVersion("4.2")
.shardLists(
ShardingInstanceShardListArgs.builder()
.nodeClass("dds.shard.mid")
.nodeStorage("10")
.build(),
ShardingInstanceShardListArgs.builder()
.nodeClass("dds.shard.standard")
.nodeStorage("20")
.readonlyReplicas("1")
.build())
.mongoLists(
ShardingInstanceMongoListArgs.builder()
.nodeClass("dds.mongos.mid")
.build(),
ShardingInstanceMongoListArgs.builder()
.nodeClass("dds.mongos.mid")
.build())
.build());
var example = new ShardingNetworkPublicAddress("example", ShardingNetworkPublicAddressArgs.builder()
.dbInstanceId(defaultShardingInstance.id())
.nodeId(defaultShardingInstance.mongoLists().applyValue(mongoLists -> mongoLists[0].nodeId()))
.build());
}
}
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
default_zones = alicloud.mongodb.get_zones()
index = len(default_zones.zones) - 1
zone_id = default_zones.zones[index].id
default_network = alicloud.vpc.Network("defaultNetwork",
vpc_name=name,
cidr_block="172.17.3.0/24")
default_switch = alicloud.vpc.Switch("defaultSwitch",
vswitch_name=name,
cidr_block="172.17.3.0/24",
vpc_id=default_network.id,
zone_id=zone_id)
default_sharding_instance = alicloud.mongodb.ShardingInstance("defaultShardingInstance",
zone_id=zone_id,
vswitch_id=default_switch.id,
engine_version="4.2",
shard_lists=[
alicloud.mongodb.ShardingInstanceShardListArgs(
node_class="dds.shard.mid",
node_storage=10,
),
alicloud.mongodb.ShardingInstanceShardListArgs(
node_class="dds.shard.standard",
node_storage=20,
readonly_replicas=1,
),
],
mongo_lists=[
alicloud.mongodb.ShardingInstanceMongoListArgs(
node_class="dds.mongos.mid",
),
alicloud.mongodb.ShardingInstanceMongoListArgs(
node_class="dds.mongos.mid",
),
])
example = alicloud.mongodb.ShardingNetworkPublicAddress("example",
db_instance_id=default_sharding_instance.id,
node_id=default_sharding_instance.mongo_lists[0].node_id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const defaultZones = alicloud.mongodb.getZones({});
const index = defaultZones.then(defaultZones => defaultZones.zones).length.then(length => length - 1);
const zoneId = defaultZones.then(defaultZones => defaultZones.zones[index].id);
const defaultNetwork = new alicloud.vpc.Network("defaultNetwork", {
vpcName: name,
cidrBlock: "172.17.3.0/24",
});
const defaultSwitch = new alicloud.vpc.Switch("defaultSwitch", {
vswitchName: name,
cidrBlock: "172.17.3.0/24",
vpcId: defaultNetwork.id,
zoneId: zoneId,
});
const defaultShardingInstance = new alicloud.mongodb.ShardingInstance("defaultShardingInstance", {
zoneId: zoneId,
vswitchId: defaultSwitch.id,
engineVersion: "4.2",
shardLists: [
{
nodeClass: "dds.shard.mid",
nodeStorage: 10,
},
{
nodeClass: "dds.shard.standard",
nodeStorage: 20,
readonlyReplicas: 1,
},
],
mongoLists: [
{
nodeClass: "dds.mongos.mid",
},
{
nodeClass: "dds.mongos.mid",
},
],
});
const example = new alicloud.mongodb.ShardingNetworkPublicAddress("example", {
dbInstanceId: defaultShardingInstance.id,
nodeId: defaultShardingInstance.mongoLists.apply(mongoLists => mongoLists[0].nodeId),
});
Coming soon!
Create ShardingNetworkPublicAddress Resource
new ShardingNetworkPublicAddress(name: string, args: ShardingNetworkPublicAddressArgs, opts?: CustomResourceOptions);
@overload
def ShardingNetworkPublicAddress(resource_name: str,
opts: Optional[ResourceOptions] = None,
db_instance_id: Optional[str] = None,
node_id: Optional[str] = None)
@overload
def ShardingNetworkPublicAddress(resource_name: str,
args: ShardingNetworkPublicAddressArgs,
opts: Optional[ResourceOptions] = None)
func NewShardingNetworkPublicAddress(ctx *Context, name string, args ShardingNetworkPublicAddressArgs, opts ...ResourceOption) (*ShardingNetworkPublicAddress, error)
public ShardingNetworkPublicAddress(string name, ShardingNetworkPublicAddressArgs args, CustomResourceOptions? opts = null)
public ShardingNetworkPublicAddress(String name, ShardingNetworkPublicAddressArgs args)
public ShardingNetworkPublicAddress(String name, ShardingNetworkPublicAddressArgs args, CustomResourceOptions options)
type: alicloud:mongodb:ShardingNetworkPublicAddress
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ShardingNetworkPublicAddressArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args ShardingNetworkPublicAddressArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ShardingNetworkPublicAddressArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ShardingNetworkPublicAddressArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ShardingNetworkPublicAddressArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
ShardingNetworkPublicAddress Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The ShardingNetworkPublicAddress resource accepts the following input properties:
- Db
Instance stringId The ID of the instance.
- Node
Id string The ID of the
mongos
,shard
, orConfigserver
node in the sharded cluster instance.
- Db
Instance stringId The ID of the instance.
- Node
Id string The ID of the
mongos
,shard
, orConfigserver
node in the sharded cluster instance.
- db
Instance StringId The ID of the instance.
- node
Id String The ID of the
mongos
,shard
, orConfigserver
node in the sharded cluster instance.
- db
Instance stringId The ID of the instance.
- node
Id string The ID of the
mongos
,shard
, orConfigserver
node in the sharded cluster instance.
- db_
instance_ strid The ID of the instance.
- node_
id str The ID of the
mongos
,shard
, orConfigserver
node in the sharded cluster instance.
- db
Instance StringId The ID of the instance.
- node
Id String The ID of the
mongos
,shard
, orConfigserver
node in the sharded cluster instance.
Outputs
All input properties are implicitly available as output properties. Additionally, the ShardingNetworkPublicAddress resource produces the following output properties:
- Id string
The provider-assigned unique ID for this managed resource.
- Network
Addresses List<Pulumi.Ali Cloud. Mongo DB. Outputs. Sharding Network Public Address Network Address> The endpoint of the instance.
- Id string
The provider-assigned unique ID for this managed resource.
- Network
Addresses []ShardingNetwork Public Address Network Address The endpoint of the instance.
- id String
The provider-assigned unique ID for this managed resource.
- network
Addresses List<ShardingNetwork Public Address Network Address> The endpoint of the instance.
- id string
The provider-assigned unique ID for this managed resource.
- network
Addresses ShardingNetwork Public Address Network Address[] The endpoint of the instance.
- id str
The provider-assigned unique ID for this managed resource.
- network_
addresses Sequence[ShardingNetwork Public Address Network Address] The endpoint of the instance.
- id String
The provider-assigned unique ID for this managed resource.
- network
Addresses List<Property Map> The endpoint of the instance.
Look up Existing ShardingNetworkPublicAddress Resource
Get an existing ShardingNetworkPublicAddress resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: ShardingNetworkPublicAddressState, opts?: CustomResourceOptions): ShardingNetworkPublicAddress
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
db_instance_id: Optional[str] = None,
network_addresses: Optional[Sequence[ShardingNetworkPublicAddressNetworkAddressArgs]] = None,
node_id: Optional[str] = None) -> ShardingNetworkPublicAddress
func GetShardingNetworkPublicAddress(ctx *Context, name string, id IDInput, state *ShardingNetworkPublicAddressState, opts ...ResourceOption) (*ShardingNetworkPublicAddress, error)
public static ShardingNetworkPublicAddress Get(string name, Input<string> id, ShardingNetworkPublicAddressState? state, CustomResourceOptions? opts = null)
public static ShardingNetworkPublicAddress get(String name, Output<String> id, ShardingNetworkPublicAddressState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Db
Instance stringId The ID of the instance.
- Network
Addresses List<Pulumi.Ali Cloud. Mongo DB. Inputs. Sharding Network Public Address Network Address> The endpoint of the instance.
- Node
Id string The ID of the
mongos
,shard
, orConfigserver
node in the sharded cluster instance.
- Db
Instance stringId The ID of the instance.
- Network
Addresses []ShardingNetwork Public Address Network Address Args The endpoint of the instance.
- Node
Id string The ID of the
mongos
,shard
, orConfigserver
node in the sharded cluster instance.
- db
Instance StringId The ID of the instance.
- network
Addresses List<ShardingNetwork Public Address Network Address> The endpoint of the instance.
- node
Id String The ID of the
mongos
,shard
, orConfigserver
node in the sharded cluster instance.
- db
Instance stringId The ID of the instance.
- network
Addresses ShardingNetwork Public Address Network Address[] The endpoint of the instance.
- node
Id string The ID of the
mongos
,shard
, orConfigserver
node in the sharded cluster instance.
- db_
instance_ strid The ID of the instance.
- network_
addresses Sequence[ShardingNetwork Public Address Network Address Args] The endpoint of the instance.
- node_
id str The ID of the
mongos
,shard
, orConfigserver
node in the sharded cluster instance.
- db
Instance StringId The ID of the instance.
- network
Addresses List<Property Map> The endpoint of the instance.
- node
Id String The ID of the
mongos
,shard
, orConfigserver
node in the sharded cluster instance.
Supporting Types
ShardingNetworkPublicAddressNetworkAddress, ShardingNetworkPublicAddressNetworkAddressArgs
- Expired
Time string The remaining duration of the classic network address. Unit:
seconds
.- Ip
Address string The IP address of the instance.
- Network
Address string The endpoint of the instance.
- Network
Type string The network type.
- Node
Id string The ID of the
mongos
,shard
, orConfigserver
node in the sharded cluster instance.- Node
Type string The type of the node.
- Port string
The port number.
- Role string
The role of the node.
- Vpc
Id string The ID of the VPC.
- Vswitch
Id string The vSwitch ID of the VPC.
- Expired
Time string The remaining duration of the classic network address. Unit:
seconds
.- Ip
Address string The IP address of the instance.
- Network
Address string The endpoint of the instance.
- Network
Type string The network type.
- Node
Id string The ID of the
mongos
,shard
, orConfigserver
node in the sharded cluster instance.- Node
Type string The type of the node.
- Port string
The port number.
- Role string
The role of the node.
- Vpc
Id string The ID of the VPC.
- Vswitch
Id string The vSwitch ID of the VPC.
- expired
Time String The remaining duration of the classic network address. Unit:
seconds
.- ip
Address String The IP address of the instance.
- network
Address String The endpoint of the instance.
- network
Type String The network type.
- node
Id String The ID of the
mongos
,shard
, orConfigserver
node in the sharded cluster instance.- node
Type String The type of the node.
- port String
The port number.
- role String
The role of the node.
- vpc
Id String The ID of the VPC.
- vswitch
Id String The vSwitch ID of the VPC.
- expired
Time string The remaining duration of the classic network address. Unit:
seconds
.- ip
Address string The IP address of the instance.
- network
Address string The endpoint of the instance.
- network
Type string The network type.
- node
Id string The ID of the
mongos
,shard
, orConfigserver
node in the sharded cluster instance.- node
Type string The type of the node.
- port string
The port number.
- role string
The role of the node.
- vpc
Id string The ID of the VPC.
- vswitch
Id string The vSwitch ID of the VPC.
- expired_
time str The remaining duration of the classic network address. Unit:
seconds
.- ip_
address str The IP address of the instance.
- network_
address str The endpoint of the instance.
- network_
type str The network type.
- node_
id str The ID of the
mongos
,shard
, orConfigserver
node in the sharded cluster instance.- node_
type str The type of the node.
- port str
The port number.
- role str
The role of the node.
- vpc_
id str The ID of the VPC.
- vswitch_
id str The vSwitch ID of the VPC.
- expired
Time String The remaining duration of the classic network address. Unit:
seconds
.- ip
Address String The IP address of the instance.
- network
Address String The endpoint of the instance.
- network
Type String The network type.
- node
Id String The ID of the
mongos
,shard
, orConfigserver
node in the sharded cluster instance.- node
Type String The type of the node.
- port String
The port number.
- role String
The role of the node.
- vpc
Id String The ID of the VPC.
- vswitch
Id String The vSwitch ID of the VPC.
Import
MongoDB Sharding Network Public Address can be imported using the id, e.g.
$ pulumi import alicloud:mongodb/shardingNetworkPublicAddress:ShardingNetworkPublicAddress example <db_instance_id>:<node_id>
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
alicloud
Terraform Provider.