1. Packages
  2. MSSQL
  3. API Docs
  4. Database
Microsoft SQL Server v0.0.7 published on Wednesday, Jun 14, 2023 by pulumiverse

mssql.Database

Explore with Pulumi AI

mssql logo
Microsoft SQL Server v0.0.7 published on Wednesday, Jun 14, 2023 by pulumiverse

    Manages single database.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Mssql = Pulumiverse.Mssql;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Mssql.Database("example", new()
        {
            Collation = "SQL_Latin1_General_CP1_CS_AS",
            Name = "example",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-mssql/sdk/go/mssql"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := mssql.NewDatabase(ctx, "example", &mssql.DatabaseArgs{
    			Collation: pulumi.String("SQL_Latin1_General_CP1_CS_AS"),
    			Name:      pulumi.String("example"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.mssql.Database;
    import com.pulumi.mssql.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) {
            var example = new Database("example", DatabaseArgs.builder()        
                .collation("SQL_Latin1_General_CP1_CS_AS")
                .name("example")
                .build());
    
        }
    }
    
    import pulumi
    import pulumiverse_mssql as mssql
    
    example = mssql.Database("example",
        collation="SQL_Latin1_General_CP1_CS_AS",
        name="example")
    
    import * as pulumi from "@pulumi/pulumi";
    import * as mssql from "@pulumiverse/mssql";
    
    const example = new mssql.Database("example", {
        collation: "SQL_Latin1_General_CP1_CS_AS",
        name: "example",
    });
    
    resources:
      example:
        type: mssql:Database
        properties:
          collation: SQL_Latin1_General_CP1_CS_AS
          name: example
    

    Create Database Resource

    new Database(name: string, args: DatabaseArgs, opts?: CustomResourceOptions);
    @overload
    def Database(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 collation: Optional[str] = None,
                 name: Optional[str] = None)
    @overload
    def Database(resource_name: str,
                 args: DatabaseArgs,
                 opts: Optional[ResourceOptions] = 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: mssql:Database
    properties: # The arguments to resource properties.
    options: # 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.
    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.

    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

    The Database resource accepts the following input properties:

    Name string

    Database name. Must follow Regular Identifiers rules.

    Collation string

    Default collation name. Can be either a Windows collation name or a SQL collation name. Defaults to SQL Server instance's default collation.

    Name string

    Database name. Must follow Regular Identifiers rules.

    Collation string

    Default collation name. Can be either a Windows collation name or a SQL collation name. Defaults to SQL Server instance's default collation.

    name String

    Database name. Must follow Regular Identifiers rules.

    collation String

    Default collation name. Can be either a Windows collation name or a SQL collation name. Defaults to SQL Server instance's default collation.

    name string

    Database name. Must follow Regular Identifiers rules.

    collation string

    Default collation name. Can be either a Windows collation name or a SQL collation name. Defaults to SQL Server instance's default collation.

    name str

    Database name. Must follow Regular Identifiers rules.

    collation str

    Default collation name. Can be either a Windows collation name or a SQL collation name. Defaults to SQL Server instance's default collation.

    name String

    Database name. Must follow Regular Identifiers rules.

    collation String

    Default collation name. Can be either a Windows collation name or a SQL collation name. Defaults to SQL Server instance's default collation.

    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.

    Id string

    The provider-assigned unique ID for this managed resource.

    id String

    The provider-assigned unique ID for this managed resource.

    id string

    The provider-assigned unique ID for this managed resource.

    id str

    The provider-assigned unique ID for this managed resource.

    id String

    The provider-assigned unique ID for this managed resource.

    Look up 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,
            collation: Optional[str] = None,
            name: 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:
    Collation string

    Default collation name. Can be either a Windows collation name or a SQL collation name. Defaults to SQL Server instance's default collation.

    Name string

    Database name. Must follow Regular Identifiers rules.

    Collation string

    Default collation name. Can be either a Windows collation name or a SQL collation name. Defaults to SQL Server instance's default collation.

    Name string

    Database name. Must follow Regular Identifiers rules.

    collation String

    Default collation name. Can be either a Windows collation name or a SQL collation name. Defaults to SQL Server instance's default collation.

    name String

    Database name. Must follow Regular Identifiers rules.

    collation string

    Default collation name. Can be either a Windows collation name or a SQL collation name. Defaults to SQL Server instance's default collation.

    name string

    Database name. Must follow Regular Identifiers rules.

    collation str

    Default collation name. Can be either a Windows collation name or a SQL collation name. Defaults to SQL Server instance's default collation.

    name str

    Database name. Must follow Regular Identifiers rules.

    collation String

    Default collation name. Can be either a Windows collation name or a SQL collation name. Defaults to SQL Server instance's default collation.

    name String

    Database name. Must follow Regular Identifiers rules.

    Import

    import using database ID - can be retrieved using SELECT DB_ID('<db_name>')

     $ pulumi import mssql:index/database:Database example 12
    

    Package Details

    Repository
    mssql pulumiverse/pulumi-mssql
    License
    Apache-2.0
    Notes

    This Pulumi package is based on the mssql Terraform Provider.

    mssql logo
    Microsoft SQL Server v0.0.7 published on Wednesday, Jun 14, 2023 by pulumiverse