1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. mongodb
  5. PrivateSrvNetworkAddress
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.mongodb.PrivateSrvNetworkAddress

Explore with Pulumi AI

Provides a Mongo D B Private Srv Network Address resource.

Private network SRV highly available link address.

For information about Mongo D B Private Srv Network Address and how to use it, see What is Private Srv Network Address.

NOTE: Available since v1.240.0.

Example Usage

Basic Usage

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 zoneId = config.get("zoneId") || "cn-shanghai-b";
const regionId = config.get("regionId") || "cn-shanghai";
const defaultie35CW = new alicloud.vpc.Network("defaultie35CW", {
    cidrBlock: "10.0.0.0/8",
    vpcName: name,
});
const defaultg0DCAR = new alicloud.vpc.Switch("defaultg0DCAR", {
    vpcId: defaultie35CW.id,
    zoneId: zoneId,
    cidrBlock: "10.0.0.0/24",
});
const defaultHrZmxC = new alicloud.mongodb.Instance("defaultHrZmxC", {
    engineVersion: "4.4",
    storageType: "cloud_essd1",
    vswitchId: defaultg0DCAR.id,
    dbInstanceStorage: 20,
    vpcId: defaultie35CW.id,
    dbInstanceClass: "mdb.shard.4x.large.d",
    storageEngine: "WiredTiger",
    networkType: "VPC",
    zoneId: zoneId,
});
const _default = new alicloud.mongodb.PrivateSrvNetworkAddress("default", {dbInstanceId: defaultHrZmxC.id});
Copy
import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "terraform-example"
zone_id = config.get("zoneId")
if zone_id is None:
    zone_id = "cn-shanghai-b"
region_id = config.get("regionId")
if region_id is None:
    region_id = "cn-shanghai"
defaultie35_cw = alicloud.vpc.Network("defaultie35CW",
    cidr_block="10.0.0.0/8",
    vpc_name=name)
defaultg0_dcar = alicloud.vpc.Switch("defaultg0DCAR",
    vpc_id=defaultie35_cw.id,
    zone_id=zone_id,
    cidr_block="10.0.0.0/24")
default_hr_zmx_c = alicloud.mongodb.Instance("defaultHrZmxC",
    engine_version="4.4",
    storage_type="cloud_essd1",
    vswitch_id=defaultg0_dcar.id,
    db_instance_storage=20,
    vpc_id=defaultie35_cw.id,
    db_instance_class="mdb.shard.4x.large.d",
    storage_engine="WiredTiger",
    network_type="VPC",
    zone_id=zone_id)
default = alicloud.mongodb.PrivateSrvNetworkAddress("default", db_instance_id=default_hr_zmx_c.id)
Copy
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
		}
		zoneId := "cn-shanghai-b"
		if param := cfg.Get("zoneId"); param != "" {
			zoneId = param
		}
		regionId := "cn-shanghai"
		if param := cfg.Get("regionId"); param != "" {
			regionId = param
		}
		defaultie35CW, err := vpc.NewNetwork(ctx, "defaultie35CW", &vpc.NetworkArgs{
			CidrBlock: pulumi.String("10.0.0.0/8"),
			VpcName:   pulumi.String(name),
		})
		if err != nil {
			return err
		}
		defaultg0DCAR, err := vpc.NewSwitch(ctx, "defaultg0DCAR", &vpc.SwitchArgs{
			VpcId:     defaultie35CW.ID(),
			ZoneId:    pulumi.String(zoneId),
			CidrBlock: pulumi.String("10.0.0.0/24"),
		})
		if err != nil {
			return err
		}
		defaultHrZmxC, err := mongodb.NewInstance(ctx, "defaultHrZmxC", &mongodb.InstanceArgs{
			EngineVersion:     pulumi.String("4.4"),
			StorageType:       pulumi.String("cloud_essd1"),
			VswitchId:         defaultg0DCAR.ID(),
			DbInstanceStorage: pulumi.Int(20),
			VpcId:             defaultie35CW.ID(),
			DbInstanceClass:   pulumi.String("mdb.shard.4x.large.d"),
			StorageEngine:     pulumi.String("WiredTiger"),
			NetworkType:       pulumi.String("VPC"),
			ZoneId:            pulumi.String(zoneId),
		})
		if err != nil {
			return err
		}
		_, err = mongodb.NewPrivateSrvNetworkAddress(ctx, "default", &mongodb.PrivateSrvNetworkAddressArgs{
			DbInstanceId: defaultHrZmxC.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
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 zoneId = config.Get("zoneId") ?? "cn-shanghai-b";
    var regionId = config.Get("regionId") ?? "cn-shanghai";
    var defaultie35CW = new AliCloud.Vpc.Network("defaultie35CW", new()
    {
        CidrBlock = "10.0.0.0/8",
        VpcName = name,
    });

    var defaultg0DCAR = new AliCloud.Vpc.Switch("defaultg0DCAR", new()
    {
        VpcId = defaultie35CW.Id,
        ZoneId = zoneId,
        CidrBlock = "10.0.0.0/24",
    });

    var defaultHrZmxC = new AliCloud.MongoDB.Instance("defaultHrZmxC", new()
    {
        EngineVersion = "4.4",
        StorageType = "cloud_essd1",
        VswitchId = defaultg0DCAR.Id,
        DbInstanceStorage = 20,
        VpcId = defaultie35CW.Id,
        DbInstanceClass = "mdb.shard.4x.large.d",
        StorageEngine = "WiredTiger",
        NetworkType = "VPC",
        ZoneId = zoneId,
    });

    var @default = new AliCloud.MongoDB.PrivateSrvNetworkAddress("default", new()
    {
        DbInstanceId = defaultHrZmxC.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
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.Instance;
import com.pulumi.alicloud.mongodb.InstanceArgs;
import com.pulumi.alicloud.mongodb.PrivateSrvNetworkAddress;
import com.pulumi.alicloud.mongodb.PrivateSrvNetworkAddressArgs;
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 zoneId = config.get("zoneId").orElse("cn-shanghai-b");
        final var regionId = config.get("regionId").orElse("cn-shanghai");
        var defaultie35CW = new Network("defaultie35CW", NetworkArgs.builder()
            .cidrBlock("10.0.0.0/8")
            .vpcName(name)
            .build());

        var defaultg0DCAR = new Switch("defaultg0DCAR", SwitchArgs.builder()
            .vpcId(defaultie35CW.id())
            .zoneId(zoneId)
            .cidrBlock("10.0.0.0/24")
            .build());

        var defaultHrZmxC = new Instance("defaultHrZmxC", InstanceArgs.builder()
            .engineVersion("4.4")
            .storageType("cloud_essd1")
            .vswitchId(defaultg0DCAR.id())
            .dbInstanceStorage("20")
            .vpcId(defaultie35CW.id())
            .dbInstanceClass("mdb.shard.4x.large.d")
            .storageEngine("WiredTiger")
            .networkType("VPC")
            .zoneId(zoneId)
            .build());

        var default_ = new PrivateSrvNetworkAddress("default", PrivateSrvNetworkAddressArgs.builder()
            .dbInstanceId(defaultHrZmxC.id())
            .build());

    }
}
Copy
configuration:
  name:
    type: string
    default: terraform-example
  zoneId:
    type: string
    default: cn-shanghai-b
  regionId:
    type: string
    default: cn-shanghai
resources:
  defaultie35CW:
    type: alicloud:vpc:Network
    properties:
      cidrBlock: 10.0.0.0/8
      vpcName: ${name}
  defaultg0DCAR:
    type: alicloud:vpc:Switch
    properties:
      vpcId: ${defaultie35CW.id}
      zoneId: ${zoneId}
      cidrBlock: 10.0.0.0/24
  defaultHrZmxC:
    type: alicloud:mongodb:Instance
    properties:
      engineVersion: '4.4'
      storageType: cloud_essd1
      vswitchId: ${defaultg0DCAR.id}
      dbInstanceStorage: '20'
      vpcId: ${defaultie35CW.id}
      dbInstanceClass: mdb.shard.4x.large.d
      storageEngine: WiredTiger
      networkType: VPC
      zoneId: ${zoneId}
  default:
    type: alicloud:mongodb:PrivateSrvNetworkAddress
    properties:
      dbInstanceId: ${defaultHrZmxC.id}
Copy

Create PrivateSrvNetworkAddress Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new PrivateSrvNetworkAddress(name: string, args: PrivateSrvNetworkAddressArgs, opts?: CustomResourceOptions);
@overload
def PrivateSrvNetworkAddress(resource_name: str,
                             args: PrivateSrvNetworkAddressArgs,
                             opts: Optional[ResourceOptions] = None)

@overload
def PrivateSrvNetworkAddress(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             db_instance_id: Optional[str] = None)
func NewPrivateSrvNetworkAddress(ctx *Context, name string, args PrivateSrvNetworkAddressArgs, opts ...ResourceOption) (*PrivateSrvNetworkAddress, error)
public PrivateSrvNetworkAddress(string name, PrivateSrvNetworkAddressArgs args, CustomResourceOptions? opts = null)
public PrivateSrvNetworkAddress(String name, PrivateSrvNetworkAddressArgs args)
public PrivateSrvNetworkAddress(String name, PrivateSrvNetworkAddressArgs args, CustomResourceOptions options)
type: alicloud:mongodb:PrivateSrvNetworkAddress
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. PrivateSrvNetworkAddressArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. PrivateSrvNetworkAddressArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. PrivateSrvNetworkAddressArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. PrivateSrvNetworkAddressArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. PrivateSrvNetworkAddressArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var privateSrvNetworkAddressResource = new AliCloud.MongoDB.PrivateSrvNetworkAddress("privateSrvNetworkAddressResource", new()
{
    DbInstanceId = "string",
});
Copy
example, err := mongodb.NewPrivateSrvNetworkAddress(ctx, "privateSrvNetworkAddressResource", &mongodb.PrivateSrvNetworkAddressArgs{
	DbInstanceId: pulumi.String("string"),
})
Copy
var privateSrvNetworkAddressResource = new PrivateSrvNetworkAddress("privateSrvNetworkAddressResource", PrivateSrvNetworkAddressArgs.builder()
    .dbInstanceId("string")
    .build());
Copy
private_srv_network_address_resource = alicloud.mongodb.PrivateSrvNetworkAddress("privateSrvNetworkAddressResource", db_instance_id="string")
Copy
const privateSrvNetworkAddressResource = new alicloud.mongodb.PrivateSrvNetworkAddress("privateSrvNetworkAddressResource", {dbInstanceId: "string"});
Copy
type: alicloud:mongodb:PrivateSrvNetworkAddress
properties:
    dbInstanceId: string
Copy

PrivateSrvNetworkAddress Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The PrivateSrvNetworkAddress resource accepts the following input properties:

DbInstanceId
This property is required.
Changes to this property will trigger replacement.
string
The instance ID.
DbInstanceId
This property is required.
Changes to this property will trigger replacement.
string
The instance ID.
dbInstanceId
This property is required.
Changes to this property will trigger replacement.
String
The instance ID.
dbInstanceId
This property is required.
Changes to this property will trigger replacement.
string
The instance ID.
db_instance_id
This property is required.
Changes to this property will trigger replacement.
str
The instance ID.
dbInstanceId
This property is required.
Changes to this property will trigger replacement.
String
The instance ID.

Outputs

All input properties are implicitly available as output properties. Additionally, the PrivateSrvNetworkAddress resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
PrivateSrvConnectionStringUri string
Private network SRV highly available connection address
Id string
The provider-assigned unique ID for this managed resource.
PrivateSrvConnectionStringUri string
Private network SRV highly available connection address
id String
The provider-assigned unique ID for this managed resource.
privateSrvConnectionStringUri String
Private network SRV highly available connection address
id string
The provider-assigned unique ID for this managed resource.
privateSrvConnectionStringUri string
Private network SRV highly available connection address
id str
The provider-assigned unique ID for this managed resource.
private_srv_connection_string_uri str
Private network SRV highly available connection address
id String
The provider-assigned unique ID for this managed resource.
privateSrvConnectionStringUri String
Private network SRV highly available connection address

Look up Existing PrivateSrvNetworkAddress Resource

Get an existing PrivateSrvNetworkAddress 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?: PrivateSrvNetworkAddressState, opts?: CustomResourceOptions): PrivateSrvNetworkAddress
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        db_instance_id: Optional[str] = None,
        private_srv_connection_string_uri: Optional[str] = None) -> PrivateSrvNetworkAddress
func GetPrivateSrvNetworkAddress(ctx *Context, name string, id IDInput, state *PrivateSrvNetworkAddressState, opts ...ResourceOption) (*PrivateSrvNetworkAddress, error)
public static PrivateSrvNetworkAddress Get(string name, Input<string> id, PrivateSrvNetworkAddressState? state, CustomResourceOptions? opts = null)
public static PrivateSrvNetworkAddress get(String name, Output<String> id, PrivateSrvNetworkAddressState state, CustomResourceOptions options)
resources:  _:    type: alicloud:mongodb:PrivateSrvNetworkAddress    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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.
The following state arguments are supported:
DbInstanceId Changes to this property will trigger replacement. string
The instance ID.
PrivateSrvConnectionStringUri string
Private network SRV highly available connection address
DbInstanceId Changes to this property will trigger replacement. string
The instance ID.
PrivateSrvConnectionStringUri string
Private network SRV highly available connection address
dbInstanceId Changes to this property will trigger replacement. String
The instance ID.
privateSrvConnectionStringUri String
Private network SRV highly available connection address
dbInstanceId Changes to this property will trigger replacement. string
The instance ID.
privateSrvConnectionStringUri string
Private network SRV highly available connection address
db_instance_id Changes to this property will trigger replacement. str
The instance ID.
private_srv_connection_string_uri str
Private network SRV highly available connection address
dbInstanceId Changes to this property will trigger replacement. String
The instance ID.
privateSrvConnectionStringUri String
Private network SRV highly available connection address

Import

Mongo D B Private Srv Network Address can be imported using the id, e.g.

$ pulumi import alicloud:mongodb/privateSrvNetworkAddress:PrivateSrvNetworkAddress example <id>
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.