All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.gcp.sql.kotlin.DatabaseInstanceArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 8.20.1.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.sql.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.sql.DatabaseInstanceArgs.builder
import com.pulumi.gcp.sql.kotlin.inputs.DatabaseInstanceCloneArgs
import com.pulumi.gcp.sql.kotlin.inputs.DatabaseInstanceCloneArgsBuilder
import com.pulumi.gcp.sql.kotlin.inputs.DatabaseInstanceReplicaConfigurationArgs
import com.pulumi.gcp.sql.kotlin.inputs.DatabaseInstanceReplicaConfigurationArgsBuilder
import com.pulumi.gcp.sql.kotlin.inputs.DatabaseInstanceRestoreBackupContextArgs
import com.pulumi.gcp.sql.kotlin.inputs.DatabaseInstanceRestoreBackupContextArgsBuilder
import com.pulumi.gcp.sql.kotlin.inputs.DatabaseInstanceSettingsArgs
import com.pulumi.gcp.sql.kotlin.inputs.DatabaseInstanceSettingsArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Creates a new Google SQL Database Instance. For more information, see the [official documentation](https://cloud.google.com/sql/),
 * or the [JSON API](https://cloud.google.com/sql/docs/admin-api/v1beta4/instances).
 * > **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
 * 
 * ```typescript
 * 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",
 *     },
 * });
 * ```
 * ```python
 * 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",
 *     })
 * ```
 * ```csharp
 * 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",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v8/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
 * 	})
 * }
 * ```
 * ```java
 * 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());
 *     }
 * }
 * ```
 * ```yaml
 * 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 from `gcp.servicenetworking.Connection`. You must explicitly add a `depends_on`reference as shown below.
 * 
 * ```typescript
 * 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],
 * });
 * ```
 * ```python
 * 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]))
 * ```
 * ```csharp
 * 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,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"fmt"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/compute"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/servicenetworking"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v8/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
 * 	})
 * }
 * ```
 * ```java
 * 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());
 *     }
 * }
 * ```
 * ```yaml
 * 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
 * 
 * ```typescript
 * 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,
 *         },
 *     },
 * });
 * ```
 * ```python
 * 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,
 *         },
 *     })
 * ```
 * ```csharp
 * 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,
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v8/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
 * 	})
 * }
 * ```
 * ```java
 * 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());
 *     }
 * }
 * ```
 * ```yaml
 * 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
 * 
 * ```typescript
 * 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",
 *     },
 * });
 * ```
 * ```python
 * 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",
 *     })
 * ```
 * ```csharp
 * 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",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v8/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
 * 	})
 * }
 * ```
 * ```java
 * 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());
 *     }
 * }
 * ```
 * ```yaml
 * 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
 * ```
 * 
 * ### Cloud SQL Instance with PSC auto connections
 * 
 * ```typescript
 * 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"],
 *                 pscAutoConnections: [{
 *                     consumerNetwork: "network-name",
 *                     consumerServiceProjectId: "project-id",
 *                 }],
 *             }],
 *             ipv4Enabled: false,
 *         },
 *         backupConfiguration: {
 *             enabled: true,
 *             binaryLogEnabled: true,
 *         },
 *         availabilityType: "REGIONAL",
 *     },
 * });
 * ```
 * ```python
 * 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"],
 *                 "psc_auto_connections": [{
 *                     "consumer_network": "network-name",
 *                     "consumer_service_project_id": "project-id",
 *                 }],
 *             }],
 *             "ipv4_enabled": False,
 *         },
 *         "backup_configuration": {
 *             "enabled": True,
 *             "binary_log_enabled": True,
 *         },
 *         "availability_type": "REGIONAL",
 *     })
 * ```
 * ```csharp
 * 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",
 *                         },
 *                         PscAutoConnections = new[]
 *                         {
 *                             new Gcp.Sql.Inputs.DatabaseInstanceSettingsIpConfigurationPscConfigPscAutoConnectionArgs
 *                             {
 *                                 ConsumerNetwork = "network-name",
 *                                 ConsumerServiceProjectId = "project-id",
 *                             },
 *                         },
 *                     },
 *                 },
 *                 Ipv4Enabled = false,
 *             },
 *             BackupConfiguration = new Gcp.Sql.Inputs.DatabaseInstanceSettingsBackupConfigurationArgs
 *             {
 *                 Enabled = true,
 *                 BinaryLogEnabled = true,
 *             },
 *             AvailabilityType = "REGIONAL",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v8/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"),
 * 							},
 * 							PscAutoConnections: sql.DatabaseInstanceSettingsIpConfigurationPscConfigPscAutoConnectionArray{
 * 								&sql.DatabaseInstanceSettingsIpConfigurationPscConfigPscAutoConnectionArgs{
 * 									ConsumerNetwork:          pulumi.String("network-name"),
 * 									ConsumerServiceProjectId: pulumi.String("project-id"),
 * 								},
 * 							},
 * 						},
 * 					},
 * 					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
 * 	})
 * }
 * ```
 * ```java
 * 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")
 *                         .pscAutoConnections(DatabaseInstanceSettingsIpConfigurationPscConfigPscAutoConnectionArgs.builder()
 *                             .consumerNetwork("network-name")
 *                             .consumerServiceProjectId("project-id")
 *                             .build())
 *                         .build())
 *                     .ipv4Enabled(false)
 *                     .build())
 *                 .backupConfiguration(DatabaseInstanceSettingsBackupConfigurationArgs.builder()
 *                     .enabled(true)
 *                     .binaryLogEnabled(true)
 *                     .build())
 *                 .availabilityType("REGIONAL")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * 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
 *               pscAutoConnections:
 *                 - consumerNetwork: network-name
 *                   consumerServiceProjectId: project-id
 *           ipv4Enabled: false
 *         backupConfiguration:
 *           enabled: true
 *           binaryLogEnabled: true
 *         availabilityType: REGIONAL
 * ```
 * 
 * ## Switchover (SQL Server Only)
 * Users can perform a switchover on any direct `cascadable` replica by following the steps below.
 *   ~>**WARNING:** Failure to follow these steps can lead to data loss (You will be warned during plan stage). To prevent data loss during a switchover, please verify your plan with the checklist below.
 * For a more in-depth walkthrough with example code, see the Switchover Guide
 * ### Steps to Invoke Switchover
 * Create a `cascadable` replica in a different region from the primary (`cascadable_replica` is set to true in `replica_configuration`)
 * #### Invoking switchover in the replica resource:
 * 1. Change instance_type from `READ_REPLICA_INSTANCE` to `CLOUD_SQL_INSTANCE`
 * 2. Remove `master_instance_name`
 * 3. Remove `replica_configuration`
 * 4. Add current primary's name to the replica's `replica_names` list
 * #### Updating the primary resource:
 * 1. Change `instance_type` from `CLOUD_SQL_INSTANCE` to `READ_REPLICA_INSTANCE`
 * 2. Set `master_instance_name` to the original replica (which will be primary after switchover)
 * 3. Set `replica_configuration` and set `cascadable_replica` to `true`
 * 4. Remove original replica from `replica_names`
 *     > **NOTE**: Do **not** delete the replica_names field, even if it has no replicas remaining. Set replica_names = [ ] to indicate it having no replicas.
 * #### Plan and verify that:
 * - `pulumi preview` outputs **"0 to add, 0 to destroy"**
 * - `pulumi preview` does not say **"must be replaced"** for any resource
 * - Every resource **"will be updated in-place"**
 * - Only the 2 instances involved in switchover have planned changes
 * - (Recommended) Use `deletion_protection` on instances as a safety measure
 * ## Import
 * Database instances can be imported using one of any of these accepted formats:
 * * `projects/{{project}}/instances/{{name}}`
 * * `{{project}}/{{name}}`
 * * `{{name}}`
 * When using the `pulumi import` command, Database instances can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:sql/databaseInstance:DatabaseInstance default projects/{{project}}/instances/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:sql/databaseInstance:DatabaseInstance default {{project}}/{{name}}
 * ```
 * ```sh
 * $ 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.
 * @property clone 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.
 * @property databaseVersion 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`, `POSTGRES_16`, `POSTGRES_17`,
 * `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](https://cloud.google.com/sql/docs/db-versions)
 * includes an up-to-date reference of supported versions.
 * @property deletionProtection 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`.
 * @property encryptionKeyName 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](https://cloud.google.com/sql/docs/mysql/configure-cmek#service-account).
 * That service account needs the `Cloud KMS > Cloud KMS CryptoKey Encrypter/Decrypter` role on your
 * key - please see [this step](https://cloud.google.com/sql/docs/mysql/configure-cmek#grantkey).
 * @property instanceType The type of the instance. The supported values are `SQL_INSTANCE_TYPE_UNSPECIFIED`, `CLOUD_SQL_INSTANCE`, `ON_PREMISES_INSTANCE` and `READ_REPLICA_INSTANCE`.
 * @property maintenanceVersion 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.
 * @property masterInstanceName 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.
 * @property name The name of the instance. If the name is left
 * blank, the provider will randomly generate one when the instance is first
 * created. This is done because after a name is used, it cannot be reused for
 * up to [one week](https://cloud.google.com/sql/docs/delete-instance).
 * @property project The ID of the project in which the resource belongs. If it
 * is not provided, the provider project is used.
 * @property region The region the instance will sit in. If a region is not provided in the resource definition,
 * the provider region will be used instead.
 * - - -
 * @property replicaConfiguration The configuration for replication. The
 * configuration is detailed below.
 * @property replicaNames List of replica names. Can be updated.
 * @property restoreBackupContext 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.
 * @property rootPassword Initial root password. Can be updated. Required for MS SQL Server.
 * @property settings The settings to use for the database. The
 * configuration is detailed below. Required if `clone` is not set.
 */
public data class DatabaseInstanceArgs(
    public val clone: Output? = null,
    public val databaseVersion: Output? = null,
    public val deletionProtection: Output? = null,
    public val encryptionKeyName: Output? = null,
    public val instanceType: Output? = null,
    public val maintenanceVersion: Output? = null,
    public val masterInstanceName: Output? = null,
    public val name: Output? = null,
    public val project: Output? = null,
    public val region: Output? = null,
    public val replicaConfiguration: Output? = null,
    public val replicaNames: Output>? = null,
    public val restoreBackupContext: Output? = null,
    public val rootPassword: Output? = null,
    public val settings: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.sql.DatabaseInstanceArgs =
        com.pulumi.gcp.sql.DatabaseInstanceArgs.builder()
            .clone_(clone?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .databaseVersion(databaseVersion?.applyValue({ args0 -> args0 }))
            .deletionProtection(deletionProtection?.applyValue({ args0 -> args0 }))
            .encryptionKeyName(encryptionKeyName?.applyValue({ args0 -> args0 }))
            .instanceType(instanceType?.applyValue({ args0 -> args0 }))
            .maintenanceVersion(maintenanceVersion?.applyValue({ args0 -> args0 }))
            .masterInstanceName(masterInstanceName?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .project(project?.applyValue({ args0 -> args0 }))
            .region(region?.applyValue({ args0 -> args0 }))
            .replicaConfiguration(
                replicaConfiguration?.applyValue({ args0 ->
                    args0.let({ args0 ->
                        args0.toJava()
                    })
                }),
            )
            .replicaNames(replicaNames?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .restoreBackupContext(
                restoreBackupContext?.applyValue({ args0 ->
                    args0.let({ args0 ->
                        args0.toJava()
                    })
                }),
            )
            .rootPassword(rootPassword?.applyValue({ args0 -> args0 }))
            .settings(settings?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) })).build()
}

/**
 * Builder for [DatabaseInstanceArgs].
 */
@PulumiTagMarker
public class DatabaseInstanceArgsBuilder internal constructor() {
    private var clone: Output? = null

    private var databaseVersion: Output? = null

    private var deletionProtection: Output? = null

    private var encryptionKeyName: Output? = null

    private var instanceType: Output? = null

    private var maintenanceVersion: Output? = null

    private var masterInstanceName: Output? = null

    private var name: Output? = null

    private var project: Output? = null

    private var region: Output? = null

    private var replicaConfiguration: Output? = null

    private var replicaNames: Output>? = null

    private var restoreBackupContext: Output? = null

    private var rootPassword: Output? = null

    private var settings: Output? = null

    /**
     * @param value 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.
     */
    @JvmName("ixtwpekfxtoiubuv")
    public suspend fun clone(`value`: Output) {
        this.clone = value
    }

    /**
     * @param value 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`, `POSTGRES_16`, `POSTGRES_17`,
     * `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](https://cloud.google.com/sql/docs/db-versions)
     * includes an up-to-date reference of supported versions.
     */
    @JvmName("sakprqqbnnohmenu")
    public suspend fun databaseVersion(`value`: Output) {
        this.databaseVersion = value
    }

    /**
     * @param value 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`.
     */
    @JvmName("xgurbqeksydrwbbc")
    public suspend fun deletionProtection(`value`: Output) {
        this.deletionProtection = value
    }

    /**
     * @param value 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](https://cloud.google.com/sql/docs/mysql/configure-cmek#service-account).
     * That service account needs the `Cloud KMS > Cloud KMS CryptoKey Encrypter/Decrypter` role on your
     * key - please see [this step](https://cloud.google.com/sql/docs/mysql/configure-cmek#grantkey).
     */
    @JvmName("kgsphibvbsfvqjou")
    public suspend fun encryptionKeyName(`value`: Output) {
        this.encryptionKeyName = value
    }

    /**
     * @param value The type of the instance. The supported values are `SQL_INSTANCE_TYPE_UNSPECIFIED`, `CLOUD_SQL_INSTANCE`, `ON_PREMISES_INSTANCE` and `READ_REPLICA_INSTANCE`.
     */
    @JvmName("mjfdxubapasvoget")
    public suspend fun instanceType(`value`: Output) {
        this.instanceType = value
    }

    /**
     * @param value 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.
     */
    @JvmName("trxtolbstnskbijq")
    public suspend fun maintenanceVersion(`value`: Output) {
        this.maintenanceVersion = value
    }

    /**
     * @param value 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.
     */
    @JvmName("ajpptoncmoinnoin")
    public suspend fun masterInstanceName(`value`: Output) {
        this.masterInstanceName = value
    }

    /**
     * @param value The name of the instance. If the name is left
     * blank, the provider will randomly generate one when the instance is first
     * created. This is done because after a name is used, it cannot be reused for
     * up to [one week](https://cloud.google.com/sql/docs/delete-instance).
     */
    @JvmName("sbujbfastebbxufo")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The ID of the project in which the resource belongs. If it
     * is not provided, the provider project is used.
     */
    @JvmName("uevxrlrriwiawupp")
    public suspend fun project(`value`: Output) {
        this.project = value
    }

    /**
     * @param value The region the instance will sit in. If a region is not provided in the resource definition,
     * the provider region will be used instead.
     * - - -
     */
    @JvmName("rverhsjwiaawhimb")
    public suspend fun region(`value`: Output) {
        this.region = value
    }

    /**
     * @param value The configuration for replication. The
     * configuration is detailed below.
     */
    @JvmName("khfkfwnnsdpgpbmx")
    public suspend fun replicaConfiguration(`value`: Output) {
        this.replicaConfiguration = value
    }

    /**
     * @param value List of replica names. Can be updated.
     */
    @JvmName("tcvbhmgxwjaoqqhl")
    public suspend fun replicaNames(`value`: Output>) {
        this.replicaNames = value
    }

    @JvmName("truyfyvicaqflply")
    public suspend fun replicaNames(vararg values: Output) {
        this.replicaNames = Output.all(values.asList())
    }

    /**
     * @param values List of replica names. Can be updated.
     */
    @JvmName("uymagceeknykslrx")
    public suspend fun replicaNames(values: List>) {
        this.replicaNames = Output.all(values)
    }

    /**
     * @param value 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.
     */
    @JvmName("tarnnoqvmsrcjnca")
    public suspend fun restoreBackupContext(`value`: Output) {
        this.restoreBackupContext = value
    }

    /**
     * @param value Initial root password. Can be updated. Required for MS SQL Server.
     */
    @JvmName("sxaaketvvgnsvytv")
    public suspend fun rootPassword(`value`: Output) {
        this.rootPassword = value
    }

    /**
     * @param value The settings to use for the database. The
     * configuration is detailed below. Required if `clone` is not set.
     */
    @JvmName("plnvtkidcqnyhtja")
    public suspend fun settings(`value`: Output) {
        this.settings = value
    }

    /**
     * @param value 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.
     */
    @JvmName("wjbcviiyyymhytvh")
    public suspend fun clone(`value`: DatabaseInstanceCloneArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.clone = mapped
    }

    /**
     * @param argument 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.
     */
    @JvmName("qdjxttfmuaskbcsx")
    public suspend fun clone(argument: suspend DatabaseInstanceCloneArgsBuilder.() -> Unit) {
        val toBeMapped = DatabaseInstanceCloneArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.clone = mapped
    }

    /**
     * @param value 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`, `POSTGRES_16`, `POSTGRES_17`,
     * `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](https://cloud.google.com/sql/docs/db-versions)
     * includes an up-to-date reference of supported versions.
     */
    @JvmName("xqouqcpgtekrhwmx")
    public suspend fun databaseVersion(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.databaseVersion = mapped
    }

    /**
     * @param value 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`.
     */
    @JvmName("apnbcrdymdmtdgnw")
    public suspend fun deletionProtection(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.deletionProtection = mapped
    }

    /**
     * @param value 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](https://cloud.google.com/sql/docs/mysql/configure-cmek#service-account).
     * That service account needs the `Cloud KMS > Cloud KMS CryptoKey Encrypter/Decrypter` role on your
     * key - please see [this step](https://cloud.google.com/sql/docs/mysql/configure-cmek#grantkey).
     */
    @JvmName("ifcsvbbwytabketf")
    public suspend fun encryptionKeyName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.encryptionKeyName = mapped
    }

    /**
     * @param value The type of the instance. The supported values are `SQL_INSTANCE_TYPE_UNSPECIFIED`, `CLOUD_SQL_INSTANCE`, `ON_PREMISES_INSTANCE` and `READ_REPLICA_INSTANCE`.
     */
    @JvmName("rhhvuchlnkimkkrg")
    public suspend fun instanceType(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.instanceType = mapped
    }

    /**
     * @param value 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.
     */
    @JvmName("vyvmbujmdayqqfse")
    public suspend fun maintenanceVersion(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.maintenanceVersion = mapped
    }

    /**
     * @param value 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.
     */
    @JvmName("vcykdxovwaqwvqqt")
    public suspend fun masterInstanceName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.masterInstanceName = mapped
    }

    /**
     * @param value The name of the instance. If the name is left
     * blank, the provider will randomly generate one when the instance is first
     * created. This is done because after a name is used, it cannot be reused for
     * up to [one week](https://cloud.google.com/sql/docs/delete-instance).
     */
    @JvmName("vphfvincbhpnoqbp")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value The ID of the project in which the resource belongs. If it
     * is not provided, the provider project is used.
     */
    @JvmName("oryahynqtqotilgd")
    public suspend fun project(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.project = mapped
    }

    /**
     * @param value The region the instance will sit in. If a region is not provided in the resource definition,
     * the provider region will be used instead.
     * - - -
     */
    @JvmName("mlpdbpcjsbdgwity")
    public suspend fun region(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.region = mapped
    }

    /**
     * @param value The configuration for replication. The
     * configuration is detailed below.
     */
    @JvmName("xfbustcpfrpxngfg")
    public suspend fun replicaConfiguration(`value`: DatabaseInstanceReplicaConfigurationArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.replicaConfiguration = mapped
    }

    /**
     * @param argument The configuration for replication. The
     * configuration is detailed below.
     */
    @JvmName("yugikslffvfhuxfu")
    public suspend fun replicaConfiguration(argument: suspend DatabaseInstanceReplicaConfigurationArgsBuilder.() -> Unit) {
        val toBeMapped = DatabaseInstanceReplicaConfigurationArgsBuilder().applySuspend {
            argument()
        }.build()
        val mapped = of(toBeMapped)
        this.replicaConfiguration = mapped
    }

    /**
     * @param value List of replica names. Can be updated.
     */
    @JvmName("gafrklxrhtdwmpbp")
    public suspend fun replicaNames(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.replicaNames = mapped
    }

    /**
     * @param values List of replica names. Can be updated.
     */
    @JvmName("adrsxfalloahxxup")
    public suspend fun replicaNames(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.replicaNames = mapped
    }

    /**
     * @param value 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.
     */
    @JvmName("rfwiffvndmkxvgdy")
    public suspend fun restoreBackupContext(`value`: DatabaseInstanceRestoreBackupContextArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.restoreBackupContext = mapped
    }

    /**
     * @param argument 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.
     */
    @JvmName("soelvwwdxbbfmlxm")
    public suspend fun restoreBackupContext(argument: suspend DatabaseInstanceRestoreBackupContextArgsBuilder.() -> Unit) {
        val toBeMapped = DatabaseInstanceRestoreBackupContextArgsBuilder().applySuspend {
            argument()
        }.build()
        val mapped = of(toBeMapped)
        this.restoreBackupContext = mapped
    }

    /**
     * @param value Initial root password. Can be updated. Required for MS SQL Server.
     */
    @JvmName("brrijptelxdigpdr")
    public suspend fun rootPassword(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.rootPassword = mapped
    }

    /**
     * @param value The settings to use for the database. The
     * configuration is detailed below. Required if `clone` is not set.
     */
    @JvmName("hrwcbufohejlryxb")
    public suspend fun settings(`value`: DatabaseInstanceSettingsArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.settings = mapped
    }

    /**
     * @param argument The settings to use for the database. The
     * configuration is detailed below. Required if `clone` is not set.
     */
    @JvmName("hekqvsjilshrvcab")
    public suspend fun settings(argument: suspend DatabaseInstanceSettingsArgsBuilder.() -> Unit) {
        val toBeMapped = DatabaseInstanceSettingsArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.settings = mapped
    }

    internal fun build(): DatabaseInstanceArgs = DatabaseInstanceArgs(
        clone = clone,
        databaseVersion = databaseVersion,
        deletionProtection = deletionProtection,
        encryptionKeyName = encryptionKeyName,
        instanceType = instanceType,
        maintenanceVersion = maintenanceVersion,
        masterInstanceName = masterInstanceName,
        name = name,
        project = project,
        region = region,
        replicaConfiguration = replicaConfiguration,
        replicaNames = replicaNames,
        restoreBackupContext = restoreBackupContext,
        rootPassword = rootPassword,
        settings = settings,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy