1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. sql
  5. Database
Google Cloud Classic v8.8.0 published on Thursday, Nov 7, 2024 by Pulumi

gcp.sql.Database

Explore with Pulumi AI

gcp logo
Google Cloud Classic v8.8.0 published on Thursday, Nov 7, 2024 by Pulumi

    Represents a SQL database inside the Cloud SQL instance, hosted in Google’s cloud.

    Example Usage

    Sql Database Basic

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    // See versions at https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_database_instance#database_version
    const instance = new gcp.sql.DatabaseInstance("instance", {
        name: "my-database-instance",
        region: "us-central1",
        databaseVersion: "MYSQL_8_0",
        settings: {
            tier: "db-f1-micro",
        },
        deletionProtection: true,
    });
    const database = new gcp.sql.Database("database", {
        name: "my-database",
        instance: instance.name,
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    # See versions at https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_database_instance#database_version
    instance = gcp.sql.DatabaseInstance("instance",
        name="my-database-instance",
        region="us-central1",
        database_version="MYSQL_8_0",
        settings={
            "tier": "db-f1-micro",
        },
        deletion_protection=True)
    database = gcp.sql.Database("database",
        name="my-database",
        instance=instance.name)
    
    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 {
    		// See versions at https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_database_instance#database_version
    		instance, err := sql.NewDatabaseInstance(ctx, "instance", &sql.DatabaseInstanceArgs{
    			Name:            pulumi.String("my-database-instance"),
    			Region:          pulumi.String("us-central1"),
    			DatabaseVersion: pulumi.String("MYSQL_8_0"),
    			Settings: &sql.DatabaseInstanceSettingsArgs{
    				Tier: pulumi.String("db-f1-micro"),
    			},
    			DeletionProtection: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = sql.NewDatabase(ctx, "database", &sql.DatabaseArgs{
    			Name:     pulumi.String("my-database"),
    			Instance: instance.Name,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        // See versions at https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_database_instance#database_version
        var instance = new Gcp.Sql.DatabaseInstance("instance", new()
        {
            Name = "my-database-instance",
            Region = "us-central1",
            DatabaseVersion = "MYSQL_8_0",
            Settings = new Gcp.Sql.Inputs.DatabaseInstanceSettingsArgs
            {
                Tier = "db-f1-micro",
            },
            DeletionProtection = true,
        });
    
        var database = new Gcp.Sql.Database("database", new()
        {
            Name = "my-database",
            Instance = instance.Name,
        });
    
    });
    
    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.Database;
    import com.pulumi.gcp.sql.DatabaseArgs;
    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) {
            // See versions at https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_database_instance#database_version
            var instance = new DatabaseInstance("instance", DatabaseInstanceArgs.builder()
                .name("my-database-instance")
                .region("us-central1")
                .databaseVersion("MYSQL_8_0")
                .settings(DatabaseInstanceSettingsArgs.builder()
                    .tier("db-f1-micro")
                    .build())
                .deletionProtection(true)
                .build());
    
            var database = new Database("database", DatabaseArgs.builder()
                .name("my-database")
                .instance(instance.name())
                .build());
    
        }
    }
    
    resources:
      database:
        type: gcp:sql:Database
        properties:
          name: my-database
          instance: ${instance.name}
      # See versions at https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_database_instance#database_version
      instance:
        type: gcp:sql:DatabaseInstance
        properties:
          name: my-database-instance
          region: us-central1
          databaseVersion: MYSQL_8_0
          settings:
            tier: db-f1-micro
          deletionProtection: true
    

    Sql Database Deletion Policy

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    // See versions at https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_database_instance#database_version
    const instance = new gcp.sql.DatabaseInstance("instance", {
        name: "my-database-instance",
        region: "us-central1",
        databaseVersion: "POSTGRES_14",
        settings: {
            tier: "db-g1-small",
        },
        deletionProtection: true,
    });
    const databaseDeletionPolicy = new gcp.sql.Database("database_deletion_policy", {
        name: "my-database",
        instance: instance.name,
        deletionPolicy: "ABANDON",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    # See versions at https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_database_instance#database_version
    instance = gcp.sql.DatabaseInstance("instance",
        name="my-database-instance",
        region="us-central1",
        database_version="POSTGRES_14",
        settings={
            "tier": "db-g1-small",
        },
        deletion_protection=True)
    database_deletion_policy = gcp.sql.Database("database_deletion_policy",
        name="my-database",
        instance=instance.name,
        deletion_policy="ABANDON")
    
    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 {
    		// See versions at https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_database_instance#database_version
    		instance, err := sql.NewDatabaseInstance(ctx, "instance", &sql.DatabaseInstanceArgs{
    			Name:            pulumi.String("my-database-instance"),
    			Region:          pulumi.String("us-central1"),
    			DatabaseVersion: pulumi.String("POSTGRES_14"),
    			Settings: &sql.DatabaseInstanceSettingsArgs{
    				Tier: pulumi.String("db-g1-small"),
    			},
    			DeletionProtection: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = sql.NewDatabase(ctx, "database_deletion_policy", &sql.DatabaseArgs{
    			Name:           pulumi.String("my-database"),
    			Instance:       instance.Name,
    			DeletionPolicy: pulumi.String("ABANDON"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        // See versions at https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_database_instance#database_version
        var instance = new Gcp.Sql.DatabaseInstance("instance", new()
        {
            Name = "my-database-instance",
            Region = "us-central1",
            DatabaseVersion = "POSTGRES_14",
            Settings = new Gcp.Sql.Inputs.DatabaseInstanceSettingsArgs
            {
                Tier = "db-g1-small",
            },
            DeletionProtection = true,
        });
    
        var databaseDeletionPolicy = new Gcp.Sql.Database("database_deletion_policy", new()
        {
            Name = "my-database",
            Instance = instance.Name,
            DeletionPolicy = "ABANDON",
        });
    
    });
    
    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.Database;
    import com.pulumi.gcp.sql.DatabaseArgs;
    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) {
            // See versions at https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_database_instance#database_version
            var instance = new DatabaseInstance("instance", DatabaseInstanceArgs.builder()
                .name("my-database-instance")
                .region("us-central1")
                .databaseVersion("POSTGRES_14")
                .settings(DatabaseInstanceSettingsArgs.builder()
                    .tier("db-g1-small")
                    .build())
                .deletionProtection(true)
                .build());
    
            var databaseDeletionPolicy = new Database("databaseDeletionPolicy", DatabaseArgs.builder()
                .name("my-database")
                .instance(instance.name())
                .deletionPolicy("ABANDON")
                .build());
    
        }
    }
    
    resources:
      databaseDeletionPolicy:
        type: gcp:sql:Database
        name: database_deletion_policy
        properties:
          name: my-database
          instance: ${instance.name}
          deletionPolicy: ABANDON
      # See versions at https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_database_instance#database_version
      instance:
        type: gcp:sql:DatabaseInstance
        properties:
          name: my-database-instance
          region: us-central1
          databaseVersion: POSTGRES_14
          settings:
            tier: db-g1-small
          deletionProtection: true
    

    Create Database Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Database(name: string, args: DatabaseArgs, opts?: CustomResourceOptions);
    @overload
    def Database(resource_name: str,
                 args: DatabaseArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def Database(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 instance: Optional[str] = None,
                 charset: Optional[str] = None,
                 collation: Optional[str] = None,
                 deletion_policy: Optional[str] = None,
                 name: Optional[str] = None,
                 project: Optional[str] = None)
    func NewDatabase(ctx *Context, name string, args DatabaseArgs, opts ...ResourceOption) (*Database, error)
    public Database(string name, DatabaseArgs args, CustomResourceOptions? opts = null)
    public Database(String name, DatabaseArgs args)
    public Database(String name, DatabaseArgs args, CustomResourceOptions options)
    
    type: gcp:sql:Database
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

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

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var exampledatabaseResourceResourceFromSqldatabase = new Gcp.Sql.Database("exampledatabaseResourceResourceFromSqldatabase", new()
    {
        Instance = "string",
        Charset = "string",
        Collation = "string",
        DeletionPolicy = "string",
        Name = "string",
        Project = "string",
    });
    
    example, err := sql.NewDatabase(ctx, "exampledatabaseResourceResourceFromSqldatabase", &sql.DatabaseArgs{
    	Instance:       pulumi.String("string"),
    	Charset:        pulumi.String("string"),
    	Collation:      pulumi.String("string"),
    	DeletionPolicy: pulumi.String("string"),
    	Name:           pulumi.String("string"),
    	Project:        pulumi.String("string"),
    })
    
    var exampledatabaseResourceResourceFromSqldatabase = new Database("exampledatabaseResourceResourceFromSqldatabase", DatabaseArgs.builder()
        .instance("string")
        .charset("string")
        .collation("string")
        .deletionPolicy("string")
        .name("string")
        .project("string")
        .build());
    
    exampledatabase_resource_resource_from_sqldatabase = gcp.sql.Database("exampledatabaseResourceResourceFromSqldatabase",
        instance="string",
        charset="string",
        collation="string",
        deletion_policy="string",
        name="string",
        project="string")
    
    const exampledatabaseResourceResourceFromSqldatabase = new gcp.sql.Database("exampledatabaseResourceResourceFromSqldatabase", {
        instance: "string",
        charset: "string",
        collation: "string",
        deletionPolicy: "string",
        name: "string",
        project: "string",
    });
    
    type: gcp:sql:Database
    properties:
        charset: string
        collation: string
        deletionPolicy: string
        instance: string
        name: string
        project: string
    

    Database Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Database resource accepts the following input properties:

    Instance string
    The name of the Cloud SQL instance. This does not include the project ID.


    Charset string
    The charset value. See MySQL's Supported Character Sets and Collations and Postgres' Character Set Support for more details and supported values. Postgres databases only support a value of UTF8 at creation time.
    Collation string
    The collation value. See MySQL's Supported Character Sets and Collations and Postgres' Collation Support for more details and supported values. Postgres databases only support a value of en_US.UTF8 at creation time.
    DeletionPolicy string
    The deletion policy for the database. Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for Postgres, where databases cannot be deleted from the API if there are users other than cloudsqlsuperuser with access. Possible values are: "ABANDON", "DELETE". Defaults to "DELETE".
    Name string
    The name of the database in the Cloud SQL instance. This does not include the project ID or instance name.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Instance string
    The name of the Cloud SQL instance. This does not include the project ID.


    Charset string
    The charset value. See MySQL's Supported Character Sets and Collations and Postgres' Character Set Support for more details and supported values. Postgres databases only support a value of UTF8 at creation time.
    Collation string
    The collation value. See MySQL's Supported Character Sets and Collations and Postgres' Collation Support for more details and supported values. Postgres databases only support a value of en_US.UTF8 at creation time.
    DeletionPolicy string
    The deletion policy for the database. Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for Postgres, where databases cannot be deleted from the API if there are users other than cloudsqlsuperuser with access. Possible values are: "ABANDON", "DELETE". Defaults to "DELETE".
    Name string
    The name of the database in the Cloud SQL instance. This does not include the project ID or instance name.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    instance String
    The name of the Cloud SQL instance. This does not include the project ID.


    charset String
    The charset value. See MySQL's Supported Character Sets and Collations and Postgres' Character Set Support for more details and supported values. Postgres databases only support a value of UTF8 at creation time.
    collation String
    The collation value. See MySQL's Supported Character Sets and Collations and Postgres' Collation Support for more details and supported values. Postgres databases only support a value of en_US.UTF8 at creation time.
    deletionPolicy String
    The deletion policy for the database. Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for Postgres, where databases cannot be deleted from the API if there are users other than cloudsqlsuperuser with access. Possible values are: "ABANDON", "DELETE". Defaults to "DELETE".
    name String
    The name of the database in the Cloud SQL instance. This does not include the project ID or instance name.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    instance string
    The name of the Cloud SQL instance. This does not include the project ID.


    charset string
    The charset value. See MySQL's Supported Character Sets and Collations and Postgres' Character Set Support for more details and supported values. Postgres databases only support a value of UTF8 at creation time.
    collation string
    The collation value. See MySQL's Supported Character Sets and Collations and Postgres' Collation Support for more details and supported values. Postgres databases only support a value of en_US.UTF8 at creation time.
    deletionPolicy string
    The deletion policy for the database. Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for Postgres, where databases cannot be deleted from the API if there are users other than cloudsqlsuperuser with access. Possible values are: "ABANDON", "DELETE". Defaults to "DELETE".
    name string
    The name of the database in the Cloud SQL instance. This does not include the project ID or instance name.
    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    instance str
    The name of the Cloud SQL instance. This does not include the project ID.


    charset str
    The charset value. See MySQL's Supported Character Sets and Collations and Postgres' Character Set Support for more details and supported values. Postgres databases only support a value of UTF8 at creation time.
    collation str
    The collation value. See MySQL's Supported Character Sets and Collations and Postgres' Collation Support for more details and supported values. Postgres databases only support a value of en_US.UTF8 at creation time.
    deletion_policy str
    The deletion policy for the database. Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for Postgres, where databases cannot be deleted from the API if there are users other than cloudsqlsuperuser with access. Possible values are: "ABANDON", "DELETE". Defaults to "DELETE".
    name str
    The name of the database in the Cloud SQL instance. This does not include the project ID or instance name.
    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    instance String
    The name of the Cloud SQL instance. This does not include the project ID.


    charset String
    The charset value. See MySQL's Supported Character Sets and Collations and Postgres' Character Set Support for more details and supported values. Postgres databases only support a value of UTF8 at creation time.
    collation String
    The collation value. See MySQL's Supported Character Sets and Collations and Postgres' Collation Support for more details and supported values. Postgres databases only support a value of en_US.UTF8 at creation time.
    deletionPolicy String
    The deletion policy for the database. Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for Postgres, where databases cannot be deleted from the API if there are users other than cloudsqlsuperuser with access. Possible values are: "ABANDON", "DELETE". Defaults to "DELETE".
    name String
    The name of the database in the Cloud SQL instance. This does not include the project ID or instance name.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    SelfLink string
    The URI of the created resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    SelfLink string
    The URI of the created resource.
    id String
    The provider-assigned unique ID for this managed resource.
    selfLink String
    The URI of the created resource.
    id string
    The provider-assigned unique ID for this managed resource.
    selfLink string
    The URI of the created resource.
    id str
    The provider-assigned unique ID for this managed resource.
    self_link str
    The URI of the created resource.
    id String
    The provider-assigned unique ID for this managed resource.
    selfLink String
    The URI of the created resource.

    Look up Existing Database Resource

    Get an existing Database 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?: DatabaseState, opts?: CustomResourceOptions): Database
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            charset: Optional[str] = None,
            collation: Optional[str] = None,
            deletion_policy: Optional[str] = None,
            instance: Optional[str] = None,
            name: Optional[str] = None,
            project: Optional[str] = None,
            self_link: Optional[str] = None) -> Database
    func GetDatabase(ctx *Context, name string, id IDInput, state *DatabaseState, opts ...ResourceOption) (*Database, error)
    public static Database Get(string name, Input<string> id, DatabaseState? state, CustomResourceOptions? opts = null)
    public static Database get(String name, Output<String> id, DatabaseState 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:
    Charset string
    The charset value. See MySQL's Supported Character Sets and Collations and Postgres' Character Set Support for more details and supported values. Postgres databases only support a value of UTF8 at creation time.
    Collation string
    The collation value. See MySQL's Supported Character Sets and Collations and Postgres' Collation Support for more details and supported values. Postgres databases only support a value of en_US.UTF8 at creation time.
    DeletionPolicy string
    The deletion policy for the database. Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for Postgres, where databases cannot be deleted from the API if there are users other than cloudsqlsuperuser with access. Possible values are: "ABANDON", "DELETE". Defaults to "DELETE".
    Instance string
    The name of the Cloud SQL instance. This does not include the project ID.


    Name string
    The name of the database in the Cloud SQL instance. This does not include the project ID or instance name.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    SelfLink string
    The URI of the created resource.
    Charset string
    The charset value. See MySQL's Supported Character Sets and Collations and Postgres' Character Set Support for more details and supported values. Postgres databases only support a value of UTF8 at creation time.
    Collation string
    The collation value. See MySQL's Supported Character Sets and Collations and Postgres' Collation Support for more details and supported values. Postgres databases only support a value of en_US.UTF8 at creation time.
    DeletionPolicy string
    The deletion policy for the database. Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for Postgres, where databases cannot be deleted from the API if there are users other than cloudsqlsuperuser with access. Possible values are: "ABANDON", "DELETE". Defaults to "DELETE".
    Instance string
    The name of the Cloud SQL instance. This does not include the project ID.


    Name string
    The name of the database in the Cloud SQL instance. This does not include the project ID or instance name.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    SelfLink string
    The URI of the created resource.
    charset String
    The charset value. See MySQL's Supported Character Sets and Collations and Postgres' Character Set Support for more details and supported values. Postgres databases only support a value of UTF8 at creation time.
    collation String
    The collation value. See MySQL's Supported Character Sets and Collations and Postgres' Collation Support for more details and supported values. Postgres databases only support a value of en_US.UTF8 at creation time.
    deletionPolicy String
    The deletion policy for the database. Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for Postgres, where databases cannot be deleted from the API if there are users other than cloudsqlsuperuser with access. Possible values are: "ABANDON", "DELETE". Defaults to "DELETE".
    instance String
    The name of the Cloud SQL instance. This does not include the project ID.


    name String
    The name of the database in the Cloud SQL instance. This does not include the project ID or instance name.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    selfLink String
    The URI of the created resource.
    charset string
    The charset value. See MySQL's Supported Character Sets and Collations and Postgres' Character Set Support for more details and supported values. Postgres databases only support a value of UTF8 at creation time.
    collation string
    The collation value. See MySQL's Supported Character Sets and Collations and Postgres' Collation Support for more details and supported values. Postgres databases only support a value of en_US.UTF8 at creation time.
    deletionPolicy string
    The deletion policy for the database. Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for Postgres, where databases cannot be deleted from the API if there are users other than cloudsqlsuperuser with access. Possible values are: "ABANDON", "DELETE". Defaults to "DELETE".
    instance string
    The name of the Cloud SQL instance. This does not include the project ID.


    name string
    The name of the database in the Cloud SQL instance. This does not include the project ID or instance name.
    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    selfLink string
    The URI of the created resource.
    charset str
    The charset value. See MySQL's Supported Character Sets and Collations and Postgres' Character Set Support for more details and supported values. Postgres databases only support a value of UTF8 at creation time.
    collation str
    The collation value. See MySQL's Supported Character Sets and Collations and Postgres' Collation Support for more details and supported values. Postgres databases only support a value of en_US.UTF8 at creation time.
    deletion_policy str
    The deletion policy for the database. Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for Postgres, where databases cannot be deleted from the API if there are users other than cloudsqlsuperuser with access. Possible values are: "ABANDON", "DELETE". Defaults to "DELETE".
    instance str
    The name of the Cloud SQL instance. This does not include the project ID.


    name str
    The name of the database in the Cloud SQL instance. This does not include the project ID or instance name.
    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    self_link str
    The URI of the created resource.
    charset String
    The charset value. See MySQL's Supported Character Sets and Collations and Postgres' Character Set Support for more details and supported values. Postgres databases only support a value of UTF8 at creation time.
    collation String
    The collation value. See MySQL's Supported Character Sets and Collations and Postgres' Collation Support for more details and supported values. Postgres databases only support a value of en_US.UTF8 at creation time.
    deletionPolicy String
    The deletion policy for the database. Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for Postgres, where databases cannot be deleted from the API if there are users other than cloudsqlsuperuser with access. Possible values are: "ABANDON", "DELETE". Defaults to "DELETE".
    instance String
    The name of the Cloud SQL instance. This does not include the project ID.


    name String
    The name of the database in the Cloud SQL instance. This does not include the project ID or instance name.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    selfLink String
    The URI of the created resource.

    Import

    Database can be imported using any of these accepted formats:

    • projects/{{project}}/instances/{{instance}}/databases/{{name}}

    • instances/{{instance}}/databases/{{name}}

    • {{project}}/{{instance}}/{{name}}

    • {{instance}}/{{name}}

    • {{name}}

    When using the pulumi import command, Database can be imported using one of the formats above. For example:

    $ pulumi import gcp:sql/database:Database default projects/{{project}}/instances/{{instance}}/databases/{{name}}
    
    $ pulumi import gcp:sql/database:Database default instances/{{instance}}/databases/{{name}}
    
    $ pulumi import gcp:sql/database:Database default {{project}}/{{instance}}/{{name}}
    
    $ pulumi import gcp:sql/database:Database default {{instance}}/{{name}}
    
    $ pulumi import gcp:sql/database:Database default {{name}}
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v8.8.0 published on Thursday, Nov 7, 2024 by Pulumi