Scaleway

v1.1.0 published on Saturday, Sep 17, 2022 by lbrlabs

DatabaseReadReplica

Creates and manages Scaleway Database read replicas. For more information, see the documentation.

Examples

Basic

import * as pulumi from "@pulumi/pulumi";
import * as scaleway from "@lbrlabs/pulumi-scaleway";

const instance = new scaleway.DatabaseInstance("instance", {
    nodeType: "db-dev-s",
    engine: "PostgreSQL-14",
    isHaCluster: false,
    disableBackup: true,
    userName: "my_initial_user",
    password: "thiZ_is_v&ry_s3cret",
    tags: [
        "terraform-test",
        "scaleway_rdb_read_replica",
        "minimal",
    ],
});
const replica = new scaleway.DatabaseReadReplica("replica", {
    instanceId: instance.id,
    directAccess: {},
});
import pulumi
import lbrlabs_pulumi_scaleway as scaleway

instance = scaleway.DatabaseInstance("instance",
    node_type="db-dev-s",
    engine="PostgreSQL-14",
    is_ha_cluster=False,
    disable_backup=True,
    user_name="my_initial_user",
    password="thiZ_is_v&ry_s3cret",
    tags=[
        "terraform-test",
        "scaleway_rdb_read_replica",
        "minimal",
    ])
replica = scaleway.DatabaseReadReplica("replica",
    instance_id=instance.id,
    direct_access=scaleway.DatabaseReadReplicaDirectAccessArgs())
using System.Collections.Generic;
using Pulumi;
using Scaleway = Lbrlabs.PulumiPackage.Scaleway;

return await Deployment.RunAsync(() => 
{
    var instance = new Scaleway.DatabaseInstance("instance", new()
    {
        NodeType = "db-dev-s",
        Engine = "PostgreSQL-14",
        IsHaCluster = false,
        DisableBackup = true,
        UserName = "my_initial_user",
        Password = "thiZ_is_v&ry_s3cret",
        Tags = new[]
        {
            "terraform-test",
            "scaleway_rdb_read_replica",
            "minimal",
        },
    });

    var replica = new Scaleway.DatabaseReadReplica("replica", new()
    {
        InstanceId = instance.Id,
        DirectAccess = ,
    });

});
package main

import (
	"github.com/lbrlabs/pulumi-scaleway/sdk/go/scaleway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		instance, err := scaleway.NewDatabaseInstance(ctx, "instance", &scaleway.DatabaseInstanceArgs{
			NodeType:      pulumi.String("db-dev-s"),
			Engine:        pulumi.String("PostgreSQL-14"),
			IsHaCluster:   pulumi.Bool(false),
			DisableBackup: pulumi.Bool(true),
			UserName:      pulumi.String("my_initial_user"),
			Password:      pulumi.String("thiZ_is_v&ry_s3cret"),
			Tags: pulumi.StringArray{
				pulumi.String("terraform-test"),
				pulumi.String("scaleway_rdb_read_replica"),
				pulumi.String("minimal"),
			},
		})
		if err != nil {
			return err
		}
		_, err = scaleway.NewDatabaseReadReplica(ctx, "replica", &scaleway.DatabaseReadReplicaArgs{
			InstanceId:   instance.ID(),
			DirectAccess: nil,
		})
		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.scaleway.DatabaseInstance;
import com.pulumi.scaleway.DatabaseInstanceArgs;
import com.pulumi.scaleway.DatabaseReadReplica;
import com.pulumi.scaleway.DatabaseReadReplicaArgs;
import com.pulumi.scaleway.inputs.DatabaseReadReplicaDirectAccessArgs;
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) {
        var instance = new DatabaseInstance("instance", DatabaseInstanceArgs.builder()        
            .nodeType("db-dev-s")
            .engine("PostgreSQL-14")
            .isHaCluster(false)
            .disableBackup(true)
            .userName("my_initial_user")
            .password("thiZ_is_v&ry_s3cret")
            .tags(            
                "terraform-test",
                "scaleway_rdb_read_replica",
                "minimal")
            .build());

        var replica = new DatabaseReadReplica("replica", DatabaseReadReplicaArgs.builder()        
            .instanceId(instance.id())
            .directAccess()
            .build());

    }
}
resources:
  instance:
    type: scaleway:DatabaseInstance
    properties:
      nodeType: db-dev-s
      engine: PostgreSQL-14
      isHaCluster: false
      disableBackup: true
      userName: my_initial_user
      password: thiZ_is_v&ry_s3cret
      tags:
        - terraform-test
        - scaleway_rdb_read_replica
        - minimal
  replica:
    type: scaleway:DatabaseReadReplica
    properties:
      instanceId: ${instance.id}
      directAccess: {}

Private network

import * as pulumi from "@pulumi/pulumi";
import * as scaleway from "@lbrlabs/pulumi-scaleway";

const instance = new scaleway.DatabaseInstance("instance", {
    nodeType: "db-dev-s",
    engine: "PostgreSQL-14",
    isHaCluster: false,
    disableBackup: true,
    userName: "my_initial_user",
    password: "thiZ_is_v&ry_s3cret",
});
const pn = new scaleway.VpcPrivateNetwork("pn", {});
const replica = new scaleway.DatabaseReadReplica("replica", {
    instanceId: instance.id,
    privateNetwork: {
        privateNetworkId: pn.id,
        serviceIp: "192.168.1.254/24",
    },
});
import pulumi
import lbrlabs_pulumi_scaleway as scaleway

instance = scaleway.DatabaseInstance("instance",
    node_type="db-dev-s",
    engine="PostgreSQL-14",
    is_ha_cluster=False,
    disable_backup=True,
    user_name="my_initial_user",
    password="thiZ_is_v&ry_s3cret")
pn = scaleway.VpcPrivateNetwork("pn")
replica = scaleway.DatabaseReadReplica("replica",
    instance_id=instance.id,
    private_network=scaleway.DatabaseReadReplicaPrivateNetworkArgs(
        private_network_id=pn.id,
        service_ip="192.168.1.254/24",
    ))
using System.Collections.Generic;
using Pulumi;
using Scaleway = Lbrlabs.PulumiPackage.Scaleway;

return await Deployment.RunAsync(() => 
{
    var instance = new Scaleway.DatabaseInstance("instance", new()
    {
        NodeType = "db-dev-s",
        Engine = "PostgreSQL-14",
        IsHaCluster = false,
        DisableBackup = true,
        UserName = "my_initial_user",
        Password = "thiZ_is_v&ry_s3cret",
    });

    var pn = new Scaleway.VpcPrivateNetwork("pn");

    var replica = new Scaleway.DatabaseReadReplica("replica", new()
    {
        InstanceId = instance.Id,
        PrivateNetwork = new Scaleway.Inputs.DatabaseReadReplicaPrivateNetworkArgs
        {
            PrivateNetworkId = pn.Id,
            ServiceIp = "192.168.1.254/24",
        },
    });

});
package main

import (
	"github.com/lbrlabs/pulumi-scaleway/sdk/go/scaleway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		instance, err := scaleway.NewDatabaseInstance(ctx, "instance", &scaleway.DatabaseInstanceArgs{
			NodeType:      pulumi.String("db-dev-s"),
			Engine:        pulumi.String("PostgreSQL-14"),
			IsHaCluster:   pulumi.Bool(false),
			DisableBackup: pulumi.Bool(true),
			UserName:      pulumi.String("my_initial_user"),
			Password:      pulumi.String("thiZ_is_v&ry_s3cret"),
		})
		if err != nil {
			return err
		}
		pn, err := scaleway.NewVpcPrivateNetwork(ctx, "pn", nil)
		if err != nil {
			return err
		}
		_, err = scaleway.NewDatabaseReadReplica(ctx, "replica", &scaleway.DatabaseReadReplicaArgs{
			InstanceId: instance.ID(),
			PrivateNetwork: &DatabaseReadReplicaPrivateNetworkArgs{
				PrivateNetworkId: pn.ID(),
				ServiceIp:        pulumi.String("192.168.1.254/24"),
			},
		})
		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.scaleway.DatabaseInstance;
import com.pulumi.scaleway.DatabaseInstanceArgs;
import com.pulumi.scaleway.VpcPrivateNetwork;
import com.pulumi.scaleway.DatabaseReadReplica;
import com.pulumi.scaleway.DatabaseReadReplicaArgs;
import com.pulumi.scaleway.inputs.DatabaseReadReplicaPrivateNetworkArgs;
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) {
        var instance = new DatabaseInstance("instance", DatabaseInstanceArgs.builder()        
            .nodeType("db-dev-s")
            .engine("PostgreSQL-14")
            .isHaCluster(false)
            .disableBackup(true)
            .userName("my_initial_user")
            .password("thiZ_is_v&ry_s3cret")
            .build());

        var pn = new VpcPrivateNetwork("pn");

        var replica = new DatabaseReadReplica("replica", DatabaseReadReplicaArgs.builder()        
            .instanceId(instance.id())
            .privateNetwork(DatabaseReadReplicaPrivateNetworkArgs.builder()
                .privateNetworkId(pn.id())
                .serviceIp("192.168.1.254/24")
                .build())
            .build());

    }
}
resources:
  instance:
    type: scaleway:DatabaseInstance
    properties:
      nodeType: db-dev-s
      engine: PostgreSQL-14
      isHaCluster: false
      disableBackup: true
      userName: my_initial_user
      password: thiZ_is_v&ry_s3cret
  pn:
    type: scaleway:VpcPrivateNetwork
  replica:
    type: scaleway:DatabaseReadReplica
    properties:
      instanceId: ${instance.id}
      privateNetwork:
        privateNetworkId: ${pn.id}
        serviceIp: 192.168.1.254/24

Create a DatabaseReadReplica Resource

new DatabaseReadReplica(name: string, args: DatabaseReadReplicaArgs, opts?: CustomResourceOptions);
@overload
def DatabaseReadReplica(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        direct_access: Optional[DatabaseReadReplicaDirectAccessArgs] = None,
                        instance_id: Optional[str] = None,
                        private_network: Optional[DatabaseReadReplicaPrivateNetworkArgs] = None,
                        region: Optional[str] = None)
@overload
def DatabaseReadReplica(resource_name: str,
                        args: DatabaseReadReplicaArgs,
                        opts: Optional[ResourceOptions] = None)
func NewDatabaseReadReplica(ctx *Context, name string, args DatabaseReadReplicaArgs, opts ...ResourceOption) (*DatabaseReadReplica, error)
public DatabaseReadReplica(string name, DatabaseReadReplicaArgs args, CustomResourceOptions? opts = null)
public DatabaseReadReplica(String name, DatabaseReadReplicaArgs args)
public DatabaseReadReplica(String name, DatabaseReadReplicaArgs args, CustomResourceOptions options)
type: scaleway:DatabaseReadReplica
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args DatabaseReadReplicaArgs
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 DatabaseReadReplicaArgs
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 DatabaseReadReplicaArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args DatabaseReadReplicaArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args DatabaseReadReplicaArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

DatabaseReadReplica 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 DatabaseReadReplica resource accepts the following input properties:

InstanceId string

Id of the rdb instance to replicate.

DirectAccess Lbrlabs.PulumiPackage.Scaleway.Inputs.DatabaseReadReplicaDirectAccessArgs

Creates a direct access endpoint to rdb replica.

PrivateNetwork Lbrlabs.PulumiPackage.Scaleway.Inputs.DatabaseReadReplicaPrivateNetworkArgs

Create an endpoint in a private network.

Region string

region) The region in which the Database read replica should be created.

InstanceId string

Id of the rdb instance to replicate.

DirectAccess DatabaseReadReplicaDirectAccessArgs

Creates a direct access endpoint to rdb replica.

PrivateNetwork DatabaseReadReplicaPrivateNetworkArgs

Create an endpoint in a private network.

Region string

region) The region in which the Database read replica should be created.

instanceId String

Id of the rdb instance to replicate.

directAccess DatabaseReadReplicaDirectAccessArgs

Creates a direct access endpoint to rdb replica.

privateNetwork DatabaseReadReplicaPrivateNetworkArgs

Create an endpoint in a private network.

region String

region) The region in which the Database read replica should be created.

instanceId string

Id of the rdb instance to replicate.

directAccess DatabaseReadReplicaDirectAccessArgs

Creates a direct access endpoint to rdb replica.

privateNetwork DatabaseReadReplicaPrivateNetworkArgs

Create an endpoint in a private network.

region string

region) The region in which the Database read replica should be created.

instance_id str

Id of the rdb instance to replicate.

direct_access DatabaseReadReplicaDirectAccessArgs

Creates a direct access endpoint to rdb replica.

private_network DatabaseReadReplicaPrivateNetworkArgs

Create an endpoint in a private network.

region str

region) The region in which the Database read replica should be created.

instanceId String

Id of the rdb instance to replicate.

directAccess Property Map

Creates a direct access endpoint to rdb replica.

privateNetwork Property Map

Create an endpoint in a private network.

region String

region) The region in which the Database read replica should be created.

Outputs

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

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up an Existing DatabaseReadReplica Resource

Get an existing DatabaseReadReplica 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?: DatabaseReadReplicaState, opts?: CustomResourceOptions): DatabaseReadReplica
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        direct_access: Optional[DatabaseReadReplicaDirectAccessArgs] = None,
        instance_id: Optional[str] = None,
        private_network: Optional[DatabaseReadReplicaPrivateNetworkArgs] = None,
        region: Optional[str] = None) -> DatabaseReadReplica
func GetDatabaseReadReplica(ctx *Context, name string, id IDInput, state *DatabaseReadReplicaState, opts ...ResourceOption) (*DatabaseReadReplica, error)
public static DatabaseReadReplica Get(string name, Input<string> id, DatabaseReadReplicaState? state, CustomResourceOptions? opts = null)
public static DatabaseReadReplica get(String name, Output<String> id, DatabaseReadReplicaState 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.
The following state arguments are supported:
DirectAccess Lbrlabs.PulumiPackage.Scaleway.Inputs.DatabaseReadReplicaDirectAccessArgs

Creates a direct access endpoint to rdb replica.

InstanceId string

Id of the rdb instance to replicate.

PrivateNetwork Lbrlabs.PulumiPackage.Scaleway.Inputs.DatabaseReadReplicaPrivateNetworkArgs

Create an endpoint in a private network.

Region string

region) The region in which the Database read replica should be created.

DirectAccess DatabaseReadReplicaDirectAccessArgs

Creates a direct access endpoint to rdb replica.

InstanceId string

Id of the rdb instance to replicate.

PrivateNetwork DatabaseReadReplicaPrivateNetworkArgs

Create an endpoint in a private network.

Region string

region) The region in which the Database read replica should be created.

directAccess DatabaseReadReplicaDirectAccessArgs

Creates a direct access endpoint to rdb replica.

instanceId String

Id of the rdb instance to replicate.

privateNetwork DatabaseReadReplicaPrivateNetworkArgs

Create an endpoint in a private network.

region String

region) The region in which the Database read replica should be created.

directAccess DatabaseReadReplicaDirectAccessArgs

Creates a direct access endpoint to rdb replica.

instanceId string

Id of the rdb instance to replicate.

privateNetwork DatabaseReadReplicaPrivateNetworkArgs

Create an endpoint in a private network.

region string

region) The region in which the Database read replica should be created.

direct_access DatabaseReadReplicaDirectAccessArgs

Creates a direct access endpoint to rdb replica.

instance_id str

Id of the rdb instance to replicate.

private_network DatabaseReadReplicaPrivateNetworkArgs

Create an endpoint in a private network.

region str

region) The region in which the Database read replica should be created.

directAccess Property Map

Creates a direct access endpoint to rdb replica.

instanceId String

Id of the rdb instance to replicate.

privateNetwork Property Map

Create an endpoint in a private network.

region String

region) The region in which the Database read replica should be created.

Supporting Types

DatabaseReadReplicaDirectAccess

EndpointId string

The ID of the endpoint of the read replica.

Hostname string

Hostname of the endpoint. Only one of ip and hostname may be set.

Ip string

IPv4 address of the endpoint (IP address). Only one of ip and hostname may be set.

Name string

Name of the endpoint.

Port int

TCP port of the endpoint.

EndpointId string

The ID of the endpoint of the read replica.

Hostname string

Hostname of the endpoint. Only one of ip and hostname may be set.

Ip string

IPv4 address of the endpoint (IP address). Only one of ip and hostname may be set.

Name string

Name of the endpoint.

Port int

TCP port of the endpoint.

endpointId String

The ID of the endpoint of the read replica.

hostname String

Hostname of the endpoint. Only one of ip and hostname may be set.

ip String

IPv4 address of the endpoint (IP address). Only one of ip and hostname may be set.

name String

Name of the endpoint.

port Integer

TCP port of the endpoint.

endpointId string

The ID of the endpoint of the read replica.

hostname string

Hostname of the endpoint. Only one of ip and hostname may be set.

ip string

IPv4 address of the endpoint (IP address). Only one of ip and hostname may be set.

name string

Name of the endpoint.

port number

TCP port of the endpoint.

endpoint_id str

The ID of the endpoint of the read replica.

hostname str

Hostname of the endpoint. Only one of ip and hostname may be set.

ip str

IPv4 address of the endpoint (IP address). Only one of ip and hostname may be set.

name str

Name of the endpoint.

port int

TCP port of the endpoint.

endpointId String

The ID of the endpoint of the read replica.

hostname String

Hostname of the endpoint. Only one of ip and hostname may be set.

ip String

IPv4 address of the endpoint (IP address). Only one of ip and hostname may be set.

name String

Name of the endpoint.

port Number

TCP port of the endpoint.

DatabaseReadReplicaPrivateNetwork

PrivateNetworkId string

UUID of the private network to be connected to the read replica.

ServiceIp string

Endpoint IPv4 address with a CIDR notation. Check documentation about IP and subnet limitations. (IP network).

EndpointId string

The ID of the endpoint of the read replica.

Hostname string

Hostname of the endpoint. Only one of ip and hostname may be set.

Ip string

IPv4 address of the endpoint (IP address). Only one of ip and hostname may be set.

Name string

Name of the endpoint.

Port int

TCP port of the endpoint.

Zone string
PrivateNetworkId string

UUID of the private network to be connected to the read replica.

ServiceIp string

Endpoint IPv4 address with a CIDR notation. Check documentation about IP and subnet limitations. (IP network).

EndpointId string

The ID of the endpoint of the read replica.

Hostname string

Hostname of the endpoint. Only one of ip and hostname may be set.

Ip string

IPv4 address of the endpoint (IP address). Only one of ip and hostname may be set.

Name string

Name of the endpoint.

Port int

TCP port of the endpoint.

Zone string
privateNetworkId String

UUID of the private network to be connected to the read replica.

serviceIp String

Endpoint IPv4 address with a CIDR notation. Check documentation about IP and subnet limitations. (IP network).

endpointId String

The ID of the endpoint of the read replica.

hostname String

Hostname of the endpoint. Only one of ip and hostname may be set.

ip String

IPv4 address of the endpoint (IP address). Only one of ip and hostname may be set.

name String

Name of the endpoint.

port Integer

TCP port of the endpoint.

zone String
privateNetworkId string

UUID of the private network to be connected to the read replica.

serviceIp string

Endpoint IPv4 address with a CIDR notation. Check documentation about IP and subnet limitations. (IP network).

endpointId string

The ID of the endpoint of the read replica.

hostname string

Hostname of the endpoint. Only one of ip and hostname may be set.

ip string

IPv4 address of the endpoint (IP address). Only one of ip and hostname may be set.

name string

Name of the endpoint.

port number

TCP port of the endpoint.

zone string
private_network_id str

UUID of the private network to be connected to the read replica.

service_ip str

Endpoint IPv4 address with a CIDR notation. Check documentation about IP and subnet limitations. (IP network).

endpoint_id str

The ID of the endpoint of the read replica.

hostname str

Hostname of the endpoint. Only one of ip and hostname may be set.

ip str

IPv4 address of the endpoint (IP address). Only one of ip and hostname may be set.

name str

Name of the endpoint.

port int

TCP port of the endpoint.

zone str
privateNetworkId String

UUID of the private network to be connected to the read replica.

serviceIp String

Endpoint IPv4 address with a CIDR notation. Check documentation about IP and subnet limitations. (IP network).

endpointId String

The ID of the endpoint of the read replica.

hostname String

Hostname of the endpoint. Only one of ip and hostname may be set.

ip String

IPv4 address of the endpoint (IP address). Only one of ip and hostname may be set.

name String

Name of the endpoint.

port Number

TCP port of the endpoint.

zone String

Import

Database Read replica can be imported using the {region}/{id}, e.g. bash

 $ pulumi import scaleway:index/databaseReadReplica:DatabaseReadReplica rr fr-par/11111111-1111-1111-1111-111111111111

Package Details

Repository
https://github.com/lbrlabs/pulumi-scaleway
License
Apache-2.0
Notes

This Pulumi package is based on the scaleway Terraform Provider.