alicloud.polardb.GlobalDatabaseNetwork
Provides a PolarDB Global Database Network resource.
For information about PolarDB Global Database Network and how to use it, see What is Global Database Network.
NOTE: Available in v1.181.0+.
Example Usage
Basic Usage
using System.Collections.Generic;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var defaultNetworks = AliCloud.Vpc.GetNetworks.Invoke(new()
{
NameRegex = "default-NODELETING",
});
var defaultSwitches = AliCloud.Vpc.GetSwitches.Invoke(new()
{
VpcId = defaultNetworks.Apply(getNetworksResult => getNetworksResult.Ids[0]),
});
var defaultNodeClasses = AliCloud.PolarDB.GetNodeClasses.Invoke(new()
{
ZoneId = defaultSwitches.Apply(getSwitchesResult => getSwitchesResult.Vswitches[0]?.ZoneId),
PayType = "PostPaid",
DbType = "MySQL",
DbVersion = "8.0",
});
var defaultCluster = new AliCloud.PolarDB.Cluster("defaultCluster", new()
{
DbType = "MySQL",
DbVersion = "8.0",
PayType = "PostPaid",
DbNodeClass = defaultNodeClasses.Apply(getNodeClassesResult => getNodeClassesResult.Classes[0]?.SupportedEngines[0]?.AvailableResources[0]?.DbNodeClass),
VswitchId = defaultSwitches.Apply(getSwitchesResult => getSwitchesResult.Ids[0]),
Description = "example_value",
});
var defaultGlobalDatabaseNetwork = new AliCloud.PolarDB.GlobalDatabaseNetwork("defaultGlobalDatabaseNetwork", new()
{
DbClusterId = defaultCluster.Id,
Description = "example_value",
});
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/polardb"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
defaultNetworks, err := vpc.GetNetworks(ctx, &vpc.GetNetworksArgs{
NameRegex: pulumi.StringRef("default-NODELETING"),
}, nil)
if err != nil {
return err
}
defaultSwitches, err := vpc.GetSwitches(ctx, &vpc.GetSwitchesArgs{
VpcId: pulumi.StringRef(defaultNetworks.Ids[0]),
}, nil)
if err != nil {
return err
}
defaultNodeClasses, err := polardb.GetNodeClasses(ctx, &polardb.GetNodeClassesArgs{
ZoneId: pulumi.StringRef(defaultSwitches.Vswitches[0].ZoneId),
PayType: "PostPaid",
DbType: pulumi.StringRef("MySQL"),
DbVersion: pulumi.StringRef("8.0"),
}, nil)
if err != nil {
return err
}
defaultCluster, err := polardb.NewCluster(ctx, "defaultCluster", &polardb.ClusterArgs{
DbType: pulumi.String("MySQL"),
DbVersion: pulumi.String("8.0"),
PayType: pulumi.String("PostPaid"),
DbNodeClass: *pulumi.String(defaultNodeClasses.Classes[0].SupportedEngines[0].AvailableResources[0].DbNodeClass),
VswitchId: *pulumi.String(defaultSwitches.Ids[0]),
Description: pulumi.String("example_value"),
})
if err != nil {
return err
}
_, err = polardb.NewGlobalDatabaseNetwork(ctx, "defaultGlobalDatabaseNetwork", &polardb.GlobalDatabaseNetworkArgs{
DbClusterId: defaultCluster.ID(),
Description: pulumi.String("example_value"),
})
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.vpc.VpcFunctions;
import com.pulumi.alicloud.vpc.inputs.GetNetworksArgs;
import com.pulumi.alicloud.vpc.inputs.GetSwitchesArgs;
import com.pulumi.alicloud.polardb.PolardbFunctions;
import com.pulumi.alicloud.polardb.inputs.GetNodeClassesArgs;
import com.pulumi.alicloud.polardb.Cluster;
import com.pulumi.alicloud.polardb.ClusterArgs;
import com.pulumi.alicloud.polardb.GlobalDatabaseNetwork;
import com.pulumi.alicloud.polardb.GlobalDatabaseNetworkArgs;
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 defaultNetworks = VpcFunctions.getNetworks(GetNetworksArgs.builder()
.nameRegex("default-NODELETING")
.build());
final var defaultSwitches = VpcFunctions.getSwitches(GetSwitchesArgs.builder()
.vpcId(defaultNetworks.applyValue(getNetworksResult -> getNetworksResult.ids()[0]))
.build());
final var defaultNodeClasses = PolardbFunctions.getNodeClasses(GetNodeClassesArgs.builder()
.zoneId(defaultSwitches.applyValue(getSwitchesResult -> getSwitchesResult.vswitches()[0].zoneId()))
.payType("PostPaid")
.dbType("MySQL")
.dbVersion("8.0")
.build());
var defaultCluster = new Cluster("defaultCluster", ClusterArgs.builder()
.dbType("MySQL")
.dbVersion("8.0")
.payType("PostPaid")
.dbNodeClass(defaultNodeClasses.applyValue(getNodeClassesResult -> getNodeClassesResult.classes()[0].supportedEngines()[0].availableResources()[0].dbNodeClass()))
.vswitchId(defaultSwitches.applyValue(getSwitchesResult -> getSwitchesResult.ids()[0]))
.description("example_value")
.build());
var defaultGlobalDatabaseNetwork = new GlobalDatabaseNetwork("defaultGlobalDatabaseNetwork", GlobalDatabaseNetworkArgs.builder()
.dbClusterId(defaultCluster.id())
.description("example_value")
.build());
}
}
import pulumi
import pulumi_alicloud as alicloud
default_networks = alicloud.vpc.get_networks(name_regex="default-NODELETING")
default_switches = alicloud.vpc.get_switches(vpc_id=default_networks.ids[0])
default_node_classes = alicloud.polardb.get_node_classes(zone_id=default_switches.vswitches[0].zone_id,
pay_type="PostPaid",
db_type="MySQL",
db_version="8.0")
default_cluster = alicloud.polardb.Cluster("defaultCluster",
db_type="MySQL",
db_version="8.0",
pay_type="PostPaid",
db_node_class=default_node_classes.classes[0].supported_engines[0].available_resources[0].db_node_class,
vswitch_id=default_switches.ids[0],
description="example_value")
default_global_database_network = alicloud.polardb.GlobalDatabaseNetwork("defaultGlobalDatabaseNetwork",
db_cluster_id=default_cluster.id,
description="example_value")
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const defaultNetworks = alicloud.vpc.getNetworks({
nameRegex: "default-NODELETING",
});
const defaultSwitches = defaultNetworks.then(defaultNetworks => alicloud.vpc.getSwitches({
vpcId: defaultNetworks.ids?.[0],
}));
const defaultNodeClasses = defaultSwitches.then(defaultSwitches => alicloud.polardb.getNodeClasses({
zoneId: defaultSwitches.vswitches?.[0]?.zoneId,
payType: "PostPaid",
dbType: "MySQL",
dbVersion: "8.0",
}));
const defaultCluster = new alicloud.polardb.Cluster("defaultCluster", {
dbType: "MySQL",
dbVersion: "8.0",
payType: "PostPaid",
dbNodeClass: defaultNodeClasses.then(defaultNodeClasses => defaultNodeClasses.classes?.[0]?.supportedEngines?.[0]?.availableResources?.[0]?.dbNodeClass),
vswitchId: defaultSwitches.then(defaultSwitches => defaultSwitches.ids?.[0]),
description: "example_value",
});
const defaultGlobalDatabaseNetwork = new alicloud.polardb.GlobalDatabaseNetwork("defaultGlobalDatabaseNetwork", {
dbClusterId: defaultCluster.id,
description: "example_value",
});
resources:
defaultCluster:
type: alicloud:polardb:Cluster
properties:
dbType: MySQL
dbVersion: '8.0'
payType: PostPaid
dbNodeClass: ${defaultNodeClasses.classes[0].supportedEngines[0].availableResources[0].dbNodeClass}
vswitchId: ${defaultSwitches.ids[0]}
description: example_value
defaultGlobalDatabaseNetwork:
type: alicloud:polardb:GlobalDatabaseNetwork
properties:
dbClusterId: ${defaultCluster.id}
description: example_value
variables:
defaultNetworks:
fn::invoke:
Function: alicloud:vpc:getNetworks
Arguments:
nameRegex: default-NODELETING
defaultSwitches:
fn::invoke:
Function: alicloud:vpc:getSwitches
Arguments:
vpcId: ${defaultNetworks.ids[0]}
defaultNodeClasses:
fn::invoke:
Function: alicloud:polardb:getNodeClasses
Arguments:
zoneId: ${defaultSwitches.vswitches[0].zoneId}
payType: PostPaid
dbType: MySQL
dbVersion: '8.0'
Create GlobalDatabaseNetwork Resource
new GlobalDatabaseNetwork(name: string, args: GlobalDatabaseNetworkArgs, opts?: CustomResourceOptions);
@overload
def GlobalDatabaseNetwork(resource_name: str,
opts: Optional[ResourceOptions] = None,
db_cluster_id: Optional[str] = None,
description: Optional[str] = None)
@overload
def GlobalDatabaseNetwork(resource_name: str,
args: GlobalDatabaseNetworkArgs,
opts: Optional[ResourceOptions] = None)
func NewGlobalDatabaseNetwork(ctx *Context, name string, args GlobalDatabaseNetworkArgs, opts ...ResourceOption) (*GlobalDatabaseNetwork, error)
public GlobalDatabaseNetwork(string name, GlobalDatabaseNetworkArgs args, CustomResourceOptions? opts = null)
public GlobalDatabaseNetwork(String name, GlobalDatabaseNetworkArgs args)
public GlobalDatabaseNetwork(String name, GlobalDatabaseNetworkArgs args, CustomResourceOptions options)
type: alicloud:polardb:GlobalDatabaseNetwork
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args GlobalDatabaseNetworkArgs
- 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 GlobalDatabaseNetworkArgs
- 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 GlobalDatabaseNetworkArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args GlobalDatabaseNetworkArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args GlobalDatabaseNetworkArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
GlobalDatabaseNetwork 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 GlobalDatabaseNetwork resource accepts the following input properties:
- Db
Cluster stringId The ID of the primary cluster.
- Description string
The description of the Global Database Network.
- Db
Cluster stringId The ID of the primary cluster.
- Description string
The description of the Global Database Network.
- db
Cluster StringId The ID of the primary cluster.
- description String
The description of the Global Database Network.
- db
Cluster stringId The ID of the primary cluster.
- description string
The description of the Global Database Network.
- db_
cluster_ strid The ID of the primary cluster.
- description str
The description of the Global Database Network.
- db
Cluster StringId The ID of the primary cluster.
- description String
The description of the Global Database Network.
Outputs
All input properties are implicitly available as output properties. Additionally, the GlobalDatabaseNetwork resource produces the following output properties:
Look up Existing GlobalDatabaseNetwork Resource
Get an existing GlobalDatabaseNetwork 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?: GlobalDatabaseNetworkState, opts?: CustomResourceOptions): GlobalDatabaseNetwork
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
db_cluster_id: Optional[str] = None,
description: Optional[str] = None,
status: Optional[str] = None) -> GlobalDatabaseNetwork
func GetGlobalDatabaseNetwork(ctx *Context, name string, id IDInput, state *GlobalDatabaseNetworkState, opts ...ResourceOption) (*GlobalDatabaseNetwork, error)
public static GlobalDatabaseNetwork Get(string name, Input<string> id, GlobalDatabaseNetworkState? state, CustomResourceOptions? opts = null)
public static GlobalDatabaseNetwork get(String name, Output<String> id, GlobalDatabaseNetworkState 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
Cluster stringId The ID of the primary cluster.
- Description string
The description of the Global Database Network.
- Status string
The status of the Global Database Network.
- Db
Cluster stringId The ID of the primary cluster.
- Description string
The description of the Global Database Network.
- Status string
The status of the Global Database Network.
- db
Cluster StringId The ID of the primary cluster.
- description String
The description of the Global Database Network.
- status String
The status of the Global Database Network.
- db
Cluster stringId The ID of the primary cluster.
- description string
The description of the Global Database Network.
- status string
The status of the Global Database Network.
- db_
cluster_ strid The ID of the primary cluster.
- description str
The description of the Global Database Network.
- status str
The status of the Global Database Network.
- db
Cluster StringId The ID of the primary cluster.
- description String
The description of the Global Database Network.
- status String
The status of the Global Database Network.
Import
PolarDB Global Database Network can be imported using the id, e.g.
$ pulumi import alicloud:polardb/globalDatabaseNetwork:GlobalDatabaseNetwork example <id>
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
alicloud
Terraform Provider.