Google Cloud (GCP) Classic

Pulumi Official
Package maintained by Pulumi
v6.32.0 published on Wednesday, Jul 20, 2022 by Pulumi

DatabaseInstance

Creates a new Google SQL Database Instance. For more information, see the official documentation, or the JSON API.

NOTE on gcp.sql.DatabaseInstance: - Second-generation instances include a default ‘root’@’%’ user with no password. This user will be deleted by the provider on instance creation. You should use gcp.sql.User to define a custom user with a restricted host and strong password.

Note: On newer versions of the provider, you must explicitly set deletion_protection=false (and run pulumi update to write the field to state) in order to destroy an instance. It is recommended to not set this field (or set it to true) until you’re ready to destroy the instance and its databases.

Example Usage

SQL Second Generation Instance

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
    public MyStack()
    {
        var main = new Gcp.Sql.DatabaseInstance("main", new Gcp.Sql.DatabaseInstanceArgs
        {
            DatabaseVersion = "POSTGRES_14",
            Region = "us-central1",
            Settings = new Gcp.Sql.Inputs.DatabaseInstanceSettingsArgs
            {
                Tier = "db-f1-micro",
            },
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/sql"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := sql.NewDatabaseInstance(ctx, "main", &sql.DatabaseInstanceArgs{
			DatabaseVersion: pulumi.String("POSTGRES_14"),
			Region:          pulumi.String("us-central1"),
			Settings: &sql.DatabaseInstanceSettingsArgs{
				Tier: pulumi.String("db-f1-micro"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var main = new DatabaseInstance("main", DatabaseInstanceArgs.builder()        
            .databaseVersion("POSTGRES_14")
            .region("us-central1")
            .settings(DatabaseInstanceSettingsArgs.builder()
                .tier("db-f1-micro")
                .build())
            .build());

    }
}
import pulumi
import pulumi_gcp as gcp

main = gcp.sql.DatabaseInstance("main",
    database_version="POSTGRES_14",
    region="us-central1",
    settings=gcp.sql.DatabaseInstanceSettingsArgs(
        tier="db-f1-micro",
    ))
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const main = new gcp.sql.DatabaseInstance("main", {
    databaseVersion: "POSTGRES_14",
    region: "us-central1",
    settings: {
        // Second-generation instance tiers are based on the machine
        // type. See argument reference below.
        tier: "db-f1-micro",
    },
});
resources:
  main:
    type: gcp:sql:DatabaseInstance
    properties:
      databaseVersion: POSTGRES_14
      region: us-central1
      settings:
        tier: db-f1-micro

Private IP Instance

using Pulumi;
using Gcp = Pulumi.Gcp;
using Random = Pulumi.Random;

class MyStack : Stack
{
    public MyStack()
    {
        var privateNetwork = new Gcp.Compute.Network("privateNetwork", new Gcp.Compute.NetworkArgs
        {
        }, new CustomResourceOptions
        {
            Provider = google_beta,
        });
        var privateIpAddress = new Gcp.Compute.GlobalAddress("privateIpAddress", new Gcp.Compute.GlobalAddressArgs
        {
            Purpose = "VPC_PEERING",
            AddressType = "INTERNAL",
            PrefixLength = 16,
            Network = privateNetwork.Id,
        }, new CustomResourceOptions
        {
            Provider = google_beta,
        });
        var privateVpcConnection = new Gcp.ServiceNetworking.Connection("privateVpcConnection", new Gcp.ServiceNetworking.ConnectionArgs
        {
            Network = privateNetwork.Id,
            Service = "servicenetworking.googleapis.com",
            ReservedPeeringRanges = 
            {
                privateIpAddress.Name,
            },
        }, new CustomResourceOptions
        {
            Provider = google_beta,
        });
        var dbNameSuffix = new Random.RandomId("dbNameSuffix", new Random.RandomIdArgs
        {
            ByteLength = 4,
        });
        var instance = new Gcp.Sql.DatabaseInstance("instance", new Gcp.Sql.DatabaseInstanceArgs
        {
            Region = "us-central1",
            DatabaseVersion = "MYSQL_5_7",
            Settings = new Gcp.Sql.Inputs.DatabaseInstanceSettingsArgs
            {
                Tier = "db-f1-micro",
                IpConfiguration = new Gcp.Sql.Inputs.DatabaseInstanceSettingsIpConfigurationArgs
                {
                    Ipv4Enabled = false,
                    PrivateNetwork = privateNetwork.Id,
                },
            },
        }, new CustomResourceOptions
        {
            Provider = google_beta,
            DependsOn = 
            {
                privateVpcConnection,
            },
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/compute"
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/servicenetworking"
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/sql"
	"github.com/pulumi/pulumi-random/sdk/v4/go/random"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		privateNetwork, err := compute.NewNetwork(ctx, "privateNetwork", nil, pulumi.Provider(google_beta))
		if err != nil {
			return err
		}
		privateIpAddress, err := compute.NewGlobalAddress(ctx, "privateIpAddress", &compute.GlobalAddressArgs{
			Purpose:      pulumi.String("VPC_PEERING"),
			AddressType:  pulumi.String("INTERNAL"),
			PrefixLength: pulumi.Int(16),
			Network:      privateNetwork.ID(),
		}, pulumi.Provider(google_beta))
		if err != nil {
			return err
		}
		privateVpcConnection, err := servicenetworking.NewConnection(ctx, "privateVpcConnection", &servicenetworking.ConnectionArgs{
			Network: privateNetwork.ID(),
			Service: pulumi.String("servicenetworking.googleapis.com"),
			ReservedPeeringRanges: pulumi.StringArray{
				privateIpAddress.Name,
			},
		}, pulumi.Provider(google_beta))
		if err != nil {
			return err
		}
		_, err = random.NewRandomId(ctx, "dbNameSuffix", &random.RandomIdArgs{
			ByteLength: pulumi.Int(4),
		})
		if err != nil {
			return err
		}
		_, err = sql.NewDatabaseInstance(ctx, "instance", &sql.DatabaseInstanceArgs{
			Region:          pulumi.String("us-central1"),
			DatabaseVersion: pulumi.String("MYSQL_5_7"),
			Settings: &sql.DatabaseInstanceSettingsArgs{
				Tier: pulumi.String("db-f1-micro"),
				IpConfiguration: &sql.DatabaseInstanceSettingsIpConfigurationArgs{
					Ipv4Enabled:    pulumi.Bool(false),
					PrivateNetwork: privateNetwork.ID(),
				},
			},
		}, pulumi.Provider(google_beta), pulumi.DependsOn([]pulumi.Resource{
			privateVpcConnection,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;
import com.pulumi.resources.CustomResourceOptions;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var privateNetwork = new Network("privateNetwork", NetworkArgs.Empty, CustomResourceOptions.builder()
            .provider(google_beta)
            .build());

        var privateIpAddress = new GlobalAddress("privateIpAddress", GlobalAddressArgs.builder()        
            .purpose("VPC_PEERING")
            .addressType("INTERNAL")
            .prefixLength(16)
            .network(privateNetwork.id())
            .build(), CustomResourceOptions.builder()
                .provider(google_beta)
                .build());

        var privateVpcConnection = new Connection("privateVpcConnection", ConnectionArgs.builder()        
            .network(privateNetwork.id())
            .service("servicenetworking.googleapis.com")
            .reservedPeeringRanges(privateIpAddress.name())
            .build(), CustomResourceOptions.builder()
                .provider(google_beta)
                .build());

        var dbNameSuffix = new RandomId("dbNameSuffix", RandomIdArgs.builder()        
            .byteLength(4)
            .build());

        var instance = new DatabaseInstance("instance", DatabaseInstanceArgs.builder()        
            .region("us-central1")
            .databaseVersion("MYSQL_5_7")
            .settings(DatabaseInstanceSettingsArgs.builder()
                .tier("db-f1-micro")
                .ipConfiguration(DatabaseInstanceSettingsIpConfigurationArgs.builder()
                    .ipv4Enabled(false)
                    .privateNetwork(privateNetwork.id())
                    .build())
                .build())
            .build(), CustomResourceOptions.builder()
                .provider(google_beta)
                .dependsOn(privateVpcConnection)
                .build());

    }
}
import pulumi
import pulumi_gcp as gcp
import pulumi_random as random

private_network = gcp.compute.Network("privateNetwork", opts=pulumi.ResourceOptions(provider=google_beta))
private_ip_address = gcp.compute.GlobalAddress("privateIpAddress",
    purpose="VPC_PEERING",
    address_type="INTERNAL",
    prefix_length=16,
    network=private_network.id,
    opts=pulumi.ResourceOptions(provider=google_beta))
private_vpc_connection = gcp.servicenetworking.Connection("privateVpcConnection",
    network=private_network.id,
    service="servicenetworking.googleapis.com",
    reserved_peering_ranges=[private_ip_address.name],
    opts=pulumi.ResourceOptions(provider=google_beta))
db_name_suffix = random.RandomId("dbNameSuffix", byte_length=4)
instance = gcp.sql.DatabaseInstance("instance",
    region="us-central1",
    database_version="MYSQL_5_7",
    settings=gcp.sql.DatabaseInstanceSettingsArgs(
        tier="db-f1-micro",
        ip_configuration=gcp.sql.DatabaseInstanceSettingsIpConfigurationArgs(
            ipv4_enabled=False,
            private_network=private_network.id,
        ),
    ),
    opts=pulumi.ResourceOptions(provider=google_beta,
        depends_on=[private_vpc_connection]))
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
import * as random from "@pulumi/random";

const privateNetwork = new gcp.compute.Network("privateNetwork", {}, {
    provider: google_beta,
});
const privateIpAddress = new gcp.compute.GlobalAddress("privateIpAddress", {
    purpose: "VPC_PEERING",
    addressType: "INTERNAL",
    prefixLength: 16,
    network: privateNetwork.id,
}, {
    provider: google_beta,
});
const privateVpcConnection = new gcp.servicenetworking.Connection("privateVpcConnection", {
    network: privateNetwork.id,
    service: "servicenetworking.googleapis.com",
    reservedPeeringRanges: [privateIpAddress.name],
}, {
    provider: google_beta,
});
const dbNameSuffix = new random.RandomId("dbNameSuffix", {byteLength: 4});
const instance = new gcp.sql.DatabaseInstance("instance", {
    region: "us-central1",
    databaseVersion: "MYSQL_5_7",
    settings: {
        tier: "db-f1-micro",
        ipConfiguration: {
            ipv4Enabled: false,
            privateNetwork: privateNetwork.id,
        },
    },
}, {
    provider: google_beta,
    dependsOn: [privateVpcConnection],
});
resources:
  privateNetwork:
    type: gcp:compute:Network
    options:
      provider: ${["google-beta"]}
  privateIpAddress:
    type: gcp:compute:GlobalAddress
    properties:
      purpose: VPC_PEERING
      addressType: INTERNAL
      prefixLength: 16
      network: ${privateNetwork.id}
    options:
      provider: ${["google-beta"]}
  privateVpcConnection:
    type: gcp:servicenetworking:Connection
    properties:
      network: ${privateNetwork.id}
      service: servicenetworking.googleapis.com
      reservedPeeringRanges:
        - ${privateIpAddress.name}
    options:
      provider: ${["google-beta"]}
  dbNameSuffix:
    type: random:RandomId
    properties:
      byteLength: 4
  instance:
    type: gcp:sql:DatabaseInstance
    properties:
      region: us-central1
      databaseVersion: MYSQL_5_7
      settings:
        tier: db-f1-micro
        ipConfiguration:
          ipv4Enabled: false
          privateNetwork: ${privateNetwork.id}
    options:
      provider: ${["google-beta"]}
      dependson:
        - ${privateVpcConnection}

Create a DatabaseInstance Resource

new DatabaseInstance(name: string, args: DatabaseInstanceArgs, opts?: CustomResourceOptions);
@overload
def DatabaseInstance(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     clone: Optional[DatabaseInstanceCloneArgs] = None,
                     database_version: Optional[str] = None,
                     deletion_protection: Optional[bool] = None,
                     encryption_key_name: Optional[str] = None,
                     master_instance_name: Optional[str] = None,
                     name: Optional[str] = None,
                     project: Optional[str] = None,
                     region: Optional[str] = None,
                     replica_configuration: Optional[DatabaseInstanceReplicaConfigurationArgs] = None,
                     restore_backup_context: Optional[DatabaseInstanceRestoreBackupContextArgs] = None,
                     root_password: Optional[str] = None,
                     settings: Optional[DatabaseInstanceSettingsArgs] = None)
@overload
def DatabaseInstance(resource_name: str,
                     args: DatabaseInstanceArgs,
                     opts: Optional[ResourceOptions] = None)
func NewDatabaseInstance(ctx *Context, name string, args DatabaseInstanceArgs, opts ...ResourceOption) (*DatabaseInstance, error)
public DatabaseInstance(string name, DatabaseInstanceArgs args, CustomResourceOptions? opts = null)
public DatabaseInstance(String name, DatabaseInstanceArgs args)
public DatabaseInstance(String name, DatabaseInstanceArgs args, CustomResourceOptions options)
type: gcp:sql:DatabaseInstance
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

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

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

DatabaseVersion string

The MySQL, PostgreSQL or SQL Server version to use. Supported values include MYSQL_5_6, MYSQL_5_7, MYSQL_8_0, POSTGRES_9_6,POSTGRES_10, POSTGRES_11, POSTGRES_12, POSTGRES_13, POSTGRES_14, SQLSERVER_2017_STANDARD, SQLSERVER_2017_ENTERPRISE, SQLSERVER_2017_EXPRESS, SQLSERVER_2017_WEB. SQLSERVER_2019_STANDARD, SQLSERVER_2019_ENTERPRISE, SQLSERVER_2019_EXPRESS, SQLSERVER_2019_WEB. Database Version Policies includes an up-to-date reference of supported versions.

Clone DatabaseInstanceCloneArgs

The context needed to create this instance as a clone of another instance. When this field is set during resource creation, this provider will attempt to clone another instance as indicated in the context. The configuration is detailed below.

DeletionProtection bool

Whether or not to allow he provider to destroy the instance. Unless this field is set to false in state, a destroy or update command that deletes the instance will fail.

EncryptionKeyName string

The full path to the encryption key used for the CMEK disk encryption. Setting up disk encryption currently requires manual steps outside of this provider. The provided key must be in the same region as the SQL instance. In order to use this feature, a special kind of service account must be created and granted permission on this key. This step can currently only be done manually, please see this step. That service account needs the Cloud KMS > Cloud KMS CryptoKey Encrypter/Decrypter role on your key - please see this step.

MasterInstanceName string

The name of the existing instance that will act as the master in the replication setup. Note, this requires the master to have binary_log_enabled set, as well as existing backups.

Name string

A name for this whitelist entry.

Project string

The full project ID of the source instance.`

Region string

The region the instance will sit in. If a region is not provided in the resource definition, the provider region will be used instead.

ReplicaConfiguration DatabaseInstanceReplicaConfigurationArgs

The configuration for replication. The configuration is detailed below. Valid only for MySQL instances.

RestoreBackupContext DatabaseInstanceRestoreBackupContextArgs

The context needed to restore the database to a backup run. This field will cause the provider to trigger the database to restore from the backup run indicated. The configuration is detailed below. NOTE: Restoring from a backup is an imperative action and not recommended via this provider. Adding or modifying this block during resource creation/update will trigger the restore action after the resource is created/updated.

RootPassword string

Initial root password. Required for MS SQL Server, ignored by MySQL and PostgreSQL.

Settings DatabaseInstanceSettingsArgs

The settings to use for the database. The configuration is detailed below. Required if clone is not set.

DatabaseVersion string

The MySQL, PostgreSQL or SQL Server version to use. Supported values include MYSQL_5_6, MYSQL_5_7, MYSQL_8_0, POSTGRES_9_6,POSTGRES_10, POSTGRES_11, POSTGRES_12, POSTGRES_13, POSTGRES_14, SQLSERVER_2017_STANDARD, SQLSERVER_2017_ENTERPRISE, SQLSERVER_2017_EXPRESS, SQLSERVER_2017_WEB. SQLSERVER_2019_STANDARD, SQLSERVER_2019_ENTERPRISE, SQLSERVER_2019_EXPRESS, SQLSERVER_2019_WEB. Database Version Policies includes an up-to-date reference of supported versions.

Clone DatabaseInstanceCloneArgs

The context needed to create this instance as a clone of another instance. When this field is set during resource creation, this provider will attempt to clone another instance as indicated in the context. The configuration is detailed below.

DeletionProtection bool

Whether or not to allow he provider to destroy the instance. Unless this field is set to false in state, a destroy or update command that deletes the instance will fail.

EncryptionKeyName string

The full path to the encryption key used for the CMEK disk encryption. Setting up disk encryption currently requires manual steps outside of this provider. The provided key must be in the same region as the SQL instance. In order to use this feature, a special kind of service account must be created and granted permission on this key. This step can currently only be done manually, please see this step. That service account needs the Cloud KMS > Cloud KMS CryptoKey Encrypter/Decrypter role on your key - please see this step.

MasterInstanceName string

The name of the existing instance that will act as the master in the replication setup. Note, this requires the master to have binary_log_enabled set, as well as existing backups.

Name string

A name for this whitelist entry.

Project string

The full project ID of the source instance.`

Region string

The region the instance will sit in. If a region is not provided in the resource definition, the provider region will be used instead.

ReplicaConfiguration DatabaseInstanceReplicaConfigurationArgs

The configuration for replication. The configuration is detailed below. Valid only for MySQL instances.

RestoreBackupContext DatabaseInstanceRestoreBackupContextArgs

The context needed to restore the database to a backup run. This field will cause the provider to trigger the database to restore from the backup run indicated. The configuration is detailed below. NOTE: Restoring from a backup is an imperative action and not recommended via this provider. Adding or modifying this block during resource creation/update will trigger the restore action after the resource is created/updated.

RootPassword string

Initial root password. Required for MS SQL Server, ignored by MySQL and PostgreSQL.

Settings DatabaseInstanceSettingsArgs

The settings to use for the database. The configuration is detailed below. Required if clone is not set.

databaseVersion String

The MySQL, PostgreSQL or SQL Server version to use. Supported values include MYSQL_5_6, MYSQL_5_7, MYSQL_8_0, POSTGRES_9_6,POSTGRES_10, POSTGRES_11, POSTGRES_12, POSTGRES_13, POSTGRES_14, SQLSERVER_2017_STANDARD, SQLSERVER_2017_ENTERPRISE, SQLSERVER_2017_EXPRESS, SQLSERVER_2017_WEB. SQLSERVER_2019_STANDARD, SQLSERVER_2019_ENTERPRISE, SQLSERVER_2019_EXPRESS, SQLSERVER_2019_WEB. Database Version Policies includes an up-to-date reference of supported versions.

clone_ DatabaseInstanceCloneArgs

The context needed to create this instance as a clone of another instance. When this field is set during resource creation, this provider will attempt to clone another instance as indicated in the context. The configuration is detailed below.

deletionProtection Boolean

Whether or not to allow he provider to destroy the instance. Unless this field is set to false in state, a destroy or update command that deletes the instance will fail.

encryptionKeyName String

The full path to the encryption key used for the CMEK disk encryption. Setting up disk encryption currently requires manual steps outside of this provider. The provided key must be in the same region as the SQL instance. In order to use this feature, a special kind of service account must be created and granted permission on this key. This step can currently only be done manually, please see this step. That service account needs the Cloud KMS > Cloud KMS CryptoKey Encrypter/Decrypter role on your key - please see this step.

masterInstanceName String

The name of the existing instance that will act as the master in the replication setup. Note, this requires the master to have binary_log_enabled set, as well as existing backups.

name String

A name for this whitelist entry.

project String

The full project ID of the source instance.`

region String

The region the instance will sit in. If a region is not provided in the resource definition, the provider region will be used instead.

replicaConfiguration DatabaseInstanceReplicaConfigurationArgs

The configuration for replication. The configuration is detailed below. Valid only for MySQL instances.

restoreBackupContext DatabaseInstanceRestoreBackupContextArgs

The context needed to restore the database to a backup run. This field will cause the provider to trigger the database to restore from the backup run indicated. The configuration is detailed below. NOTE: Restoring from a backup is an imperative action and not recommended via this provider. Adding or modifying this block during resource creation/update will trigger the restore action after the resource is created/updated.

rootPassword String

Initial root password. Required for MS SQL Server, ignored by MySQL and PostgreSQL.

settings DatabaseInstanceSettingsArgs

The settings to use for the database. The configuration is detailed below. Required if clone is not set.

databaseVersion string

The MySQL, PostgreSQL or SQL Server version to use. Supported values include MYSQL_5_6, MYSQL_5_7, MYSQL_8_0, POSTGRES_9_6,POSTGRES_10, POSTGRES_11, POSTGRES_12, POSTGRES_13, POSTGRES_14, SQLSERVER_2017_STANDARD, SQLSERVER_2017_ENTERPRISE, SQLSERVER_2017_EXPRESS, SQLSERVER_2017_WEB. SQLSERVER_2019_STANDARD, SQLSERVER_2019_ENTERPRISE, SQLSERVER_2019_EXPRESS, SQLSERVER_2019_WEB. Database Version Policies includes an up-to-date reference of supported versions.

clone DatabaseInstanceCloneArgs

The context needed to create this instance as a clone of another instance. When this field is set during resource creation, this provider will attempt to clone another instance as indicated in the context. The configuration is detailed below.

deletionProtection boolean

Whether or not to allow he provider to destroy the instance. Unless this field is set to false in state, a destroy or update command that deletes the instance will fail.

encryptionKeyName string

The full path to the encryption key used for the CMEK disk encryption. Setting up disk encryption currently requires manual steps outside of this provider. The provided key must be in the same region as the SQL instance. In order to use this feature, a special kind of service account must be created and granted permission on this key. This step can currently only be done manually, please see this step. That service account needs the Cloud KMS > Cloud KMS CryptoKey Encrypter/Decrypter role on your key - please see this step.

masterInstanceName string

The name of the existing instance that will act as the master in the replication setup. Note, this requires the master to have binary_log_enabled set, as well as existing backups.

name string

A name for this whitelist entry.

project string

The full project ID of the source instance.`

region string

The region the instance will sit in. If a region is not provided in the resource definition, the provider region will be used instead.

replicaConfiguration DatabaseInstanceReplicaConfigurationArgs

The configuration for replication. The configuration is detailed below. Valid only for MySQL instances.

restoreBackupContext DatabaseInstanceRestoreBackupContextArgs

The context needed to restore the database to a backup run. This field will cause the provider to trigger the database to restore from the backup run indicated. The configuration is detailed below. NOTE: Restoring from a backup is an imperative action and not recommended via this provider. Adding or modifying this block during resource creation/update will trigger the restore action after the resource is created/updated.

rootPassword string

Initial root password. Required for MS SQL Server, ignored by MySQL and PostgreSQL.

settings DatabaseInstanceSettingsArgs

The settings to use for the database. The configuration is detailed below. Required if clone is not set.

database_version str

The MySQL, PostgreSQL or SQL Server version to use. Supported values include MYSQL_5_6, MYSQL_5_7, MYSQL_8_0, POSTGRES_9_6,POSTGRES_10, POSTGRES_11, POSTGRES_12, POSTGRES_13, POSTGRES_14, SQLSERVER_2017_STANDARD, SQLSERVER_2017_ENTERPRISE, SQLSERVER_2017_EXPRESS, SQLSERVER_2017_WEB. SQLSERVER_2019_STANDARD, SQLSERVER_2019_ENTERPRISE, SQLSERVER_2019_EXPRESS, SQLSERVER_2019_WEB. Database Version Policies includes an up-to-date reference of supported versions.

clone DatabaseInstanceCloneArgs

The context needed to create this instance as a clone of another instance. When this field is set during resource creation, this provider will attempt to clone another instance as indicated in the context. The configuration is detailed below.

deletion_protection bool

Whether or not to allow he provider to destroy the instance. Unless this field is set to false in state, a destroy or update command that deletes the instance will fail.

encryption_key_name str

The full path to the encryption key used for the CMEK disk encryption. Setting up disk encryption currently requires manual steps outside of this provider. The provided key must be in the same region as the SQL instance. In order to use this feature, a special kind of service account must be created and granted permission on this key. This step can currently only be done manually, please see this step. That service account needs the Cloud KMS > Cloud KMS CryptoKey Encrypter/Decrypter role on your key - please see this step.

master_instance_name str

The name of the existing instance that will act as the master in the replication setup. Note, this requires the master to have binary_log_enabled set, as well as existing backups.

name str

A name for this whitelist entry.

project str

The full project ID of the source instance.`

region str

The region the instance will sit in. If a region is not provided in the resource definition, the provider region will be used instead.

replica_configuration DatabaseInstanceReplicaConfigurationArgs

The configuration for replication. The configuration is detailed below. Valid only for MySQL instances.

restore_backup_context DatabaseInstanceRestoreBackupContextArgs

The context needed to restore the database to a backup run. This field will cause the provider to trigger the database to restore from the backup run indicated. The configuration is detailed below. NOTE: Restoring from a backup is an imperative action and not recommended via this provider. Adding or modifying this block during resource creation/update will trigger the restore action after the resource is created/updated.

root_password str

Initial root password. Required for MS SQL Server, ignored by MySQL and PostgreSQL.

settings DatabaseInstanceSettingsArgs

The settings to use for the database. The configuration is detailed below. Required if clone is not set.

databaseVersion String

The MySQL, PostgreSQL or SQL Server version to use. Supported values include MYSQL_5_6, MYSQL_5_7, MYSQL_8_0, POSTGRES_9_6,POSTGRES_10, POSTGRES_11, POSTGRES_12, POSTGRES_13, POSTGRES_14, SQLSERVER_2017_STANDARD, SQLSERVER_2017_ENTERPRISE, SQLSERVER_2017_EXPRESS, SQLSERVER_2017_WEB. SQLSERVER_2019_STANDARD, SQLSERVER_2019_ENTERPRISE, SQLSERVER_2019_EXPRESS, SQLSERVER_2019_WEB. Database Version Policies includes an up-to-date reference of supported versions.

clone Property Map

The context needed to create this instance as a clone of another instance. When this field is set during resource creation, this provider will attempt to clone another instance as indicated in the context. The configuration is detailed below.

deletionProtection Boolean

Whether or not to allow he provider to destroy the instance. Unless this field is set to false in state, a destroy or update command that deletes the instance will fail.

encryptionKeyName String

The full path to the encryption key used for the CMEK disk encryption. Setting up disk encryption currently requires manual steps outside of this provider. The provided key must be in the same region as the SQL instance. In order to use this feature, a special kind of service account must be created and granted permission on this key. This step can currently only be done manually, please see this step. That service account needs the Cloud KMS > Cloud KMS CryptoKey Encrypter/Decrypter role on your key - please see this step.

masterInstanceName String

The name of the existing instance that will act as the master in the replication setup. Note, this requires the master to have binary_log_enabled set, as well as existing backups.

name String

A name for this whitelist entry.

project String

The full project ID of the source instance.`

region String

The region the instance will sit in. If a region is not provided in the resource definition, the provider region will be used instead.

replicaConfiguration Property Map

The configuration for replication. The configuration is detailed below. Valid only for MySQL instances.

restoreBackupContext Property Map

The context needed to restore the database to a backup run. This field will cause the provider to trigger the database to restore from the backup run indicated. The configuration is detailed below. NOTE: Restoring from a backup is an imperative action and not recommended via this provider. Adding or modifying this block during resource creation/update will trigger the restore action after the resource is created/updated.

rootPassword String

Initial root password. Required for MS SQL Server, ignored by MySQL and PostgreSQL.

settings Property Map

The settings to use for the database. The configuration is detailed below. Required if clone is not set.

Outputs

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

ConnectionName string

The connection name of the instance to be used in connection strings. For example, when connecting with Cloud SQL Proxy.

FirstIpAddress string

The first IPv4 address of any type assigned.

Id string

The provider-assigned unique ID for this managed resource.

IpAddresses List<DatabaseInstanceIpAddress>
PrivateIpAddress string

The first private (PRIVATE) IPv4 address assigned.

PublicIpAddress string

The first public (PRIMARY) IPv4 address assigned.

SelfLink string

The URI of the created resource.

ServerCaCerts List<DatabaseInstanceServerCaCert>
ServiceAccountEmailAddress string

The service account email address assigned to the instance.

ConnectionName string

The connection name of the instance to be used in connection strings. For example, when connecting with Cloud SQL Proxy.

FirstIpAddress string

The first IPv4 address of any type assigned.

Id string

The provider-assigned unique ID for this managed resource.

IpAddresses []DatabaseInstanceIpAddress
PrivateIpAddress string

The first private (PRIVATE) IPv4 address assigned.

PublicIpAddress string

The first public (PRIMARY) IPv4 address assigned.

SelfLink string

The URI of the created resource.

ServerCaCerts []DatabaseInstanceServerCaCert
ServiceAccountEmailAddress string

The service account email address assigned to the instance.

connectionName String

The connection name of the instance to be used in connection strings. For example, when connecting with Cloud SQL Proxy.

firstIpAddress String

The first IPv4 address of any type assigned.

id String

The provider-assigned unique ID for this managed resource.

ipAddresses List<DatabaseInstanceIpAddress>
privateIpAddress String

The first private (PRIVATE) IPv4 address assigned.

publicIpAddress String

The first public (PRIMARY) IPv4 address assigned.

selfLink String

The URI of the created resource.

serverCaCerts List<DatabaseInstanceServerCaCert>
serviceAccountEmailAddress String

The service account email address assigned to the instance.

connectionName string

The connection name of the instance to be used in connection strings. For example, when connecting with Cloud SQL Proxy.

firstIpAddress string

The first IPv4 address of any type assigned.

id string

The provider-assigned unique ID for this managed resource.

ipAddresses DatabaseInstanceIpAddress[]
privateIpAddress string

The first private (PRIVATE) IPv4 address assigned.

publicIpAddress string

The first public (PRIMARY) IPv4 address assigned.

selfLink string

The URI of the created resource.

serverCaCerts DatabaseInstanceServerCaCert[]
serviceAccountEmailAddress string

The service account email address assigned to the instance.

connection_name str

The connection name of the instance to be used in connection strings. For example, when connecting with Cloud SQL Proxy.

first_ip_address str

The first IPv4 address of any type assigned.

id str

The provider-assigned unique ID for this managed resource.

ip_addresses Sequence[DatabaseInstanceIpAddress]
private_ip_address str

The first private (PRIVATE) IPv4 address assigned.

public_ip_address str

The first public (PRIMARY) IPv4 address assigned.

self_link str

The URI of the created resource.

server_ca_certs Sequence[DatabaseInstanceServerCaCert]
service_account_email_address str

The service account email address assigned to the instance.

connectionName String

The connection name of the instance to be used in connection strings. For example, when connecting with Cloud SQL Proxy.

firstIpAddress String

The first IPv4 address of any type assigned.

id String

The provider-assigned unique ID for this managed resource.

ipAddresses List<Property Map>
privateIpAddress String

The first private (PRIVATE) IPv4 address assigned.

publicIpAddress String

The first public (PRIMARY) IPv4 address assigned.

selfLink String

The URI of the created resource.

serverCaCerts List<Property Map>
serviceAccountEmailAddress String

The service account email address assigned to the instance.

Look up an Existing DatabaseInstance Resource

Get an existing DatabaseInstance 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?: DatabaseInstanceState, opts?: CustomResourceOptions): DatabaseInstance
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        clone: Optional[DatabaseInstanceCloneArgs] = None,
        connection_name: Optional[str] = None,
        database_version: Optional[str] = None,
        deletion_protection: Optional[bool] = None,
        encryption_key_name: Optional[str] = None,
        first_ip_address: Optional[str] = None,
        ip_addresses: Optional[Sequence[DatabaseInstanceIpAddressArgs]] = None,
        master_instance_name: Optional[str] = None,
        name: Optional[str] = None,
        private_ip_address: Optional[str] = None,
        project: Optional[str] = None,
        public_ip_address: Optional[str] = None,
        region: Optional[str] = None,
        replica_configuration: Optional[DatabaseInstanceReplicaConfigurationArgs] = None,
        restore_backup_context: Optional[DatabaseInstanceRestoreBackupContextArgs] = None,
        root_password: Optional[str] = None,
        self_link: Optional[str] = None,
        server_ca_certs: Optional[Sequence[DatabaseInstanceServerCaCertArgs]] = None,
        service_account_email_address: Optional[str] = None,
        settings: Optional[DatabaseInstanceSettingsArgs] = None) -> DatabaseInstance
func GetDatabaseInstance(ctx *Context, name string, id IDInput, state *DatabaseInstanceState, opts ...ResourceOption) (*DatabaseInstance, error)
public static DatabaseInstance Get(string name, Input<string> id, DatabaseInstanceState? state, CustomResourceOptions? opts = null)
public static DatabaseInstance get(String name, Output<String> id, DatabaseInstanceState 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:
Clone DatabaseInstanceCloneArgs

The context needed to create this instance as a clone of another instance. When this field is set during resource creation, this provider will attempt to clone another instance as indicated in the context. The configuration is detailed below.

ConnectionName string

The connection name of the instance to be used in connection strings. For example, when connecting with Cloud SQL Proxy.

DatabaseVersion string

The MySQL, PostgreSQL or SQL Server version to use. Supported values include MYSQL_5_6, MYSQL_5_7, MYSQL_8_0, POSTGRES_9_6,POSTGRES_10, POSTGRES_11, POSTGRES_12, POSTGRES_13, POSTGRES_14, SQLSERVER_2017_STANDARD, SQLSERVER_2017_ENTERPRISE, SQLSERVER_2017_EXPRESS, SQLSERVER_2017_WEB. SQLSERVER_2019_STANDARD, SQLSERVER_2019_ENTERPRISE, SQLSERVER_2019_EXPRESS, SQLSERVER_2019_WEB. Database Version Policies includes an up-to-date reference of supported versions.

DeletionProtection bool

Whether or not to allow he provider to destroy the instance. Unless this field is set to false in state, a destroy or update command that deletes the instance will fail.

EncryptionKeyName string

The full path to the encryption key used for the CMEK disk encryption. Setting up disk encryption currently requires manual steps outside of this provider. The provided key must be in the same region as the SQL instance. In order to use this feature, a special kind of service account must be created and granted permission on this key. This step can currently only be done manually, please see this step. That service account needs the Cloud KMS > Cloud KMS CryptoKey Encrypter/Decrypter role on your key - please see this step.

FirstIpAddress string

The first IPv4 address of any type assigned.

IpAddresses List<DatabaseInstanceIpAddressArgs>
MasterInstanceName string

The name of the existing instance that will act as the master in the replication setup. Note, this requires the master to have binary_log_enabled set, as well as existing backups.

Name string

A name for this whitelist entry.

PrivateIpAddress string

The first private (PRIVATE) IPv4 address assigned.

Project string

The full project ID of the source instance.`

PublicIpAddress string

The first public (PRIMARY) IPv4 address assigned.

Region string

The region the instance will sit in. If a region is not provided in the resource definition, the provider region will be used instead.

ReplicaConfiguration DatabaseInstanceReplicaConfigurationArgs

The configuration for replication. The configuration is detailed below. Valid only for MySQL instances.

RestoreBackupContext DatabaseInstanceRestoreBackupContextArgs

The context needed to restore the database to a backup run. This field will cause the provider to trigger the database to restore from the backup run indicated. The configuration is detailed below. NOTE: Restoring from a backup is an imperative action and not recommended via this provider. Adding or modifying this block during resource creation/update will trigger the restore action after the resource is created/updated.

RootPassword string

Initial root password. Required for MS SQL Server, ignored by MySQL and PostgreSQL.

SelfLink string

The URI of the created resource.

ServerCaCerts List<DatabaseInstanceServerCaCertArgs>
ServiceAccountEmailAddress string

The service account email address assigned to the instance.

Settings DatabaseInstanceSettingsArgs

The settings to use for the database. The configuration is detailed below. Required if clone is not set.

Clone DatabaseInstanceCloneArgs

The context needed to create this instance as a clone of another instance. When this field is set during resource creation, this provider will attempt to clone another instance as indicated in the context. The configuration is detailed below.

ConnectionName string

The connection name of the instance to be used in connection strings. For example, when connecting with Cloud SQL Proxy.

DatabaseVersion string

The MySQL, PostgreSQL or SQL Server version to use. Supported values include MYSQL_5_6, MYSQL_5_7, MYSQL_8_0, POSTGRES_9_6,POSTGRES_10, POSTGRES_11, POSTGRES_12, POSTGRES_13, POSTGRES_14, SQLSERVER_2017_STANDARD, SQLSERVER_2017_ENTERPRISE, SQLSERVER_2017_EXPRESS, SQLSERVER_2017_WEB. SQLSERVER_2019_STANDARD, SQLSERVER_2019_ENTERPRISE, SQLSERVER_2019_EXPRESS, SQLSERVER_2019_WEB. Database Version Policies includes an up-to-date reference of supported versions.

DeletionProtection bool

Whether or not to allow he provider to destroy the instance. Unless this field is set to false in state, a destroy or update command that deletes the instance will fail.

EncryptionKeyName string

The full path to the encryption key used for the CMEK disk encryption. Setting up disk encryption currently requires manual steps outside of this provider. The provided key must be in the same region as the SQL instance. In order to use this feature, a special kind of service account must be created and granted permission on this key. This step can currently only be done manually, please see this step. That service account needs the Cloud KMS > Cloud KMS CryptoKey Encrypter/Decrypter role on your key - please see this step.

FirstIpAddress string

The first IPv4 address of any type assigned.

IpAddresses []DatabaseInstanceIpAddressArgs
MasterInstanceName string

The name of the existing instance that will act as the master in the replication setup. Note, this requires the master to have binary_log_enabled set, as well as existing backups.

Name string

A name for this whitelist entry.

PrivateIpAddress string

The first private (PRIVATE) IPv4 address assigned.

Project string

The full project ID of the source instance.`

PublicIpAddress string

The first public (PRIMARY) IPv4 address assigned.

Region string

The region the instance will sit in. If a region is not provided in the resource definition, the provider region will be used instead.

ReplicaConfiguration DatabaseInstanceReplicaConfigurationArgs

The configuration for replication. The configuration is detailed below. Valid only for MySQL instances.

RestoreBackupContext DatabaseInstanceRestoreBackupContextArgs

The context needed to restore the database to a backup run. This field will cause the provider to trigger the database to restore from the backup run indicated. The configuration is detailed below. NOTE: Restoring from a backup is an imperative action and not recommended via this provider. Adding or modifying this block during resource creation/update will trigger the restore action after the resource is created/updated.

RootPassword string

Initial root password. Required for MS SQL Server, ignored by MySQL and PostgreSQL.

SelfLink string

The URI of the created resource.

ServerCaCerts []DatabaseInstanceServerCaCertArgs
ServiceAccountEmailAddress string

The service account email address assigned to the instance.

Settings DatabaseInstanceSettingsArgs

The settings to use for the database. The configuration is detailed below. Required if clone is not set.

clone_ DatabaseInstanceCloneArgs

The context needed to create this instance as a clone of another instance. When this field is set during resource creation, this provider will attempt to clone another instance as indicated in the context. The configuration is detailed below.

connectionName String

The connection name of the instance to be used in connection strings. For example, when connecting with Cloud SQL Proxy.

databaseVersion String

The MySQL, PostgreSQL or SQL Server version to use. Supported values include MYSQL_5_6, MYSQL_5_7, MYSQL_8_0, POSTGRES_9_6,POSTGRES_10, POSTGRES_11, POSTGRES_12, POSTGRES_13, POSTGRES_14, SQLSERVER_2017_STANDARD, SQLSERVER_2017_ENTERPRISE, SQLSERVER_2017_EXPRESS, SQLSERVER_2017_WEB. SQLSERVER_2019_STANDARD, SQLSERVER_2019_ENTERPRISE, SQLSERVER_2019_EXPRESS, SQLSERVER_2019_WEB. Database Version Policies includes an up-to-date reference of supported versions.

deletionProtection Boolean

Whether or not to allow he provider to destroy the instance. Unless this field is set to false in state, a destroy or update command that deletes the instance will fail.

encryptionKeyName String

The full path to the encryption key used for the CMEK disk encryption. Setting up disk encryption currently requires manual steps outside of this provider. The provided key must be in the same region as the SQL instance. In order to use this feature, a special kind of service account must be created and granted permission on this key. This step can currently only be done manually, please see this step. That service account needs the Cloud KMS > Cloud KMS CryptoKey Encrypter/Decrypter role on your key - please see this step.

firstIpAddress String

The first IPv4 address of any type assigned.

ipAddresses List<DatabaseInstanceIpAddressArgs>
masterInstanceName String

The name of the existing instance that will act as the master in the replication setup. Note, this requires the master to have binary_log_enabled set, as well as existing backups.

name String

A name for this whitelist entry.

privateIpAddress String

The first private (PRIVATE) IPv4 address assigned.

project String

The full project ID of the source instance.`

publicIpAddress String

The first public (PRIMARY) IPv4 address assigned.

region String

The region the instance will sit in. If a region is not provided in the resource definition, the provider region will be used instead.

replicaConfiguration DatabaseInstanceReplicaConfigurationArgs

The configuration for replication. The configuration is detailed below. Valid only for MySQL instances.

restoreBackupContext DatabaseInstanceRestoreBackupContextArgs

The context needed to restore the database to a backup run. This field will cause the provider to trigger the database to restore from the backup run indicated. The configuration is detailed below. NOTE: Restoring from a backup is an imperative action and not recommended via this provider. Adding or modifying this block during resource creation/update will trigger the restore action after the resource is created/updated.

rootPassword String

Initial root password. Required for MS SQL Server, ignored by MySQL and PostgreSQL.

selfLink String

The URI of the created resource.

serverCaCerts List<DatabaseInstanceServerCaCertArgs>
serviceAccountEmailAddress String

The service account email address assigned to the instance.

settings DatabaseInstanceSettingsArgs

The settings to use for the database. The configuration is detailed below. Required if clone is not set.

clone DatabaseInstanceCloneArgs

The context needed to create this instance as a clone of another instance. When this field is set during resource creation, this provider will attempt to clone another instance as indicated in the context. The configuration is detailed below.

connectionName string

The connection name of the instance to be used in connection strings. For example, when connecting with Cloud SQL Proxy.

databaseVersion string

The MySQL, PostgreSQL or SQL Server version to use. Supported values include MYSQL_5_6, MYSQL_5_7, MYSQL_8_0, POSTGRES_9_6,POSTGRES_10, POSTGRES_11, POSTGRES_12, POSTGRES_13, POSTGRES_14, SQLSERVER_2017_STANDARD, SQLSERVER_2017_ENTERPRISE, SQLSERVER_2017_EXPRESS, SQLSERVER_2017_WEB. SQLSERVER_2019_STANDARD, SQLSERVER_2019_ENTERPRISE, SQLSERVER_2019_EXPRESS, SQLSERVER_2019_WEB. Database Version Policies includes an up-to-date reference of supported versions.

deletionProtection boolean

Whether or not to allow he provider to destroy the instance. Unless this field is set to false in state, a destroy or update command that deletes the instance will fail.

encryptionKeyName string

The full path to the encryption key used for the CMEK disk encryption. Setting up disk encryption currently requires manual steps outside of this provider. The provided key must be in the same region as the SQL instance. In order to use this feature, a special kind of service account must be created and granted permission on this key. This step can currently only be done manually, please see this step. That service account needs the Cloud KMS > Cloud KMS CryptoKey Encrypter/Decrypter role on your key - please see this step.

firstIpAddress string

The first IPv4 address of any type assigned.

ipAddresses DatabaseInstanceIpAddressArgs[]
masterInstanceName string

The name of the existing instance that will act as the master in the replication setup. Note, this requires the master to have binary_log_enabled set, as well as existing backups.

name string

A name for this whitelist entry.

privateIpAddress string

The first private (PRIVATE) IPv4 address assigned.

project string

The full project ID of the source instance.`

publicIpAddress string

The first public (PRIMARY) IPv4 address assigned.

region string

The region the instance will sit in. If a region is not provided in the resource definition, the provider region will be used instead.

replicaConfiguration DatabaseInstanceReplicaConfigurationArgs

The configuration for replication. The configuration is detailed below. Valid only for MySQL instances.

restoreBackupContext DatabaseInstanceRestoreBackupContextArgs

The context needed to restore the database to a backup run. This field will cause the provider to trigger the database to restore from the backup run indicated. The configuration is detailed below. NOTE: Restoring from a backup is an imperative action and not recommended via this provider. Adding or modifying this block during resource creation/update will trigger the restore action after the resource is created/updated.

rootPassword string

Initial root password. Required for MS SQL Server, ignored by MySQL and PostgreSQL.

selfLink string

The URI of the created resource.

serverCaCerts DatabaseInstanceServerCaCertArgs[]
serviceAccountEmailAddress string

The service account email address assigned to the instance.

settings DatabaseInstanceSettingsArgs

The settings to use for the database. The configuration is detailed below. Required if clone is not set.

clone DatabaseInstanceCloneArgs

The context needed to create this instance as a clone of another instance. When this field is set during resource creation, this provider will attempt to clone another instance as indicated in the context. The configuration is detailed below.

connection_name str

The connection name of the instance to be used in connection strings. For example, when connecting with Cloud SQL Proxy.

database_version str

The MySQL, PostgreSQL or SQL Server version to use. Supported values include MYSQL_5_6, MYSQL_5_7, MYSQL_8_0, POSTGRES_9_6,POSTGRES_10, POSTGRES_11, POSTGRES_12, POSTGRES_13, POSTGRES_14, SQLSERVER_2017_STANDARD, SQLSERVER_2017_ENTERPRISE, SQLSERVER_2017_EXPRESS, SQLSERVER_2017_WEB. SQLSERVER_2019_STANDARD, SQLSERVER_2019_ENTERPRISE, SQLSERVER_2019_EXPRESS, SQLSERVER_2019_WEB. Database Version Policies includes an up-to-date reference of supported versions.

deletion_protection bool

Whether or not to allow he provider to destroy the instance. Unless this field is set to false in state, a destroy or update command that deletes the instance will fail.

encryption_key_name str

The full path to the encryption key used for the CMEK disk encryption. Setting up disk encryption currently requires manual steps outside of this provider. The provided key must be in the same region as the SQL instance. In order to use this feature, a special kind of service account must be created and granted permission on this key. This step can currently only be done manually, please see this step. That service account needs the Cloud KMS > Cloud KMS CryptoKey Encrypter/Decrypter role on your key - please see this step.

first_ip_address str

The first IPv4 address of any type assigned.

ip_addresses Sequence[DatabaseInstanceIpAddressArgs]
master_instance_name str

The name of the existing instance that will act as the master in the replication setup. Note, this requires the master to have binary_log_enabled set, as well as existing backups.

name str

A name for this whitelist entry.

private_ip_address str

The first private (PRIVATE) IPv4 address assigned.

project str

The full project ID of the source instance.`

public_ip_address str

The first public (PRIMARY) IPv4 address assigned.

region str

The region the instance will sit in. If a region is not provided in the resource definition, the provider region will be used instead.

replica_configuration DatabaseInstanceReplicaConfigurationArgs

The configuration for replication. The configuration is detailed below. Valid only for MySQL instances.

restore_backup_context DatabaseInstanceRestoreBackupContextArgs

The context needed to restore the database to a backup run. This field will cause the provider to trigger the database to restore from the backup run indicated. The configuration is detailed below. NOTE: Restoring from a backup is an imperative action and not recommended via this provider. Adding or modifying this block during resource creation/update will trigger the restore action after the resource is created/updated.

root_password str

Initial root password. Required for MS SQL Server, ignored by MySQL and PostgreSQL.

self_link str

The URI of the created resource.

server_ca_certs Sequence[DatabaseInstanceServerCaCertArgs]
service_account_email_address str

The service account email address assigned to the instance.

settings DatabaseInstanceSettingsArgs

The settings to use for the database. The configuration is detailed below. Required if clone is not set.

clone Property Map

The context needed to create this instance as a clone of another instance. When this field is set during resource creation, this provider will attempt to clone another instance as indicated in the context. The configuration is detailed below.

connectionName String

The connection name of the instance to be used in connection strings. For example, when connecting with Cloud SQL Proxy.

databaseVersion String

The MySQL, PostgreSQL or SQL Server version to use. Supported values include MYSQL_5_6, MYSQL_5_7, MYSQL_8_0, POSTGRES_9_6,POSTGRES_10, POSTGRES_11, POSTGRES_12, POSTGRES_13, POSTGRES_14, SQLSERVER_2017_STANDARD, SQLSERVER_2017_ENTERPRISE, SQLSERVER_2017_EXPRESS, SQLSERVER_2017_WEB. SQLSERVER_2019_STANDARD, SQLSERVER_2019_ENTERPRISE, SQLSERVER_2019_EXPRESS, SQLSERVER_2019_WEB. Database Version Policies includes an up-to-date reference of supported versions.

deletionProtection Boolean

Whether or not to allow he provider to destroy the instance. Unless this field is set to false in state, a destroy or update command that deletes the instance will fail.

encryptionKeyName String

The full path to the encryption key used for the CMEK disk encryption. Setting up disk encryption currently requires manual steps outside of this provider. The provided key must be in the same region as the SQL instance. In order to use this feature, a special kind of service account must be created and granted permission on this key. This step can currently only be done manually, please see this step. That service account needs the Cloud KMS > Cloud KMS CryptoKey Encrypter/Decrypter role on your key - please see this step.

firstIpAddress String

The first IPv4 address of any type assigned.

ipAddresses List<Property Map>
masterInstanceName String

The name of the existing instance that will act as the master in the replication setup. Note, this requires the master to have binary_log_enabled set, as well as existing backups.

name String

A name for this whitelist entry.

privateIpAddress String

The first private (PRIVATE) IPv4 address assigned.

project String

The full project ID of the source instance.`

publicIpAddress String

The first public (PRIMARY) IPv4 address assigned.

region String

The region the instance will sit in. If a region is not provided in the resource definition, the provider region will be used instead.

replicaConfiguration Property Map

The configuration for replication. The configuration is detailed below. Valid only for MySQL instances.

restoreBackupContext Property Map

The context needed to restore the database to a backup run. This field will cause the provider to trigger the database to restore from the backup run indicated. The configuration is detailed below. NOTE: Restoring from a backup is an imperative action and not recommended via this provider. Adding or modifying this block during resource creation/update will trigger the restore action after the resource is created/updated.

rootPassword String

Initial root password. Required for MS SQL Server, ignored by MySQL and PostgreSQL.

selfLink String

The URI of the created resource.

serverCaCerts List<Property Map>
serviceAccountEmailAddress String

The service account email address assigned to the instance.

settings Property Map

The settings to use for the database. The configuration is detailed below. Required if clone is not set.

Supporting Types

DatabaseInstanceClone

SourceInstanceName string

Name of the source instance which will be cloned.

AllocatedIpRange string

The name of the allocated ip range for the private ip CloudSQL instance. For example: "google-managed-services-default". If set, the cloned instance ip will be created in the allocated range. The range name must comply with RFC 1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z?.

PointInTime string

The timestamp of the point in time that should be restored.

SourceInstanceName string

Name of the source instance which will be cloned.

AllocatedIpRange string

The name of the allocated ip range for the private ip CloudSQL instance. For example: "google-managed-services-default". If set, the cloned instance ip will be created in the allocated range. The range name must comply with RFC 1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z?.

PointInTime string

The timestamp of the point in time that should be restored.

sourceInstanceName String

Name of the source instance which will be cloned.

allocatedIpRange String

The name of the allocated ip range for the private ip CloudSQL instance. For example: "google-managed-services-default". If set, the cloned instance ip will be created in the allocated range. The range name must comply with RFC 1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z?.

pointInTime String

The timestamp of the point in time that should be restored.

sourceInstanceName string

Name of the source instance which will be cloned.

allocatedIpRange string

The name of the allocated ip range for the private ip CloudSQL instance. For example: "google-managed-services-default". If set, the cloned instance ip will be created in the allocated range. The range name must comply with RFC 1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z?.

pointInTime string

The timestamp of the point in time that should be restored.

source_instance_name str

Name of the source instance which will be cloned.

allocated_ip_range str

The name of the allocated ip range for the private ip CloudSQL instance. For example: "google-managed-services-default". If set, the cloned instance ip will be created in the allocated range. The range name must comply with RFC 1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z?.

point_in_time str

The timestamp of the point in time that should be restored.

sourceInstanceName String

Name of the source instance which will be cloned.

allocatedIpRange String

The name of the allocated ip range for the private ip CloudSQL instance. For example: "google-managed-services-default". If set, the cloned instance ip will be created in the allocated range. The range name must comply with RFC 1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z?.

pointInTime String

The timestamp of the point in time that should be restored.

DatabaseInstanceIpAddress

IpAddress string
TimeToRetire string
Type string
IpAddress string
TimeToRetire string
Type string
ipAddress String
timeToRetire String
type String
ipAddress string
timeToRetire string
type string
ipAddress String
timeToRetire String
type String

DatabaseInstanceReplicaConfiguration

CaCertificate string

PEM representation of the trusted CA's x509 certificate.

ClientCertificate string

PEM representation of the replica's x509 certificate.

ClientKey string

PEM representation of the replica's private key. The corresponding public key in encoded in the client_certificate.

ConnectRetryInterval int

The number of seconds between connect retries.

DumpFilePath string

Path to a SQL file in GCS from which replica instances are created. Format is gs://bucket/filename.

FailoverTarget bool

Specifies if the replica is the failover target. If the field is set to true the replica will be designated as a failover replica. If the master instance fails, the replica instance will be promoted as the new master instance.

MasterHeartbeatPeriod int

Time in ms between replication heartbeats.

Password string

Password for the replication connection.

SslCipher string
Username string

Username for replication connection.

VerifyServerCertificate bool

True if the master's common name value is checked during the SSL handshake.

CaCertificate string

PEM representation of the trusted CA's x509 certificate.

ClientCertificate string

PEM representation of the replica's x509 certificate.

ClientKey string

PEM representation of the replica's private key. The corresponding public key in encoded in the client_certificate.

ConnectRetryInterval int

The number of seconds between connect retries.

DumpFilePath string

Path to a SQL file in GCS from which replica instances are created. Format is gs://bucket/filename.

FailoverTarget bool

Specifies if the replica is the failover target. If the field is set to true the replica will be designated as a failover replica. If the master instance fails, the replica instance will be promoted as the new master instance.

MasterHeartbeatPeriod int

Time in ms between replication heartbeats.

Password string

Password for the replication connection.

SslCipher string
Username string

Username for replication connection.

VerifyServerCertificate bool

True if the master's common name value is checked during the SSL handshake.

caCertificate String

PEM representation of the trusted CA's x509 certificate.

clientCertificate String

PEM representation of the replica's x509 certificate.

clientKey String

PEM representation of the replica's private key. The corresponding public key in encoded in the client_certificate.

connectRetryInterval Integer

The number of seconds between connect retries.

dumpFilePath String

Path to a SQL file in GCS from which replica instances are created. Format is gs://bucket/filename.

failoverTarget Boolean

Specifies if the replica is the failover target. If the field is set to true the replica will be designated as a failover replica. If the master instance fails, the replica instance will be promoted as the new master instance.

masterHeartbeatPeriod Integer

Time in ms between replication heartbeats.

password String

Password for the replication connection.

sslCipher String
username String

Username for replication connection.

verifyServerCertificate Boolean

True if the master's common name value is checked during the SSL handshake.

caCertificate string

PEM representation of the trusted CA's x509 certificate.

clientCertificate string

PEM representation of the replica's x509 certificate.

clientKey string

PEM representation of the replica's private key. The corresponding public key in encoded in the client_certificate.

connectRetryInterval number

The number of seconds between connect retries.

dumpFilePath string

Path to a SQL file in GCS from which replica instances are created. Format is gs://bucket/filename.

failoverTarget boolean

Specifies if the replica is the failover target. If the field is set to true the replica will be designated as a failover replica. If the master instance fails, the replica instance will be promoted as the new master instance.

masterHeartbeatPeriod number

Time in ms between replication heartbeats.

password string

Password for the replication connection.

sslCipher string
username string

Username for replication connection.

verifyServerCertificate boolean

True if the master's common name value is checked during the SSL handshake.

ca_certificate str

PEM representation of the trusted CA's x509 certificate.

client_certificate str

PEM representation of the replica's x509 certificate.

client_key str

PEM representation of the replica's private key. The corresponding public key in encoded in the client_certificate.

connect_retry_interval int

The number of seconds between connect retries.

dump_file_path str

Path to a SQL file in GCS from which replica instances are created. Format is gs://bucket/filename.

failover_target bool

Specifies if the replica is the failover target. If the field is set to true the replica will be designated as a failover replica. If the master instance fails, the replica instance will be promoted as the new master instance.

master_heartbeat_period int

Time in ms between replication heartbeats.

password str

Password for the replication connection.

ssl_cipher str
username str

Username for replication connection.

verify_server_certificate bool

True if the master's common name value is checked during the SSL handshake.

caCertificate String

PEM representation of the trusted CA's x509 certificate.

clientCertificate String

PEM representation of the replica's x509 certificate.

clientKey String

PEM representation of the replica's private key. The corresponding public key in encoded in the client_certificate.

connectRetryInterval Number

The number of seconds between connect retries.

dumpFilePath String

Path to a SQL file in GCS from which replica instances are created. Format is gs://bucket/filename.

failoverTarget Boolean

Specifies if the replica is the failover target. If the field is set to true the replica will be designated as a failover replica. If the master instance fails, the replica instance will be promoted as the new master instance.

masterHeartbeatPeriod Number

Time in ms between replication heartbeats.

password String

Password for the replication connection.

sslCipher String
username String

Username for replication connection.

verifyServerCertificate Boolean

True if the master's common name value is checked during the SSL handshake.

DatabaseInstanceRestoreBackupContext

BackupRunId int

The ID of the backup run to restore from.

InstanceId string

The ID of the instance that the backup was taken from. If left empty, this instance's ID will be used.

Project string

The full project ID of the source instance.`

BackupRunId int

The ID of the backup run to restore from.

InstanceId string

The ID of the instance that the backup was taken from. If left empty, this instance's ID will be used.

Project string

The full project ID of the source instance.`

backupRunId Integer

The ID of the backup run to restore from.

instanceId String

The ID of the instance that the backup was taken from. If left empty, this instance's ID will be used.

project String

The full project ID of the source instance.`

backupRunId number

The ID of the backup run to restore from.

instanceId string

The ID of the instance that the backup was taken from. If left empty, this instance's ID will be used.

project string

The full project ID of the source instance.`

backup_run_id int

The ID of the backup run to restore from.

instance_id str

The ID of the instance that the backup was taken from. If left empty, this instance's ID will be used.

project str

The full project ID of the source instance.`

backupRunId Number

The ID of the backup run to restore from.

instanceId String

The ID of the instance that the backup was taken from. If left empty, this instance's ID will be used.

project String

The full project ID of the source instance.`

DatabaseInstanceServerCaCert

Cert string
CommonName string
CreateTime string
ExpirationTime string

The RFC 3339 formatted date time string indicating when this whitelist expires.

Sha1Fingerprint string
Cert string
CommonName string
CreateTime string
ExpirationTime string

The RFC 3339 formatted date time string indicating when this whitelist expires.

Sha1Fingerprint string
cert String
commonName String
createTime String
expirationTime String

The RFC 3339 formatted date time string indicating when this whitelist expires.

sha1Fingerprint String
cert string
commonName string
createTime string
expirationTime string

The RFC 3339 formatted date time string indicating when this whitelist expires.

sha1Fingerprint string
cert str
common_name str
create_time str
expiration_time str

The RFC 3339 formatted date time string indicating when this whitelist expires.

sha1_fingerprint str
cert String
commonName String
createTime String
expirationTime String

The RFC 3339 formatted date time string indicating when this whitelist expires.

sha1Fingerprint String

DatabaseInstanceSettings

Tier string

The machine type to use. See tiers for more details and supported versions. Postgres supports only shared-core machine types, and custom machine types such as db-custom-2-13312. See the Custom Machine Type Documentation to learn about specifying custom machine types.

ActivationPolicy string

This specifies when the instance should be active. Can be either ALWAYS, NEVER or ON_DEMAND.

ActiveDirectoryConfig DatabaseInstanceSettingsActiveDirectoryConfig
AvailabilityType string

The availability type of the Cloud SQL instance, high availability (REGIONAL) or single zone (ZONAL).' For all instances, ensure that settings.backup_configuration.enabled is set to true. For MySQL instances, ensure that settings.backup_configuration.binary_log_enabled is set to true. For Postgres instances, ensure that settings.backup_configuration.point_in_time_recovery_enabled is set to true.

BackupConfiguration DatabaseInstanceSettingsBackupConfiguration
Collation string

The name of server instance collation.

DatabaseFlags List<DatabaseInstanceSettingsDatabaseFlag>
DiskAutoresize bool

The maximum size to which storage capacity can be automatically increased. The default value is 0, which specifies that there is no limit.

DiskAutoresizeLimit int
DiskSize int

The size of data disk, in GB. Size of a running instance cannot be reduced but can be increased. If you want to set this field, set disk_autoresize to false.

DiskType string

The type of data disk: PD_SSD or PD_HDD.

InsightsConfig DatabaseInstanceSettingsInsightsConfig
IpConfiguration DatabaseInstanceSettingsIpConfiguration
LocationPreference DatabaseInstanceSettingsLocationPreference
MaintenanceWindow DatabaseInstanceSettingsMaintenanceWindow
PricingPlan string

Pricing plan for this instance, can only be PER_USE.

SqlServerAuditConfig DatabaseInstanceSettingsSqlServerAuditConfig
UserLabels Dictionary<string, string>

A set of key/value user label pairs to assign to the instance.

Version int
Tier string

The machine type to use. See tiers for more details and supported versions. Postgres supports only shared-core machine types, and custom machine types such as db-custom-2-13312. See the Custom Machine Type Documentation to learn about specifying custom machine types.

ActivationPolicy string

This specifies when the instance should be active. Can be either ALWAYS, NEVER or ON_DEMAND.

ActiveDirectoryConfig DatabaseInstanceSettingsActiveDirectoryConfig
AvailabilityType string

The availability type of the Cloud SQL instance, high availability (REGIONAL) or single zone (ZONAL).' For all instances, ensure that settings.backup_configuration.enabled is set to true. For MySQL instances, ensure that settings.backup_configuration.binary_log_enabled is set to true. For Postgres instances, ensure that settings.backup_configuration.point_in_time_recovery_enabled is set to true.

BackupConfiguration DatabaseInstanceSettingsBackupConfiguration
Collation string

The name of server instance collation.

DatabaseFlags []DatabaseInstanceSettingsDatabaseFlag
DiskAutoresize bool

The maximum size to which storage capacity can be automatically increased. The default value is 0, which specifies that there is no limit.

DiskAutoresizeLimit int
DiskSize int

The size of data disk, in GB. Size of a running instance cannot be reduced but can be increased. If you want to set this field, set disk_autoresize to false.

DiskType string

The type of data disk: PD_SSD or PD_HDD.

InsightsConfig DatabaseInstanceSettingsInsightsConfig
IpConfiguration DatabaseInstanceSettingsIpConfiguration
LocationPreference DatabaseInstanceSettingsLocationPreference
MaintenanceWindow DatabaseInstanceSettingsMaintenanceWindow
PricingPlan string

Pricing plan for this instance, can only be PER_USE.

SqlServerAuditConfig DatabaseInstanceSettingsSqlServerAuditConfig
UserLabels map[string]string

A set of key/value user label pairs to assign to the instance.

Version int
tier String

The machine type to use. See tiers for more details and supported versions. Postgres supports only shared-core machine types, and custom machine types such as db-custom-2-13312. See the Custom Machine Type Documentation to learn about specifying custom machine types.

activationPolicy String

This specifies when the instance should be active. Can be either ALWAYS, NEVER or ON_DEMAND.

activeDirectoryConfig DatabaseInstanceSettingsActiveDirectoryConfig
availabilityType String

The availability type of the Cloud SQL instance, high availability (REGIONAL) or single zone (ZONAL).' For all instances, ensure that settings.backup_configuration.enabled is set to true. For MySQL instances, ensure that settings.backup_configuration.binary_log_enabled is set to true. For Postgres instances, ensure that settings.backup_configuration.point_in_time_recovery_enabled is set to true.

backupConfiguration DatabaseInstanceSettingsBackupConfiguration
collation String

The name of server instance collation.

databaseFlags List<DatabaseInstanceSettingsDatabaseFlag>
diskAutoresize Boolean

The maximum size to which storage capacity can be automatically increased. The default value is 0, which specifies that there is no limit.

diskAutoresizeLimit Integer
diskSize Integer

The size of data disk, in GB. Size of a running instance cannot be reduced but can be increased. If you want to set this field, set disk_autoresize to false.

diskType String

The type of data disk: PD_SSD or PD_HDD.

insightsConfig DatabaseInstanceSettingsInsightsConfig
ipConfiguration DatabaseInstanceSettingsIpConfiguration
locationPreference DatabaseInstanceSettingsLocationPreference
maintenanceWindow DatabaseInstanceSettingsMaintenanceWindow
pricingPlan String

Pricing plan for this instance, can only be PER_USE.

sqlServerAuditConfig DatabaseInstanceSettingsSqlServerAuditConfig
userLabels Map<String,String>

A set of key/value user label pairs to assign to the instance.

version Integer
tier string

The machine type to use. See tiers for more details and supported versions. Postgres supports only shared-core machine types, and custom machine types such as db-custom-2-13312. See the Custom Machine Type Documentation to learn about specifying custom machine types.

activationPolicy string

This specifies when the instance should be active. Can be either ALWAYS, NEVER or ON_DEMAND.

activeDirectoryConfig DatabaseInstanceSettingsActiveDirectoryConfig
availabilityType string

The availability type of the Cloud SQL instance, high availability (REGIONAL) or single zone (ZONAL).' For all instances, ensure that settings.backup_configuration.enabled is set to true. For MySQL instances, ensure that settings.backup_configuration.binary_log_enabled is set to true. For Postgres instances, ensure that settings.backup_configuration.point_in_time_recovery_enabled is set to true.

backupConfiguration DatabaseInstanceSettingsBackupConfiguration
collation string

The name of server instance collation.

databaseFlags DatabaseInstanceSettingsDatabaseFlag[]
diskAutoresize boolean

The maximum size to which storage capacity can be automatically increased. The default value is 0, which specifies that there is no limit.

diskAutoresizeLimit number
diskSize number

The size of data disk, in GB. Size of a running instance cannot be reduced but can be increased. If you want to set this field, set disk_autoresize to false.

diskType string

The type of data disk: PD_SSD or PD_HDD.

insightsConfig DatabaseInstanceSettingsInsightsConfig
ipConfiguration DatabaseInstanceSettingsIpConfiguration
locationPreference DatabaseInstanceSettingsLocationPreference
maintenanceWindow DatabaseInstanceSettingsMaintenanceWindow
pricingPlan string

Pricing plan for this instance, can only be PER_USE.

sqlServerAuditConfig DatabaseInstanceSettingsSqlServerAuditConfig
userLabels {[key: string]: string}

A set of key/value user label pairs to assign to the instance.

version number
tier str

The machine type to use. See tiers for more details and supported versions. Postgres supports only shared-core machine types, and custom machine types such as db-custom-2-13312. See the Custom Machine Type Documentation to learn about specifying custom machine types.

activation_policy str

This specifies when the instance should be active. Can be either ALWAYS, NEVER or ON_DEMAND.

active_directory_config DatabaseInstanceSettingsActiveDirectoryConfig
availability_type str

The availability type of the Cloud SQL instance, high availability (REGIONAL) or single zone (ZONAL).' For all instances, ensure that settings.backup_configuration.enabled is set to true. For MySQL instances, ensure that settings.backup_configuration.binary_log_enabled is set to true. For Postgres instances, ensure that settings.backup_configuration.point_in_time_recovery_enabled is set to true.

backup_configuration DatabaseInstanceSettingsBackupConfiguration
collation str

The name of server instance collation.

database_flags Sequence[DatabaseInstanceSettingsDatabaseFlag]
disk_autoresize bool

The maximum size to which storage capacity can be automatically increased. The default value is 0, which specifies that there is no limit.

disk_autoresize_limit int
disk_size int

The size of data disk, in GB. Size of a running instance cannot be reduced but can be increased. If you want to set this field, set disk_autoresize to false.

disk_type str

The type of data disk: PD_SSD or PD_HDD.

insights_config DatabaseInstanceSettingsInsightsConfig
ip_configuration DatabaseInstanceSettingsIpConfiguration
location_preference DatabaseInstanceSettingsLocationPreference
maintenance_window DatabaseInstanceSettingsMaintenanceWindow
pricing_plan str

Pricing plan for this instance, can only be PER_USE.

sql_server_audit_config DatabaseInstanceSettingsSqlServerAuditConfig
user_labels Mapping[str, str]

A set of key/value user label pairs to assign to the instance.

version int
tier String

The machine type to use. See tiers for more details and supported versions. Postgres supports only shared-core machine types, and custom machine types such as db-custom-2-13312. See the Custom Machine Type Documentation to learn about specifying custom machine types.

activationPolicy String

This specifies when the instance should be active. Can be either ALWAYS, NEVER or ON_DEMAND.

activeDirectoryConfig Property Map
availabilityType String

The availability type of the Cloud SQL instance, high availability (REGIONAL) or single zone (ZONAL).' For all instances, ensure that settings.backup_configuration.enabled is set to true. For MySQL instances, ensure that settings.backup_configuration.binary_log_enabled is set to true. For Postgres instances, ensure that settings.backup_configuration.point_in_time_recovery_enabled is set to true.

backupConfiguration Property Map
collation String

The name of server instance collation.

databaseFlags List<Property Map>
diskAutoresize Boolean

The maximum size to which storage capacity can be automatically increased. The default value is 0, which specifies that there is no limit.

diskAutoresizeLimit Number
diskSize Number

The size of data disk, in GB. Size of a running instance cannot be reduced but can be increased. If you want to set this field, set disk_autoresize to false.

diskType String

The type of data disk: PD_SSD or PD_HDD.

insightsConfig Property Map
ipConfiguration Property Map
locationPreference Property Map
maintenanceWindow Property Map
pricingPlan String

Pricing plan for this instance, can only be PER_USE.

sqlServerAuditConfig Property Map
userLabels Map<String>

A set of key/value user label pairs to assign to the instance.

version Number

DatabaseInstanceSettingsActiveDirectoryConfig

Domain string

The domain name for the active directory (e.g., mydomain.com). Can only be used with SQL Server.

Domain string

The domain name for the active directory (e.g., mydomain.com). Can only be used with SQL Server.

domain String

The domain name for the active directory (e.g., mydomain.com). Can only be used with SQL Server.

domain string

The domain name for the active directory (e.g., mydomain.com). Can only be used with SQL Server.

domain str

The domain name for the active directory (e.g., mydomain.com). Can only be used with SQL Server.

domain String

The domain name for the active directory (e.g., mydomain.com). Can only be used with SQL Server.

DatabaseInstanceSettingsBackupConfiguration

BackupRetentionSettings DatabaseInstanceSettingsBackupConfigurationBackupRetentionSettings

Backup retention settings. The configuration is detailed below.

BinaryLogEnabled bool

True if binary logging is enabled. Can only be used with MySQL.

Enabled bool

True if backup configuration is enabled.

Location string

The region where the backup will be stored

PointInTimeRecoveryEnabled bool

True if Point-in-time recovery is enabled. Will restart database if enabled after instance creation. Valid only for PostgreSQL instances.

StartTime string

HH:MM format time indicating when backup configuration starts.

TransactionLogRetentionDays int

The number of days of transaction logs we retain for point in time restore, from 1-7.

BackupRetentionSettings DatabaseInstanceSettingsBackupConfigurationBackupRetentionSettings

Backup retention settings. The configuration is detailed below.

BinaryLogEnabled bool

True if binary logging is enabled. Can only be used with MySQL.

Enabled bool

True if backup configuration is enabled.

Location string

The region where the backup will be stored

PointInTimeRecoveryEnabled bool

True if Point-in-time recovery is enabled. Will restart database if enabled after instance creation. Valid only for PostgreSQL instances.

StartTime string

HH:MM format time indicating when backup configuration starts.

TransactionLogRetentionDays int

The number of days of transaction logs we retain for point in time restore, from 1-7.

backupRetentionSettings DatabaseInstanceSettingsBackupConfigurationBackupRetentionSettings

Backup retention settings. The configuration is detailed below.

binaryLogEnabled Boolean

True if binary logging is enabled. Can only be used with MySQL.

enabled Boolean

True if backup configuration is enabled.

location String

The region where the backup will be stored

pointInTimeRecoveryEnabled Boolean

True if Point-in-time recovery is enabled. Will restart database if enabled after instance creation. Valid only for PostgreSQL instances.

startTime String

HH:MM format time indicating when backup configuration starts.

transactionLogRetentionDays Integer

The number of days of transaction logs we retain for point in time restore, from 1-7.

backupRetentionSettings DatabaseInstanceSettingsBackupConfigurationBackupRetentionSettings

Backup retention settings. The configuration is detailed below.

binaryLogEnabled boolean

True if binary logging is enabled. Can only be used with MySQL.

enabled boolean

True if backup configuration is enabled.

location string

The region where the backup will be stored

pointInTimeRecoveryEnabled boolean

True if Point-in-time recovery is enabled. Will restart database if enabled after instance creation. Valid only for PostgreSQL instances.

startTime string

HH:MM format time indicating when backup configuration starts.

transactionLogRetentionDays number

The number of days of transaction logs we retain for point in time restore, from 1-7.

backup_retention_settings DatabaseInstanceSettingsBackupConfigurationBackupRetentionSettings

Backup retention settings. The configuration is detailed below.

binary_log_enabled bool

True if binary logging is enabled. Can only be used with MySQL.

enabled bool

True if backup configuration is enabled.

location str

The region where the backup will be stored

point_in_time_recovery_enabled bool

True if Point-in-time recovery is enabled. Will restart database if enabled after instance creation. Valid only for PostgreSQL instances.

start_time str

HH:MM format time indicating when backup configuration starts.

transaction_log_retention_days int

The number of days of transaction logs we retain for point in time restore, from 1-7.

backupRetentionSettings Property Map

Backup retention settings. The configuration is detailed below.

binaryLogEnabled Boolean

True if binary logging is enabled. Can only be used with MySQL.

enabled Boolean

True if backup configuration is enabled.

location String

The region where the backup will be stored

pointInTimeRecoveryEnabled Boolean

True if Point-in-time recovery is enabled. Will restart database if enabled after instance creation. Valid only for PostgreSQL instances.

startTime String

HH:MM format time indicating when backup configuration starts.

transactionLogRetentionDays Number

The number of days of transaction logs we retain for point in time restore, from 1-7.

DatabaseInstanceSettingsBackupConfigurationBackupRetentionSettings

RetainedBackups int

Depending on the value of retention_unit, this is used to determine if a backup needs to be deleted. If retention_unit is 'COUNT', we will retain this many backups.

RetentionUnit string

The unit that 'retained_backups' represents. Defaults to COUNT.

RetainedBackups int

Depending on the value of retention_unit, this is used to determine if a backup needs to be deleted. If retention_unit is 'COUNT', we will retain this many backups.

RetentionUnit string

The unit that 'retained_backups' represents. Defaults to COUNT.

retainedBackups Integer

Depending on the value of retention_unit, this is used to determine if a backup needs to be deleted. If retention_unit is 'COUNT', we will retain this many backups.

retentionUnit String

The unit that 'retained_backups' represents. Defaults to COUNT.

retainedBackups number

Depending on the value of retention_unit, this is used to determine if a backup needs to be deleted. If retention_unit is 'COUNT', we will retain this many backups.

retentionUnit string

The unit that 'retained_backups' represents. Defaults to COUNT.

retained_backups int

Depending on the value of retention_unit, this is used to determine if a backup needs to be deleted. If retention_unit is 'COUNT', we will retain this many backups.

retention_unit str

The unit that 'retained_backups' represents. Defaults to COUNT.

retainedBackups Number

Depending on the value of retention_unit, this is used to determine if a backup needs to be deleted. If retention_unit is 'COUNT', we will retain this many backups.

retentionUnit String

The unit that 'retained_backups' represents. Defaults to COUNT.

DatabaseInstanceSettingsDatabaseFlag

Name string

A name for this whitelist entry.

Value string

A CIDR notation IPv4 or IPv6 address that is allowed to access this instance. Must be set even if other two attributes are not for the whitelist to become active.

Name string

A name for this whitelist entry.

Value string

A CIDR notation IPv4 or IPv6 address that is allowed to access this instance. Must be set even if other two attributes are not for the whitelist to become active.

name String

A name for this whitelist entry.

value String

A CIDR notation IPv4 or IPv6 address that is allowed to access this instance. Must be set even if other two attributes are not for the whitelist to become active.

name string

A name for this whitelist entry.

value string

A CIDR notation IPv4 or IPv6 address that is allowed to access this instance. Must be set even if other two attributes are not for the whitelist to become active.

name str

A name for this whitelist entry.

value str

A CIDR notation IPv4 or IPv6 address that is allowed to access this instance. Must be set even if other two attributes are not for the whitelist to become active.

name String

A name for this whitelist entry.

value String

A CIDR notation IPv4 or IPv6 address that is allowed to access this instance. Must be set even if other two attributes are not for the whitelist to become active.

DatabaseInstanceSettingsInsightsConfig

QueryInsightsEnabled bool

True if Query Insights feature is enabled.

QueryStringLength int

Maximum query length stored in bytes. Between 256 and 4500. Default to 1024.

RecordApplicationTags bool

True if Query Insights will record application tags from query when enabled.

RecordClientAddress bool

True if Query Insights will record client address when enabled.

QueryInsightsEnabled bool

True if Query Insights feature is enabled.

QueryStringLength int

Maximum query length stored in bytes. Between 256 and 4500. Default to 1024.

RecordApplicationTags bool

True if Query Insights will record application tags from query when enabled.

RecordClientAddress bool

True if Query Insights will record client address when enabled.

queryInsightsEnabled Boolean

True if Query Insights feature is enabled.

queryStringLength Integer

Maximum query length stored in bytes. Between 256 and 4500. Default to 1024.

recordApplicationTags Boolean

True if Query Insights will record application tags from query when enabled.

recordClientAddress Boolean

True if Query Insights will record client address when enabled.

queryInsightsEnabled boolean

True if Query Insights feature is enabled.

queryStringLength number

Maximum query length stored in bytes. Between 256 and 4500. Default to 1024.

recordApplicationTags boolean

True if Query Insights will record application tags from query when enabled.

recordClientAddress boolean

True if Query Insights will record client address when enabled.

query_insights_enabled bool

True if Query Insights feature is enabled.

query_string_length int

Maximum query length stored in bytes. Between 256 and 4500. Default to 1024.

record_application_tags bool

True if Query Insights will record application tags from query when enabled.

record_client_address bool

True if Query Insights will record client address when enabled.

queryInsightsEnabled Boolean

True if Query Insights feature is enabled.

queryStringLength Number

Maximum query length stored in bytes. Between 256 and 4500. Default to 1024.

recordApplicationTags Boolean

True if Query Insights will record application tags from query when enabled.

recordClientAddress Boolean

True if Query Insights will record client address when enabled.

DatabaseInstanceSettingsIpConfiguration

AllocatedIpRange string

The name of the allocated ip range for the private ip CloudSQL instance. For example: "google-managed-services-default". If set, the cloned instance ip will be created in the allocated range. The range name must comply with RFC 1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z?.

AuthorizedNetworks List<DatabaseInstanceSettingsIpConfigurationAuthorizedNetwork>
Ipv4Enabled bool

Whether this Cloud SQL instance should be assigned a public IPV4 address. At least ipv4_enabled must be enabled or a private_network must be configured.

PrivateNetwork string

The VPC network from which the Cloud SQL instance is accessible for private IP. For example, projects/myProject/global/networks/default. Specifying a network enables private IP. At least ipv4_enabled must be enabled or a private_network must be configured. This setting can be updated, but it cannot be removed after it is set.

RequireSsl bool

Whether SSL connections over IP are enforced or not.

AllocatedIpRange string

The name of the allocated ip range for the private ip CloudSQL instance. For example: "google-managed-services-default". If set, the cloned instance ip will be created in the allocated range. The range name must comply with RFC 1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z?.

AuthorizedNetworks []DatabaseInstanceSettingsIpConfigurationAuthorizedNetwork
Ipv4Enabled bool

Whether this Cloud SQL instance should be assigned a public IPV4 address. At least ipv4_enabled must be enabled or a private_network must be configured.

PrivateNetwork string

The VPC network from which the Cloud SQL instance is accessible for private IP. For example, projects/myProject/global/networks/default. Specifying a network enables private IP. At least ipv4_enabled must be enabled or a private_network must be configured. This setting can be updated, but it cannot be removed after it is set.

RequireSsl bool

Whether SSL connections over IP are enforced or not.

allocatedIpRange String

The name of the allocated ip range for the private ip CloudSQL instance. For example: "google-managed-services-default". If set, the cloned instance ip will be created in the allocated range. The range name must comply with RFC 1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z?.

authorizedNetworks List<DatabaseInstanceSettingsIpConfigurationAuthorizedNetwork>
ipv4Enabled Boolean

Whether this Cloud SQL instance should be assigned a public IPV4 address. At least ipv4_enabled must be enabled or a private_network must be configured.

privateNetwork String

The VPC network from which the Cloud SQL instance is accessible for private IP. For example, projects/myProject/global/networks/default. Specifying a network enables private IP. At least ipv4_enabled must be enabled or a private_network must be configured. This setting can be updated, but it cannot be removed after it is set.

requireSsl Boolean

Whether SSL connections over IP are enforced or not.

allocatedIpRange string

The name of the allocated ip range for the private ip CloudSQL instance. For example: "google-managed-services-default". If set, the cloned instance ip will be created in the allocated range. The range name must comply with RFC 1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z?.

authorizedNetworks DatabaseInstanceSettingsIpConfigurationAuthorizedNetwork[]
ipv4Enabled boolean

Whether this Cloud SQL instance should be assigned a public IPV4 address. At least ipv4_enabled must be enabled or a private_network must be configured.

privateNetwork string

The VPC network from which the Cloud SQL instance is accessible for private IP. For example, projects/myProject/global/networks/default. Specifying a network enables private IP. At least ipv4_enabled must be enabled or a private_network must be configured. This setting can be updated, but it cannot be removed after it is set.

requireSsl boolean

Whether SSL connections over IP are enforced or not.

allocated_ip_range str

The name of the allocated ip range for the private ip CloudSQL instance. For example: "google-managed-services-default". If set, the cloned instance ip will be created in the allocated range. The range name must comply with RFC 1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z?.

authorized_networks Sequence[DatabaseInstanceSettingsIpConfigurationAuthorizedNetwork]
ipv4_enabled bool

Whether this Cloud SQL instance should be assigned a public IPV4 address. At least ipv4_enabled must be enabled or a private_network must be configured.

private_network str

The VPC network from which the Cloud SQL instance is accessible for private IP. For example, projects/myProject/global/networks/default. Specifying a network enables private IP. At least ipv4_enabled must be enabled or a private_network must be configured. This setting can be updated, but it cannot be removed after it is set.

require_ssl bool

Whether SSL connections over IP are enforced or not.

allocatedIpRange String

The name of the allocated ip range for the private ip CloudSQL instance. For example: "google-managed-services-default". If set, the cloned instance ip will be created in the allocated range. The range name must comply with RFC 1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z?.

authorizedNetworks List<Property Map>
ipv4Enabled Boolean

Whether this Cloud SQL instance should be assigned a public IPV4 address. At least ipv4_enabled must be enabled or a private_network must be configured.

privateNetwork String

The VPC network from which the Cloud SQL instance is accessible for private IP. For example, projects/myProject/global/networks/default. Specifying a network enables private IP. At least ipv4_enabled must be enabled or a private_network must be configured. This setting can be updated, but it cannot be removed after it is set.

requireSsl Boolean

Whether SSL connections over IP are enforced or not.

DatabaseInstanceSettingsIpConfigurationAuthorizedNetwork

Value string

A CIDR notation IPv4 or IPv6 address that is allowed to access this instance. Must be set even if other two attributes are not for the whitelist to become active.

ExpirationTime string

The RFC 3339 formatted date time string indicating when this whitelist expires.

Name string

A name for this whitelist entry.

Value string

A CIDR notation IPv4 or IPv6 address that is allowed to access this instance. Must be set even if other two attributes are not for the whitelist to become active.

ExpirationTime string

The RFC 3339 formatted date time string indicating when this whitelist expires.

Name string

A name for this whitelist entry.

value String

A CIDR notation IPv4 or IPv6 address that is allowed to access this instance. Must be set even if other two attributes are not for the whitelist to become active.

expirationTime String

The RFC 3339 formatted date time string indicating when this whitelist expires.

name String

A name for this whitelist entry.

value string

A CIDR notation IPv4 or IPv6 address that is allowed to access this instance. Must be set even if other two attributes are not for the whitelist to become active.

expirationTime string

The RFC 3339 formatted date time string indicating when this whitelist expires.

name string

A name for this whitelist entry.

value str

A CIDR notation IPv4 or IPv6 address that is allowed to access this instance. Must be set even if other two attributes are not for the whitelist to become active.

expiration_time str

The RFC 3339 formatted date time string indicating when this whitelist expires.

name str

A name for this whitelist entry.

value String

A CIDR notation IPv4 or IPv6 address that is allowed to access this instance. Must be set even if other two attributes are not for the whitelist to become active.

expirationTime String

The RFC 3339 formatted date time string indicating when this whitelist expires.

name String

A name for this whitelist entry.

DatabaseInstanceSettingsLocationPreference

FollowGaeApplication string

A GAE application whose zone to remain in. Must be in the same region as this instance.

SecondaryZone string

The preferred Compute Engine zone for the secondary/failover.

Zone string

The preferred compute engine zone.

FollowGaeApplication string

A GAE application whose zone to remain in. Must be in the same region as this instance.

SecondaryZone string

The preferred Compute Engine zone for the secondary/failover.

Zone string

The preferred compute engine zone.

followGaeApplication String

A GAE application whose zone to remain in. Must be in the same region as this instance.

secondaryZone String

The preferred Compute Engine zone for the secondary/failover.

zone String

The preferred compute engine zone.

followGaeApplication string

A GAE application whose zone to remain in. Must be in the same region as this instance.

secondaryZone string

The preferred Compute Engine zone for the secondary/failover.

zone string

The preferred compute engine zone.

follow_gae_application str

A GAE application whose zone to remain in. Must be in the same region as this instance.

secondary_zone str

The preferred Compute Engine zone for the secondary/failover.

zone str

The preferred compute engine zone.

followGaeApplication String

A GAE application whose zone to remain in. Must be in the same region as this instance.

secondaryZone String

The preferred Compute Engine zone for the secondary/failover.

zone String

The preferred compute engine zone.

DatabaseInstanceSettingsMaintenanceWindow

Day int

Day of week (1-7), starting on Monday

Hour int

Hour of day (0-23), ignored if day not set

UpdateTrack string

Receive updates earlier (canary) or later (stable)

Day int

Day of week (1-7), starting on Monday

Hour int

Hour of day (0-23), ignored if day not set

UpdateTrack string

Receive updates earlier (canary) or later (stable)

day Integer

Day of week (1-7), starting on Monday

hour Integer

Hour of day (0-23), ignored if day not set

updateTrack String

Receive updates earlier (canary) or later (stable)

day number

Day of week (1-7), starting on Monday

hour number

Hour of day (0-23), ignored if day not set

updateTrack string

Receive updates earlier (canary) or later (stable)

day int

Day of week (1-7), starting on Monday

hour int

Hour of day (0-23), ignored if day not set

update_track str

Receive updates earlier (canary) or later (stable)

day Number

Day of week (1-7), starting on Monday

hour Number

Hour of day (0-23), ignored if day not set

updateTrack String

Receive updates earlier (canary) or later (stable)

DatabaseInstanceSettingsSqlServerAuditConfig

Bucket string

The name of the destination bucket (e.g., gs://mybucket).

RetentionInterval string

How long to keep generated audit files. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

UploadInterval string

How often to upload generated audit files. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

Bucket string

The name of the destination bucket (e.g., gs://mybucket).

RetentionInterval string

How long to keep generated audit files. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

UploadInterval string

How often to upload generated audit files. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

bucket String

The name of the destination bucket (e.g., gs://mybucket).

retentionInterval String

How long to keep generated audit files. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

uploadInterval String

How often to upload generated audit files. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

bucket string

The name of the destination bucket (e.g., gs://mybucket).

retentionInterval string

How long to keep generated audit files. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

uploadInterval string

How often to upload generated audit files. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

bucket str

The name of the destination bucket (e.g., gs://mybucket).

retention_interval str

How long to keep generated audit files. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

upload_interval str

How often to upload generated audit files. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

bucket String

The name of the destination bucket (e.g., gs://mybucket).

retentionInterval String

How long to keep generated audit files. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

uploadInterval String

How often to upload generated audit files. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

Import

Database instances can be imported using one of any of these accepted formats

 $ pulumi import gcp:sql/databaseInstance:DatabaseInstance main projects/{{project}}/instances/{{name}}
 $ pulumi import gcp:sql/databaseInstance:DatabaseInstance main {{project}}/{{name}}
 $ pulumi import gcp:sql/databaseInstance:DatabaseInstance main {{name}}

config and set on the server. When importing, double-check that your config has all the fields set that you expect- just seeing no diff isn’t sufficient to know that your config could reproduce the imported resource.

Package Details

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

This Pulumi package is based on the google-beta Terraform Provider.