mssql.Database
Explore with Pulumi AI
Manages single database.
Example Usage
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"});
import pulumi
import pulumiverse_mssql as mssql
example = mssql.Database("example", collation="SQL_Latin1_General_CP1_CS_AS")
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"),
})
if err != nil {
return err
}
return nil
})
}
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",
});
});
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")
.build());
}
}
resources:
example:
type: mssql:Database
properties:
collation: SQL_Latin1_General_CP1_CS_AS
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: Optional[DatabaseArgs] = None,
opts: Optional[ResourceOptions] = None)
@overload
def Database(resource_name: str,
opts: Optional[ResourceOptions] = None,
collation: Optional[str] = None,
name: Optional[str] = None)
func NewDatabase(ctx *Context, name string, args *DatabaseArgs, opts ...ResourceOption) (*Database, error)
public Database(string name, DatabaseArgs? args = null, 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.
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 databaseResource = new Mssql.Database("databaseResource", new()
{
Collation = "string",
Name = "string",
});
example, err := mssql.NewDatabase(ctx, "databaseResource", &mssql.DatabaseArgs{
Collation: pulumi.String("string"),
Name: pulumi.String("string"),
})
var databaseResource = new Database("databaseResource", DatabaseArgs.builder()
.collation("string")
.name("string")
.build());
database_resource = mssql.Database("databaseResource",
collation="string",
name="string")
const databaseResource = new mssql.Database("databaseResource", {
collation: "string",
name: "string",
});
type: mssql:Database
properties:
collation: string
name: 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:
- 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.
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.
- 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
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- mssql pulumiverse/pulumi-mssql
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
mssql
Terraform Provider.