Database Instance
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 usegcp.sql.User
to define a custom user with a restricted host and strong password. Note: On newer versions of the provider, you must explicitly setdeletion_protection=false
(and runpulumi 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
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const main = new gcp.sql.DatabaseInstance("main", {
name: "main-instance",
databaseVersion: "POSTGRES_15",
region: "us-central1",
settings: {
tier: "db-f1-micro",
},
});
import pulumi
import pulumi_gcp as gcp
main = gcp.sql.DatabaseInstance("main",
name="main-instance",
database_version="POSTGRES_15",
region="us-central1",
settings={
"tier": "db-f1-micro",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var main = new Gcp.Sql.DatabaseInstance("main", new()
{
Name = "main-instance",
DatabaseVersion = "POSTGRES_15",
Region = "us-central1",
Settings = new Gcp.Sql.Inputs.DatabaseInstanceSettingsArgs
{
Tier = "db-f1-micro",
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/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{
Name: pulumi.String("main-instance"),
DatabaseVersion: pulumi.String("POSTGRES_15"),
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 com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.sql.DatabaseInstance;
import com.pulumi.gcp.sql.DatabaseInstanceArgs;
import com.pulumi.gcp.sql.inputs.DatabaseInstanceSettingsArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var main = new DatabaseInstance("main", DatabaseInstanceArgs.builder()
.name("main-instance")
.databaseVersion("POSTGRES_15")
.region("us-central1")
.settings(DatabaseInstanceSettingsArgs.builder()
.tier("db-f1-micro")
.build())
.build());
}
}
resources:
main:
type: gcp:sql:DatabaseInstance
properties:
name: main-instance
databaseVersion: POSTGRES_15
region: us-central1
settings:
tier: db-f1-micro
Private IP Instance
NOTE: For private IP instance setup, note that the
gcp.sql.DatabaseInstance
does not actually interpolate values fromgcp.servicenetworking.Connection
. You must explicitly add adepends_on
reference as shown below.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
import * as random from "@pulumi/random";
const privateNetwork = new gcp.compute.Network("private_network", {name: "private-network"});
const privateIpAddress = new gcp.compute.GlobalAddress("private_ip_address", {
name: "private-ip-address",
purpose: "VPC_PEERING",
addressType: "INTERNAL",
prefixLength: 16,
network: privateNetwork.id,
});
const privateVpcConnection = new gcp.servicenetworking.Connection("private_vpc_connection", {
network: privateNetwork.id,
service: "servicenetworking.googleapis.com",
reservedPeeringRanges: [privateIpAddress.name],
});
const dbNameSuffix = new random.RandomId("db_name_suffix", {byteLength: 4});
const instance = new gcp.sql.DatabaseInstance("instance", {
name: pulumi.interpolate`private-instance-${dbNameSuffix.hex}`,
region: "us-central1",
databaseVersion: "MYSQL_5_7",
settings: {
tier: "db-f1-micro",
ipConfiguration: {
ipv4Enabled: false,
privateNetwork: privateNetwork.selfLink,
enablePrivatePathForGoogleCloudServices: true,
},
},
}, {
dependsOn: [privateVpcConnection],
});
import pulumi
import pulumi_gcp as gcp
import pulumi_random as random
private_network = gcp.compute.Network("private_network", name="private-network")
private_ip_address = gcp.compute.GlobalAddress("private_ip_address",
name="private-ip-address",
purpose="VPC_PEERING",
address_type="INTERNAL",
prefix_length=16,
network=private_network.id)
private_vpc_connection = gcp.servicenetworking.Connection("private_vpc_connection",
network=private_network.id,
service="servicenetworking.googleapis.com",
reserved_peering_ranges=[private_ip_address.name])
db_name_suffix = random.RandomId("db_name_suffix", byte_length=4)
instance = gcp.sql.DatabaseInstance("instance",
name=db_name_suffix.hex.apply(lambda hex: f"private-instance-{hex}"),
region="us-central1",
database_version="MYSQL_5_7",
settings={
"tier": "db-f1-micro",
"ip_configuration": {
"ipv4_enabled": False,
"private_network": private_network.self_link,
"enable_private_path_for_google_cloud_services": True,
},
},
opts = pulumi.ResourceOptions(depends_on=[private_vpc_connection]))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var privateNetwork = new Gcp.Compute.Network("private_network", new()
{
Name = "private-network",
});
var privateIpAddress = new Gcp.Compute.GlobalAddress("private_ip_address", new()
{
Name = "private-ip-address",
Purpose = "VPC_PEERING",
AddressType = "INTERNAL",
PrefixLength = 16,
Network = privateNetwork.Id,
});
var privateVpcConnection = new Gcp.ServiceNetworking.Connection("private_vpc_connection", new()
{
Network = privateNetwork.Id,
Service = "servicenetworking.googleapis.com",
ReservedPeeringRanges = new[]
{
privateIpAddress.Name,
},
});
var dbNameSuffix = new Random.RandomId("db_name_suffix", new()
{
ByteLength = 4,
});
var instance = new Gcp.Sql.DatabaseInstance("instance", new()
{
Name = dbNameSuffix.Hex.Apply(hex => $"private-instance-{hex}"),
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.SelfLink,
EnablePrivatePathForGoogleCloudServices = true,
},
},
}, new CustomResourceOptions
{
DependsOn =
{
privateVpcConnection,
},
});
});
package main
import (
"fmt"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/servicenetworking"
"github.com/pulumi/pulumi-gcp/sdk/v7/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, "private_network", &compute.NetworkArgs{
Name: pulumi.String("private-network"),
})
if err != nil {
return err
}
privateIpAddress, err := compute.NewGlobalAddress(ctx, "private_ip_address", &compute.GlobalAddressArgs{
Name: pulumi.String("private-ip-address"),
Purpose: pulumi.String("VPC_PEERING"),
AddressType: pulumi.String("INTERNAL"),
PrefixLength: pulumi.Int(16),
Network: privateNetwork.ID(),
})
if err != nil {
return err
}
privateVpcConnection, err := servicenetworking.NewConnection(ctx, "private_vpc_connection", &servicenetworking.ConnectionArgs{
Network: privateNetwork.ID(),
Service: pulumi.String("servicenetworking.googleapis.com"),
ReservedPeeringRanges: pulumi.StringArray{
privateIpAddress.Name,
},
})
if err != nil {
return err
}
dbNameSuffix, err := random.NewRandomId(ctx, "db_name_suffix", &random.RandomIdArgs{
ByteLength: pulumi.Int(4),
})
if err != nil {
return err
}
_, err = sql.NewDatabaseInstance(ctx, "instance", &sql.DatabaseInstanceArgs{
Name: dbNameSuffix.Hex.ApplyT(func(hex string) (string, error) {
return fmt.Sprintf("private-instance-%v", hex), nil
}).(pulumi.StringOutput),
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.SelfLink,
EnablePrivatePathForGoogleCloudServices: pulumi.Bool(true),
},
},
}, pulumi.DependsOn([]pulumi.Resource{
privateVpcConnection,
}))
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.Network;
import com.pulumi.gcp.compute.NetworkArgs;
import com.pulumi.gcp.compute.GlobalAddress;
import com.pulumi.gcp.compute.GlobalAddressArgs;
import com.pulumi.gcp.servicenetworking.Connection;
import com.pulumi.gcp.servicenetworking.ConnectionArgs;
import com.pulumi.random.RandomId;
import com.pulumi.random.RandomIdArgs;
import com.pulumi.gcp.sql.DatabaseInstance;
import com.pulumi.gcp.sql.DatabaseInstanceArgs;
import com.pulumi.gcp.sql.inputs.DatabaseInstanceSettingsArgs;
import com.pulumi.gcp.sql.inputs.DatabaseInstanceSettingsIpConfigurationArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var privateNetwork = new Network("privateNetwork", NetworkArgs.builder()
.name("private-network")
.build());
var privateIpAddress = new GlobalAddress("privateIpAddress", GlobalAddressArgs.builder()
.name("private-ip-address")
.purpose("VPC_PEERING")
.addressType("INTERNAL")
.prefixLength(16)
.network(privateNetwork.id())
.build());
var privateVpcConnection = new Connection("privateVpcConnection", ConnectionArgs.builder()
.network(privateNetwork.id())
.service("servicenetworking.googleapis.com")
.reservedPeeringRanges(privateIpAddress.name())
.build());
var dbNameSuffix = new RandomId("dbNameSuffix", RandomIdArgs.builder()
.byteLength(4)
.build());
var instance = new DatabaseInstance("instance", DatabaseInstanceArgs.builder()
.name(dbNameSuffix.hex().applyValue(hex -> String.format("private-instance-%s", hex)))
.region("us-central1")
.databaseVersion("MYSQL_5_7")
.settings(DatabaseInstanceSettingsArgs.builder()
.tier("db-f1-micro")
.ipConfiguration(DatabaseInstanceSettingsIpConfigurationArgs.builder()
.ipv4Enabled(false)
.privateNetwork(privateNetwork.selfLink())
.enablePrivatePathForGoogleCloudServices(true)
.build())
.build())
.build(), CustomResourceOptions.builder()
.dependsOn(privateVpcConnection)
.build());
}
}
resources:
privateNetwork:
type: gcp:compute:Network
name: private_network
properties:
name: private-network
privateIpAddress:
type: gcp:compute:GlobalAddress
name: private_ip_address
properties:
name: private-ip-address
purpose: VPC_PEERING
addressType: INTERNAL
prefixLength: 16
network: ${privateNetwork.id}
privateVpcConnection:
type: gcp:servicenetworking:Connection
name: private_vpc_connection
properties:
network: ${privateNetwork.id}
service: servicenetworking.googleapis.com
reservedPeeringRanges:
- ${privateIpAddress.name}
dbNameSuffix:
type: random:RandomId
name: db_name_suffix
properties:
byteLength: 4
instance:
type: gcp:sql:DatabaseInstance
properties:
name: private-instance-${dbNameSuffix.hex}
region: us-central1
databaseVersion: MYSQL_5_7
settings:
tier: db-f1-micro
ipConfiguration:
ipv4Enabled: false
privateNetwork: ${privateNetwork.selfLink}
enablePrivatePathForGoogleCloudServices: true
options:
dependson:
- ${privateVpcConnection}
ENTERPRISE_PLUS Instance with data_cache_config
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const main = new gcp.sql.DatabaseInstance("main", {
name: "enterprise-plus-main-instance",
databaseVersion: "MYSQL_8_0_31",
settings: {
tier: "db-perf-optimized-N-2",
edition: "ENTERPRISE_PLUS",
dataCacheConfig: {
dataCacheEnabled: true,
},
},
});
import pulumi
import pulumi_gcp as gcp
main = gcp.sql.DatabaseInstance("main",
name="enterprise-plus-main-instance",
database_version="MYSQL_8_0_31",
settings={
"tier": "db-perf-optimized-N-2",
"edition": "ENTERPRISE_PLUS",
"data_cache_config": {
"data_cache_enabled": True,
},
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var main = new Gcp.Sql.DatabaseInstance("main", new()
{
Name = "enterprise-plus-main-instance",
DatabaseVersion = "MYSQL_8_0_31",
Settings = new Gcp.Sql.Inputs.DatabaseInstanceSettingsArgs
{
Tier = "db-perf-optimized-N-2",
Edition = "ENTERPRISE_PLUS",
DataCacheConfig = new Gcp.Sql.Inputs.DatabaseInstanceSettingsDataCacheConfigArgs
{
DataCacheEnabled = true,
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/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{
Name: pulumi.String("enterprise-plus-main-instance"),
DatabaseVersion: pulumi.String("MYSQL_8_0_31"),
Settings: &sql.DatabaseInstanceSettingsArgs{
Tier: pulumi.String("db-perf-optimized-N-2"),
Edition: pulumi.String("ENTERPRISE_PLUS"),
DataCacheConfig: &sql.DatabaseInstanceSettingsDataCacheConfigArgs{
DataCacheEnabled: pulumi.Bool(true),
},
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.sql.DatabaseInstance;
import com.pulumi.gcp.sql.DatabaseInstanceArgs;
import com.pulumi.gcp.sql.inputs.DatabaseInstanceSettingsArgs;
import com.pulumi.gcp.sql.inputs.DatabaseInstanceSettingsDataCacheConfigArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var main = new DatabaseInstance("main", DatabaseInstanceArgs.builder()
.name("enterprise-plus-main-instance")
.databaseVersion("MYSQL_8_0_31")
.settings(DatabaseInstanceSettingsArgs.builder()
.tier("db-perf-optimized-N-2")
.edition("ENTERPRISE_PLUS")
.dataCacheConfig(DatabaseInstanceSettingsDataCacheConfigArgs.builder()
.dataCacheEnabled(true)
.build())
.build())
.build());
}
}
resources:
main:
type: gcp:sql:DatabaseInstance
properties:
name: enterprise-plus-main-instance
databaseVersion: MYSQL_8_0_31
settings:
tier: db-perf-optimized-N-2
edition: ENTERPRISE_PLUS
dataCacheConfig:
dataCacheEnabled: true
Cloud SQL Instance with PSC connectivity
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const main = new gcp.sql.DatabaseInstance("main", {
name: "psc-enabled-main-instance",
databaseVersion: "MYSQL_8_0",
settings: {
tier: "db-f1-micro",
ipConfiguration: {
pscConfigs: [{
pscEnabled: true,
allowedConsumerProjects: ["allowed-consumer-project-name"],
}],
ipv4Enabled: false,
},
backupConfiguration: {
enabled: true,
binaryLogEnabled: true,
},
availabilityType: "REGIONAL",
},
});
import pulumi
import pulumi_gcp as gcp
main = gcp.sql.DatabaseInstance("main",
name="psc-enabled-main-instance",
database_version="MYSQL_8_0",
settings={
"tier": "db-f1-micro",
"ip_configuration": {
"psc_configs": [{
"psc_enabled": True,
"allowed_consumer_projects": ["allowed-consumer-project-name"],
}],
"ipv4_enabled": False,
},
"backup_configuration": {
"enabled": True,
"binary_log_enabled": True,
},
"availability_type": "REGIONAL",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var main = new Gcp.Sql.DatabaseInstance("main", new()
{
Name = "psc-enabled-main-instance",
DatabaseVersion = "MYSQL_8_0",
Settings = new Gcp.Sql.Inputs.DatabaseInstanceSettingsArgs
{
Tier = "db-f1-micro",
IpConfiguration = new Gcp.Sql.Inputs.DatabaseInstanceSettingsIpConfigurationArgs
{
PscConfigs = new[]
{
new Gcp.Sql.Inputs.DatabaseInstanceSettingsIpConfigurationPscConfigArgs
{
PscEnabled = true,
AllowedConsumerProjects = new[]
{
"allowed-consumer-project-name",
},
},
},
Ipv4Enabled = false,
},
BackupConfiguration = new Gcp.Sql.Inputs.DatabaseInstanceSettingsBackupConfigurationArgs
{
Enabled = true,
BinaryLogEnabled = true,
},
AvailabilityType = "REGIONAL",
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/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{
Name: pulumi.String("psc-enabled-main-instance"),
DatabaseVersion: pulumi.String("MYSQL_8_0"),
Settings: &sql.DatabaseInstanceSettingsArgs{
Tier: pulumi.String("db-f1-micro"),
IpConfiguration: &sql.DatabaseInstanceSettingsIpConfigurationArgs{
PscConfigs: sql.DatabaseInstanceSettingsIpConfigurationPscConfigArray{
&sql.DatabaseInstanceSettingsIpConfigurationPscConfigArgs{
PscEnabled: pulumi.Bool(true),
AllowedConsumerProjects: pulumi.StringArray{
pulumi.String("allowed-consumer-project-name"),
},
},
},
Ipv4Enabled: pulumi.Bool(false),
},
BackupConfiguration: &sql.DatabaseInstanceSettingsBackupConfigurationArgs{
Enabled: pulumi.Bool(true),
BinaryLogEnabled: pulumi.Bool(true),
},
AvailabilityType: pulumi.String("REGIONAL"),
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.sql.DatabaseInstance;
import com.pulumi.gcp.sql.DatabaseInstanceArgs;
import com.pulumi.gcp.sql.inputs.DatabaseInstanceSettingsArgs;
import com.pulumi.gcp.sql.inputs.DatabaseInstanceSettingsIpConfigurationArgs;
import com.pulumi.gcp.sql.inputs.DatabaseInstanceSettingsBackupConfigurationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var main = new DatabaseInstance("main", DatabaseInstanceArgs.builder()
.name("psc-enabled-main-instance")
.databaseVersion("MYSQL_8_0")
.settings(DatabaseInstanceSettingsArgs.builder()
.tier("db-f1-micro")
.ipConfiguration(DatabaseInstanceSettingsIpConfigurationArgs.builder()
.pscConfigs(DatabaseInstanceSettingsIpConfigurationPscConfigArgs.builder()
.pscEnabled(true)
.allowedConsumerProjects("allowed-consumer-project-name")
.build())
.ipv4Enabled(false)
.build())
.backupConfiguration(DatabaseInstanceSettingsBackupConfigurationArgs.builder()
.enabled(true)
.binaryLogEnabled(true)
.build())
.availabilityType("REGIONAL")
.build())
.build());
}
}
resources:
main:
type: gcp:sql:DatabaseInstance
properties:
name: psc-enabled-main-instance
databaseVersion: MYSQL_8_0
settings:
tier: db-f1-micro
ipConfiguration:
pscConfigs:
- pscEnabled: true
allowedConsumerProjects:
- allowed-consumer-project-name
ipv4Enabled: false
backupConfiguration:
enabled: true
binaryLogEnabled: true
availabilityType: REGIONAL
Import
Database instances can be imported using one of any of these accepted formats:
projects/{{project}}/instances/{{name}}
{{project}}/{{name}}
{{name}}
When using thepulumi import
command, Database instances can be imported using one of the formats above. For example:
$ pulumi import gcp:sql/databaseInstance:DatabaseInstance default projects/{{project}}/instances/{{name}}
$ pulumi import gcp:sql/databaseInstance:DatabaseInstance default {{project}}/{{name}}
$ pulumi import gcp:sql/databaseInstance:DatabaseInstance default {{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.
Properties
The list of all maintenance versions applicable on the instance.
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.
The connection name of the instance to be used in connection strings. For example, when connecting with Cloud SQL Proxy.
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
, POSTGRES_15
, 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.
Whether or not to allow the 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. Defaults to true
.
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.
The first IPv4 address of any type assigned.
The type of the instance. The supported values are SQL_INSTANCE_TYPE_UNSPECIFIED
, CLOUD_SQL_INSTANCE
, ON_PREMISES_INSTANCE
and READ_REPLICA_INSTANCE
.
The current software version on the instance. This attribute can not be set during creation. Refer to available_maintenance_versions
attribute to see what maintenance_version
are available for upgrade. When this attribute gets updated, it will cause an instance restart. Setting a maintenance_version
value that is older than the current one on the instance will be ignored.
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.
The first private (PRIVATE
) IPv4 address assigned.
the URI that points to the service attachment of the instance.
The first public (PRIMARY
) IPv4 address assigned.
The configuration for replication. The configuration is detailed below. Valid only for MySQL instances.
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.
Initial root password. Can be updated. Required for MS SQL Server.
The service account email address assigned to the instance.
The settings to use for the database. The configuration is detailed below. Required if clone
is not set.