!> Caution: Preview Feature This feature is considered a preview feature in the provider, regardless of the state of the resource in Snowflake. We do not guarantee its stability. It will be reworked and marked as a stable feature in future releases. Breaking changes are expected, even without bumping the major version. To use this feature, add the relevant feature name to preview_features_enabled field in the provider configuration. Please always refer to the Getting Help section in our Github repo to best determine how to get help for your questions.
Note When adding or updating accounts in the
accountsfield, the provider creates a temporary database as a workaround for a Snowflake race condition. This is because accounts cannot be added to a share until after a database has been granted to the share, but database grants depend on the share existing first. The provider automatically:
- Creates a temporary database (named
TEMP_<share_name>_<timestamp>) - Grants
USAGEandREFERENCE_USAGEprivileges on the temporary database to the share - Adds the specified accounts to the share
- Revokes the privileges and drops the temporary database This process is fully automated during the creation.
Example Usage
Note Instead of using fully_qualified_name, you can reference objects managed outside Terraform by constructing a correct ID, consult identifiers guide.
import * as pulumi from "@pulumi/pulumi";
import * as snowflake from "@pulumi/snowflake";
const test = new snowflake.Share("test", {
name: "share_name",
comment: "cool comment",
accounts: ["organizationName.accountName"],
});
const example = new snowflake.Database("example", {name: "test"}, {
dependsOn: [test],
});
import pulumi
import pulumi_snowflake as snowflake
test = snowflake.Share("test",
name="share_name",
comment="cool comment",
accounts=["organizationName.accountName"])
example = snowflake.Database("example", name="test",
opts = pulumi.ResourceOptions(depends_on=[test]))
package main
import (
"github.com/pulumi/pulumi-snowflake/sdk/v2/go/snowflake"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
test, err := snowflake.NewShare(ctx, "test", &snowflake.ShareArgs{
Name: pulumi.String("share_name"),
Comment: pulumi.String("cool comment"),
Accounts: pulumi.StringArray{
pulumi.String("organizationName.accountName"),
},
})
if err != nil {
return err
}
_, err = snowflake.NewDatabase(ctx, "example", &snowflake.DatabaseArgs{
Name: pulumi.String("test"),
}, pulumi.DependsOn([]pulumi.Resource{
test,
}))
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Snowflake = Pulumi.Snowflake;
return await Deployment.RunAsync(() =>
{
var test = new Snowflake.Share("test", new()
{
Name = "share_name",
Comment = "cool comment",
Accounts = new[]
{
"organizationName.accountName",
},
});
var example = new Snowflake.Database("example", new()
{
Name = "test",
}, new CustomResourceOptions
{
DependsOn =
{
test,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.snowflake.Share;
import com.pulumi.snowflake.ShareArgs;
import com.pulumi.snowflake.Database;
import com.pulumi.snowflake.DatabaseArgs;
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 test = new Share("test", ShareArgs.builder()
.name("share_name")
.comment("cool comment")
.accounts("organizationName.accountName")
.build());
var example = new Database("example", DatabaseArgs.builder()
.name("test")
.build(), CustomResourceOptions.builder()
.dependsOn(test)
.build());
}
}
resources:
test:
type: snowflake:Share
properties:
name: share_name
comment: cool comment
accounts:
- organizationName.accountName
example:
type: snowflake:Database
properties:
name: test
options:
dependsOn:
- ${test}
Note If a field has a default value, it is shown next to the type in the schema.
Create Share Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Share(name: string, args?: ShareArgs, opts?: CustomResourceOptions);@overload
def Share(resource_name: str,
args: Optional[ShareArgs] = None,
opts: Optional[ResourceOptions] = None)
@overload
def Share(resource_name: str,
opts: Optional[ResourceOptions] = None,
accounts: Optional[Sequence[str]] = None,
comment: Optional[str] = None,
name: Optional[str] = None)func NewShare(ctx *Context, name string, args *ShareArgs, opts ...ResourceOption) (*Share, error)public Share(string name, ShareArgs? args = null, CustomResourceOptions? opts = null)type: snowflake:Share
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 ShareArgs
- 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 ShareArgs
- 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 ShareArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ShareArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ShareArgs
- 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 shareResource = new Snowflake.Share("shareResource", new()
{
Accounts = new[]
{
"string",
},
Comment = "string",
Name = "string",
});
example, err := snowflake.NewShare(ctx, "shareResource", &snowflake.ShareArgs{
Accounts: pulumi.StringArray{
pulumi.String("string"),
},
Comment: pulumi.String("string"),
Name: pulumi.String("string"),
})
var shareResource = new Share("shareResource", ShareArgs.builder()
.accounts("string")
.comment("string")
.name("string")
.build());
share_resource = snowflake.Share("shareResource",
accounts=["string"],
comment="string",
name="string")
const shareResource = new snowflake.Share("shareResource", {
accounts: ["string"],
comment: "string",
name: "string",
});
type: snowflake:Share
properties:
accounts:
- string
comment: string
name: string
Share 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 Share resource accepts the following input properties:
- Accounts List<string>
- A list of accounts to be added to the share. Values should not be the account locator, but in the form of 'organizationname.accountname
- Comment string
- Specifies a comment for the managed account.
- Name string
- Specifies the identifier for the share; must be unique for the account in which the share is created.
- Accounts []string
- A list of accounts to be added to the share. Values should not be the account locator, but in the form of 'organizationname.accountname
- Comment string
- Specifies a comment for the managed account.
- Name string
- Specifies the identifier for the share; must be unique for the account in which the share is created.
- accounts List<String>
- A list of accounts to be added to the share. Values should not be the account locator, but in the form of 'organizationname.accountname
- comment String
- Specifies a comment for the managed account.
- name String
- Specifies the identifier for the share; must be unique for the account in which the share is created.
- accounts string[]
- A list of accounts to be added to the share. Values should not be the account locator, but in the form of 'organizationname.accountname
- comment string
- Specifies a comment for the managed account.
- name string
- Specifies the identifier for the share; must be unique for the account in which the share is created.
- accounts Sequence[str]
- A list of accounts to be added to the share. Values should not be the account locator, but in the form of 'organizationname.accountname
- comment str
- Specifies a comment for the managed account.
- name str
- Specifies the identifier for the share; must be unique for the account in which the share is created.
- accounts List<String>
- A list of accounts to be added to the share. Values should not be the account locator, but in the form of 'organizationname.accountname
- comment String
- Specifies a comment for the managed account.
- name String
- Specifies the identifier for the share; must be unique for the account in which the share is created.
Outputs
All input properties are implicitly available as output properties. Additionally, the Share resource produces the following output properties:
- Fully
Qualified stringName - Fully qualified name of the resource. For more information, see object name resolution.
- Id string
- The provider-assigned unique ID for this managed resource.
- Fully
Qualified stringName - Fully qualified name of the resource. For more information, see object name resolution.
- Id string
- The provider-assigned unique ID for this managed resource.
- fully
Qualified StringName - Fully qualified name of the resource. For more information, see object name resolution.
- id String
- The provider-assigned unique ID for this managed resource.
- fully
Qualified stringName - Fully qualified name of the resource. For more information, see object name resolution.
- id string
- The provider-assigned unique ID for this managed resource.
- fully_
qualified_ strname - Fully qualified name of the resource. For more information, see object name resolution.
- id str
- The provider-assigned unique ID for this managed resource.
- fully
Qualified StringName - Fully qualified name of the resource. For more information, see object name resolution.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Share Resource
Get an existing Share 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?: ShareState, opts?: CustomResourceOptions): Share@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
accounts: Optional[Sequence[str]] = None,
comment: Optional[str] = None,
fully_qualified_name: Optional[str] = None,
name: Optional[str] = None) -> Sharefunc GetShare(ctx *Context, name string, id IDInput, state *ShareState, opts ...ResourceOption) (*Share, error)public static Share Get(string name, Input<string> id, ShareState? state, CustomResourceOptions? opts = null)public static Share get(String name, Output<String> id, ShareState state, CustomResourceOptions options)resources: _: type: snowflake:Share get: id: ${id}- 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.
- Accounts List<string>
- A list of accounts to be added to the share. Values should not be the account locator, but in the form of 'organizationname.accountname
- Comment string
- Specifies a comment for the managed account.
- Fully
Qualified stringName - Fully qualified name of the resource. For more information, see object name resolution.
- Name string
- Specifies the identifier for the share; must be unique for the account in which the share is created.
- Accounts []string
- A list of accounts to be added to the share. Values should not be the account locator, but in the form of 'organizationname.accountname
- Comment string
- Specifies a comment for the managed account.
- Fully
Qualified stringName - Fully qualified name of the resource. For more information, see object name resolution.
- Name string
- Specifies the identifier for the share; must be unique for the account in which the share is created.
- accounts List<String>
- A list of accounts to be added to the share. Values should not be the account locator, but in the form of 'organizationname.accountname
- comment String
- Specifies a comment for the managed account.
- fully
Qualified StringName - Fully qualified name of the resource. For more information, see object name resolution.
- name String
- Specifies the identifier for the share; must be unique for the account in which the share is created.
- accounts string[]
- A list of accounts to be added to the share. Values should not be the account locator, but in the form of 'organizationname.accountname
- comment string
- Specifies a comment for the managed account.
- fully
Qualified stringName - Fully qualified name of the resource. For more information, see object name resolution.
- name string
- Specifies the identifier for the share; must be unique for the account in which the share is created.
- accounts Sequence[str]
- A list of accounts to be added to the share. Values should not be the account locator, but in the form of 'organizationname.accountname
- comment str
- Specifies a comment for the managed account.
- fully_
qualified_ strname - Fully qualified name of the resource. For more information, see object name resolution.
- name str
- Specifies the identifier for the share; must be unique for the account in which the share is created.
- accounts List<String>
- A list of accounts to be added to the share. Values should not be the account locator, but in the form of 'organizationname.accountname
- comment String
- Specifies a comment for the managed account.
- fully
Qualified StringName - Fully qualified name of the resource. For more information, see object name resolution.
- name String
- Specifies the identifier for the share; must be unique for the account in which the share is created.
Import
$ pulumi import snowflake:index/share:Share example name
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Snowflake pulumi/pulumi-snowflake
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
snowflakeTerraform Provider.
