Snowflake

Pulumi Official
Package maintained by Pulumi
v0.12.0 published on Wednesday, Jul 20, 2022 by Pulumi

Database

Import

 $ pulumi import snowflake:index/database:Database example name

Example Usage

using Pulumi;
using Snowflake = Pulumi.Snowflake;

class MyStack : Stack
{
    public MyStack()
    {
        var test = new Snowflake.Database("test", new Snowflake.DatabaseArgs
        {
            Comment = "test comment",
            DataRetentionTimeInDays = 3,
        });
        var test2 = new Snowflake.Database("test2", new Snowflake.DatabaseArgs
        {
            Comment = "test comment 2",
            ReplicationConfiguration = new Snowflake.Inputs.DatabaseReplicationConfigurationArgs
            {
                Accounts = 
                {
                    "test_account1",
                    "test_account_2",
                },
                IgnoreEditionCheck = true,
            },
        });
        var test3 = new Snowflake.Database("test3", new Snowflake.DatabaseArgs
        {
            Comment = "test comment",
            DataRetentionTimeInDays = 3,
            FromReplica = "org1\".\"account1\".\"primary_db_name",
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-snowflake/sdk/go/snowflake"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := snowflake.NewDatabase(ctx, "test", &snowflake.DatabaseArgs{
			Comment:                 pulumi.String("test comment"),
			DataRetentionTimeInDays: pulumi.Int(3),
		})
		if err != nil {
			return err
		}
		_, err = snowflake.NewDatabase(ctx, "test2", &snowflake.DatabaseArgs{
			Comment: pulumi.String("test comment 2"),
			ReplicationConfiguration: &DatabaseReplicationConfigurationArgs{
				Accounts: pulumi.StringArray{
					pulumi.String("test_account1"),
					pulumi.String("test_account_2"),
				},
				IgnoreEditionCheck: pulumi.Bool(true),
			},
		})
		if err != nil {
			return err
		}
		_, err = snowflake.NewDatabase(ctx, "test3", &snowflake.DatabaseArgs{
			Comment:                 pulumi.String("test comment"),
			DataRetentionTimeInDays: pulumi.Int(3),
			FromReplica:             pulumi.String("org1\".\"account1\".\"primary_db_name"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var test = new Database("test", DatabaseArgs.builder()        
            .comment("test comment")
            .dataRetentionTimeInDays(3)
            .build());

        var test2 = new Database("test2", DatabaseArgs.builder()        
            .comment("test comment 2")
            .replicationConfiguration(DatabaseReplicationConfigurationArgs.builder()
                .accounts(                
                    "test_account1",
                    "test_account_2")
                .ignoreEditionCheck(true)
                .build())
            .build());

        var test3 = new Database("test3", DatabaseArgs.builder()        
            .comment("test comment")
            .dataRetentionTimeInDays(3)
            .fromReplica("org1\".\"account1\".\"primary_db_name")
            .build());

    }
}
import pulumi
import pulumi_snowflake as snowflake

test = snowflake.Database("test",
    comment="test comment",
    data_retention_time_in_days=3)
test2 = snowflake.Database("test2",
    comment="test comment 2",
    replication_configuration=snowflake.DatabaseReplicationConfigurationArgs(
        accounts=[
            "test_account1",
            "test_account_2",
        ],
        ignore_edition_check=True,
    ))
test3 = snowflake.Database("test3",
    comment="test comment",
    data_retention_time_in_days=3,
    from_replica="org1\".\"account1\".\"primary_db_name")
import * as pulumi from "@pulumi/pulumi";
import * as snowflake from "@pulumi/snowflake";

const test = new snowflake.Database("test", {
    comment: "test comment",
    dataRetentionTimeInDays: 3,
});
const test2 = new snowflake.Database("test2", {
    comment: "test comment 2",
    replicationConfiguration: {
        accounts: [
            "test_account1",
            "test_account_2",
        ],
        ignoreEditionCheck: true,
    },
});
const test3 = new snowflake.Database("test3", {
    comment: "test comment",
    dataRetentionTimeInDays: 3,
    fromReplica: "org1\".\"account1\".\"primary_db_name",
});
resources:
  test:
    type: snowflake:Database
    properties:
      comment: test comment
      dataRetentionTimeInDays: 3
  test2:
    type: snowflake:Database
    properties:
      comment: test comment 2
      replicationConfiguration:
        accounts:
          - test_account1
          - test_account_2
        ignoreEditionCheck: true
  test3:
    type: snowflake:Database
    properties:
      comment: test comment
      dataRetentionTimeInDays: 3
      fromReplica: org1"."account1"."primary_db_name

Create a Database Resource

new Database(name: string, args?: DatabaseArgs, opts?: CustomResourceOptions);
@overload
def Database(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             comment: Optional[str] = None,
             data_retention_time_in_days: Optional[int] = None,
             from_database: Optional[str] = None,
             from_replica: Optional[str] = None,
             from_share: Optional[Mapping[str, str]] = None,
             name: Optional[str] = None,
             replication_configuration: Optional[DatabaseReplicationConfigurationArgs] = None,
             tags: Optional[Sequence[DatabaseTagArgs]] = None)
@overload
def Database(resource_name: str,
             args: Optional[DatabaseArgs] = None,
             opts: Optional[ResourceOptions] = 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: snowflake: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:

Comment string
DataRetentionTimeInDays int
FromDatabase string

Specify a database to create a clone from.

FromReplica string

Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "<organization_name>"."<account_name>"."<db_name>". An example would be: "myorg1"."account1"."db1"

FromShare Dictionary<string, string>

Specify a provider and a share in this map to create a database from a share.

Name string
ReplicationConfiguration DatabaseReplicationConfigurationArgs

When set, specifies the configurations for database replication.

Tags List<DatabaseTagArgs>

Definitions of a tag to associate with the resource.

Comment string
DataRetentionTimeInDays int
FromDatabase string

Specify a database to create a clone from.

FromReplica string

Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "<organization_name>"."<account_name>"."<db_name>". An example would be: "myorg1"."account1"."db1"

FromShare map[string]string

Specify a provider and a share in this map to create a database from a share.

Name string
ReplicationConfiguration DatabaseReplicationConfigurationArgs

When set, specifies the configurations for database replication.

Tags []DatabaseTagArgs

Definitions of a tag to associate with the resource.

comment String
dataRetentionTimeInDays Integer
fromDatabase String

Specify a database to create a clone from.

fromReplica String

Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "<organization_name>"."<account_name>"."<db_name>". An example would be: "myorg1"."account1"."db1"

fromShare Map<String,String>

Specify a provider and a share in this map to create a database from a share.

name String
replicationConfiguration DatabaseReplicationConfigurationArgs

When set, specifies the configurations for database replication.

tags List<DatabaseTagArgs>

Definitions of a tag to associate with the resource.

comment string
dataRetentionTimeInDays number
fromDatabase string

Specify a database to create a clone from.

fromReplica string

Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "<organization_name>"."<account_name>"."<db_name>". An example would be: "myorg1"."account1"."db1"

fromShare {[key: string]: string}

Specify a provider and a share in this map to create a database from a share.

name string
replicationConfiguration DatabaseReplicationConfigurationArgs

When set, specifies the configurations for database replication.

tags DatabaseTagArgs[]

Definitions of a tag to associate with the resource.

comment str
data_retention_time_in_days int
from_database str

Specify a database to create a clone from.

from_replica str

Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "<organization_name>"."<account_name>"."<db_name>". An example would be: "myorg1"."account1"."db1"

from_share Mapping[str, str]

Specify a provider and a share in this map to create a database from a share.

name str
replication_configuration DatabaseReplicationConfigurationArgs

When set, specifies the configurations for database replication.

tags Sequence[DatabaseTagArgs]

Definitions of a tag to associate with the resource.

comment String
dataRetentionTimeInDays Number
fromDatabase String

Specify a database to create a clone from.

fromReplica String

Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "<organization_name>"."<account_name>"."<db_name>". An example would be: "myorg1"."account1"."db1"

fromShare Map<String>

Specify a provider and a share in this map to create a database from a share.

name String
replicationConfiguration Property Map

When set, specifies the configurations for database replication.

tags List<Property Map>

Definitions of a tag to associate with the resource.

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 an 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,
        comment: Optional[str] = None,
        data_retention_time_in_days: Optional[int] = None,
        from_database: Optional[str] = None,
        from_replica: Optional[str] = None,
        from_share: Optional[Mapping[str, str]] = None,
        name: Optional[str] = None,
        replication_configuration: Optional[DatabaseReplicationConfigurationArgs] = None,
        tags: Optional[Sequence[DatabaseTagArgs]] = 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:
Comment string
DataRetentionTimeInDays int
FromDatabase string

Specify a database to create a clone from.

FromReplica string

Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "<organization_name>"."<account_name>"."<db_name>". An example would be: "myorg1"."account1"."db1"

FromShare Dictionary<string, string>

Specify a provider and a share in this map to create a database from a share.

Name string
ReplicationConfiguration DatabaseReplicationConfigurationArgs

When set, specifies the configurations for database replication.

Tags List<DatabaseTagArgs>

Definitions of a tag to associate with the resource.

Comment string
DataRetentionTimeInDays int
FromDatabase string

Specify a database to create a clone from.

FromReplica string

Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "<organization_name>"."<account_name>"."<db_name>". An example would be: "myorg1"."account1"."db1"

FromShare map[string]string

Specify a provider and a share in this map to create a database from a share.

Name string
ReplicationConfiguration DatabaseReplicationConfigurationArgs

When set, specifies the configurations for database replication.

Tags []DatabaseTagArgs

Definitions of a tag to associate with the resource.

comment String
dataRetentionTimeInDays Integer
fromDatabase String

Specify a database to create a clone from.

fromReplica String

Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "<organization_name>"."<account_name>"."<db_name>". An example would be: "myorg1"."account1"."db1"

fromShare Map<String,String>

Specify a provider and a share in this map to create a database from a share.

name String
replicationConfiguration DatabaseReplicationConfigurationArgs

When set, specifies the configurations for database replication.

tags List<DatabaseTagArgs>

Definitions of a tag to associate with the resource.

comment string
dataRetentionTimeInDays number
fromDatabase string

Specify a database to create a clone from.

fromReplica string

Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "<organization_name>"."<account_name>"."<db_name>". An example would be: "myorg1"."account1"."db1"

fromShare {[key: string]: string}

Specify a provider and a share in this map to create a database from a share.

name string
replicationConfiguration DatabaseReplicationConfigurationArgs

When set, specifies the configurations for database replication.

tags DatabaseTagArgs[]

Definitions of a tag to associate with the resource.

comment str
data_retention_time_in_days int
from_database str

Specify a database to create a clone from.

from_replica str

Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "<organization_name>"."<account_name>"."<db_name>". An example would be: "myorg1"."account1"."db1"

from_share Mapping[str, str]

Specify a provider and a share in this map to create a database from a share.

name str
replication_configuration DatabaseReplicationConfigurationArgs

When set, specifies the configurations for database replication.

tags Sequence[DatabaseTagArgs]

Definitions of a tag to associate with the resource.

comment String
dataRetentionTimeInDays Number
fromDatabase String

Specify a database to create a clone from.

fromReplica String

Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "<organization_name>"."<account_name>"."<db_name>". An example would be: "myorg1"."account1"."db1"

fromShare Map<String>

Specify a provider and a share in this map to create a database from a share.

name String
replicationConfiguration Property Map

When set, specifies the configurations for database replication.

tags List<Property Map>

Definitions of a tag to associate with the resource.

Supporting Types

DatabaseReplicationConfiguration

Accounts List<string>
IgnoreEditionCheck bool
accounts List<String>
ignoreEditionCheck Boolean
accounts Sequence[str]
ignore_edition_check bool
accounts List<String>
ignoreEditionCheck Boolean

DatabaseTag

Name string
Value string
Database string
Schema string
Name string
Value string
Database string
Schema string
name String
value String
database String
schema String
name string
value string
database string
schema string
name str
value str
database str
schema str
name String
value String
database String
schema String

Package Details

Repository
https://github.com/pulumi/pulumi-snowflake
License
Apache-2.0
Notes

This Pulumi package is based on the snowflake Terraform Provider.