Snowflake

Pulumi Official
Package maintained by Pulumi
v0.8.0 published on Monday, May 16, 2022 by Pulumi

FunctionGrant

Import

format is database name | schema name | function signature | privilege | true/false for with_grant_option

 $ pulumi import snowflake:index/functionGrant:FunctionGrant example 'dbName|schemaName|functionName(ARG1 ARG1TYPE, ARG2 ARG2TYPE):RETURNTYPE|USAGE|false'

Example Usage

using Pulumi;
using Snowflake = Pulumi.Snowflake;

class MyStack : Stack
{
    public MyStack()
    {
        var grant = new Snowflake.FunctionGrant("grant", new Snowflake.FunctionGrantArgs
        {
            DatabaseName = "db",
            SchemaName = "schema",
            FunctionName = "function",
            Arguments = 
            {
                new Snowflake.Inputs.FunctionGrantArgumentArgs
                {
                    %!v(PANIC=Format method: interface conversion: model.Expression is *model.TemplateExpression, not *model.LiteralValueExpression),
                    new Snowflake.Inputs.FunctionGrantArgumentArgs
                    {
                        %!v(PANIC=Format method: interface conversion: model.Expression is *model.TemplateExpression, not *model.LiteralValueExpression),
                    },
                    ReturnType = "string",
                    Privilege = "USAGE",
                    Roles = 
                    {
                        "role1",
                        "role2",
                    },
                    Shares = 
                    {
                        "share1",
                        "share2",
                    },
                    OnFuture = false,
                    WithGrantOption = false,
                });
            }

}
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.NewFunctionGrant(ctx, "grant", &snowflake.FunctionGrantArgs{
			DatabaseName: pulumi.String("db"),
			SchemaName:   pulumi.String("schema"),
			FunctionName: pulumi.String("function"),
			Arguments: FunctionGrantArgumentArray{
				&FunctionGrantArgumentArgs{
					Name: pulumi.String("a"),
					Type: pulumi.String("array"),
				},
				&FunctionGrantArgumentArgs{
					Name: pulumi.String("b"),
					Type: pulumi.String("string"),
				},
			},
			ReturnType: pulumi.String("string"),
			Privilege:  pulumi.String("USAGE"),
			Roles: pulumi.StringArray{
				pulumi.String("role1"),
				pulumi.String("role2"),
			},
			Shares: pulumi.StringArray{
				pulumi.String("share1"),
				pulumi.String("share2"),
			},
			OnFuture:        pulumi.Bool(false),
			WithGrantOption: pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_snowflake as snowflake

grant = snowflake.FunctionGrant("grant",
    database_name="db",
    schema_name="schema",
    function_name="function",
    arguments=[
        snowflake.FunctionGrantArgumentArgs(
            %!v(PANIC=Format method: interface conversion: model.Expression is *model.TemplateExpression, not *model.LiteralValueExpression),
            snowflake.FunctionGrantArgumentArgs(
                %!v(PANIC=Format method: interface conversion: model.Expression is *model.TemplateExpression, not *model.LiteralValueExpression),
            ],
            return_type="string",
            privilege="USAGE",
            roles=[
                "role1",
                "role2",
            ],
            shares=[
                "share1",
                "share2",
            ],
            on_future=False,
            with_grant_option=False)
import * as pulumi from "@pulumi/pulumi";
import * as snowflake from "@pulumi/snowflake";

const grant = new snowflake.FunctionGrant("grant", {
    databaseName: "db",
    schemaName: "schema",
    functionName: "function",
    arguments: [
        {
            name: "a",
            type: "array",
        },
        {
            name: "b",
            type: "string",
        },
    ],
    returnType: "string",
    privilege: "USAGE",
    roles: [
        "role1",
        "role2",
    ],
    shares: [
        "share1",
        "share2",
    ],
    onFuture: false,
    withGrantOption: false,
});

Coming soon!

Create a FunctionGrant Resource

new FunctionGrant(name: string, args: FunctionGrantArgs, opts?: CustomResourceOptions);
@overload
def FunctionGrant(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  arguments: Optional[Sequence[FunctionGrantArgumentArgs]] = None,
                  database_name: Optional[str] = None,
                  enable_multiple_grants: Optional[bool] = None,
                  function_name: Optional[str] = None,
                  on_future: Optional[bool] = None,
                  privilege: Optional[str] = None,
                  return_type: Optional[str] = None,
                  roles: Optional[Sequence[str]] = None,
                  schema_name: Optional[str] = None,
                  shares: Optional[Sequence[str]] = None,
                  with_grant_option: Optional[bool] = None)
@overload
def FunctionGrant(resource_name: str,
                  args: FunctionGrantArgs,
                  opts: Optional[ResourceOptions] = None)
func NewFunctionGrant(ctx *Context, name string, args FunctionGrantArgs, opts ...ResourceOption) (*FunctionGrant, error)
public FunctionGrant(string name, FunctionGrantArgs args, CustomResourceOptions? opts = null)
public FunctionGrant(String name, FunctionGrantArgs args)
public FunctionGrant(String name, FunctionGrantArgs args, CustomResourceOptions options)
type: snowflake:FunctionGrant
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

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

FunctionGrant 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 FunctionGrant resource accepts the following input properties:

DatabaseName string

The name of the database containing the current or future functions on which to grant privileges.

SchemaName string

The name of the schema containing the current or future functions on which to grant privileges.

Arguments List<FunctionGrantArgumentArgs>

List of the arguments for the function (must be present if function has arguments and function_name is present)

EnableMultipleGrants bool

When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.

FunctionName string

The name of the function on which to grant privileges immediately (only valid if on_future is false).

OnFuture bool

When this is set to true and a schemaname is provided, apply this grant on all future functions in the given schema. When this is true and no schemaname is provided apply this grant on all future functions in the given database. The functionname, arguments, returntype, and shares fields must be unset in order to use on_future.

Privilege string

The privilege to grant on the current or future function. Must be one of USAGE or OWNERSHIP.

ReturnType string

The return type of the function (must be present if function_name is present)

Roles List<string>

Grants privilege to these roles.

Shares List<string>

Grants privilege to these shares (only valid if on_future is false).

WithGrantOption bool

When this is set to true, allows the recipient role to grant the privileges to other roles.

DatabaseName string

The name of the database containing the current or future functions on which to grant privileges.

SchemaName string

The name of the schema containing the current or future functions on which to grant privileges.

Arguments []FunctionGrantArgumentArgs

List of the arguments for the function (must be present if function has arguments and function_name is present)

EnableMultipleGrants bool

When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.

FunctionName string

The name of the function on which to grant privileges immediately (only valid if on_future is false).

OnFuture bool

When this is set to true and a schemaname is provided, apply this grant on all future functions in the given schema. When this is true and no schemaname is provided apply this grant on all future functions in the given database. The functionname, arguments, returntype, and shares fields must be unset in order to use on_future.

Privilege string

The privilege to grant on the current or future function. Must be one of USAGE or OWNERSHIP.

ReturnType string

The return type of the function (must be present if function_name is present)

Roles []string

Grants privilege to these roles.

Shares []string

Grants privilege to these shares (only valid if on_future is false).

WithGrantOption bool

When this is set to true, allows the recipient role to grant the privileges to other roles.

databaseName String

The name of the database containing the current or future functions on which to grant privileges.

schemaName String

The name of the schema containing the current or future functions on which to grant privileges.

arguments ListGrantArgumentArgs>

List of the arguments for the function (must be present if function has arguments and function_name is present)

enableMultipleGrants Boolean

When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.

functionName String

The name of the function on which to grant privileges immediately (only valid if on_future is false).

onFuture Boolean

When this is set to true and a schemaname is provided, apply this grant on all future functions in the given schema. When this is true and no schemaname is provided apply this grant on all future functions in the given database. The functionname, arguments, returntype, and shares fields must be unset in order to use on_future.

privilege String

The privilege to grant on the current or future function. Must be one of USAGE or OWNERSHIP.

returnType String

The return type of the function (must be present if function_name is present)

roles List

Grants privilege to these roles.

shares List

Grants privilege to these shares (only valid if on_future is false).

withGrantOption Boolean

When this is set to true, allows the recipient role to grant the privileges to other roles.

databaseName string

The name of the database containing the current or future functions on which to grant privileges.

schemaName string

The name of the schema containing the current or future functions on which to grant privileges.

arguments FunctionGrantArgumentArgs[]

List of the arguments for the function (must be present if function has arguments and function_name is present)

enableMultipleGrants boolean

When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.

functionName string

The name of the function on which to grant privileges immediately (only valid if on_future is false).

onFuture boolean

When this is set to true and a schemaname is provided, apply this grant on all future functions in the given schema. When this is true and no schemaname is provided apply this grant on all future functions in the given database. The functionname, arguments, returntype, and shares fields must be unset in order to use on_future.

privilege string

The privilege to grant on the current or future function. Must be one of USAGE or OWNERSHIP.

returnType string

The return type of the function (must be present if function_name is present)

roles string[]

Grants privilege to these roles.

shares string[]

Grants privilege to these shares (only valid if on_future is false).

withGrantOption boolean

When this is set to true, allows the recipient role to grant the privileges to other roles.

database_name str

The name of the database containing the current or future functions on which to grant privileges.

schema_name str

The name of the schema containing the current or future functions on which to grant privileges.

arguments Sequence[FunctionGrantArgumentArgs]

List of the arguments for the function (must be present if function has arguments and function_name is present)

enable_multiple_grants bool

When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.

function_name str

The name of the function on which to grant privileges immediately (only valid if on_future is false).

on_future bool

When this is set to true and a schemaname is provided, apply this grant on all future functions in the given schema. When this is true and no schemaname is provided apply this grant on all future functions in the given database. The functionname, arguments, returntype, and shares fields must be unset in order to use on_future.

privilege str

The privilege to grant on the current or future function. Must be one of USAGE or OWNERSHIP.

return_type str

The return type of the function (must be present if function_name is present)

roles Sequence[str]

Grants privilege to these roles.

shares Sequence[str]

Grants privilege to these shares (only valid if on_future is false).

with_grant_option bool

When this is set to true, allows the recipient role to grant the privileges to other roles.

databaseName String

The name of the database containing the current or future functions on which to grant privileges.

schemaName String

The name of the schema containing the current or future functions on which to grant privileges.

arguments List

List of the arguments for the function (must be present if function has arguments and function_name is present)

enableMultipleGrants Boolean

When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.

functionName String

The name of the function on which to grant privileges immediately (only valid if on_future is false).

onFuture Boolean

When this is set to true and a schemaname is provided, apply this grant on all future functions in the given schema. When this is true and no schemaname is provided apply this grant on all future functions in the given database. The functionname, arguments, returntype, and shares fields must be unset in order to use on_future.

privilege String

The privilege to grant on the current or future function. Must be one of USAGE or OWNERSHIP.

returnType String

The return type of the function (must be present if function_name is present)

roles List

Grants privilege to these roles.

shares List

Grants privilege to these shares (only valid if on_future is false).

withGrantOption Boolean

When this is set to true, allows the recipient role to grant the privileges to other roles.

Outputs

All input properties are implicitly available as output properties. Additionally, the FunctionGrant 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 FunctionGrant Resource

Get an existing FunctionGrant 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?: FunctionGrantState, opts?: CustomResourceOptions): FunctionGrant
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        arguments: Optional[Sequence[FunctionGrantArgumentArgs]] = None,
        database_name: Optional[str] = None,
        enable_multiple_grants: Optional[bool] = None,
        function_name: Optional[str] = None,
        on_future: Optional[bool] = None,
        privilege: Optional[str] = None,
        return_type: Optional[str] = None,
        roles: Optional[Sequence[str]] = None,
        schema_name: Optional[str] = None,
        shares: Optional[Sequence[str]] = None,
        with_grant_option: Optional[bool] = None) -> FunctionGrant
func GetFunctionGrant(ctx *Context, name string, id IDInput, state *FunctionGrantState, opts ...ResourceOption) (*FunctionGrant, error)
public static FunctionGrant Get(string name, Input<string> id, FunctionGrantState? state, CustomResourceOptions? opts = null)
public static FunctionGrant get(String name, Output<String> id, FunctionGrantState 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:
Arguments List<FunctionGrantArgumentArgs>

List of the arguments for the function (must be present if function has arguments and function_name is present)

DatabaseName string

The name of the database containing the current or future functions on which to grant privileges.

EnableMultipleGrants bool

When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.

FunctionName string

The name of the function on which to grant privileges immediately (only valid if on_future is false).

OnFuture bool

When this is set to true and a schemaname is provided, apply this grant on all future functions in the given schema. When this is true and no schemaname is provided apply this grant on all future functions in the given database. The functionname, arguments, returntype, and shares fields must be unset in order to use on_future.

Privilege string

The privilege to grant on the current or future function. Must be one of USAGE or OWNERSHIP.

ReturnType string

The return type of the function (must be present if function_name is present)

Roles List<string>

Grants privilege to these roles.

SchemaName string

The name of the schema containing the current or future functions on which to grant privileges.

Shares List<string>

Grants privilege to these shares (only valid if on_future is false).

WithGrantOption bool

When this is set to true, allows the recipient role to grant the privileges to other roles.

Arguments []FunctionGrantArgumentArgs

List of the arguments for the function (must be present if function has arguments and function_name is present)

DatabaseName string

The name of the database containing the current or future functions on which to grant privileges.

EnableMultipleGrants bool

When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.

FunctionName string

The name of the function on which to grant privileges immediately (only valid if on_future is false).

OnFuture bool

When this is set to true and a schemaname is provided, apply this grant on all future functions in the given schema. When this is true and no schemaname is provided apply this grant on all future functions in the given database. The functionname, arguments, returntype, and shares fields must be unset in order to use on_future.

Privilege string

The privilege to grant on the current or future function. Must be one of USAGE or OWNERSHIP.

ReturnType string

The return type of the function (must be present if function_name is present)

Roles []string

Grants privilege to these roles.

SchemaName string

The name of the schema containing the current or future functions on which to grant privileges.

Shares []string

Grants privilege to these shares (only valid if on_future is false).

WithGrantOption bool

When this is set to true, allows the recipient role to grant the privileges to other roles.

arguments ListGrantArgumentArgs>

List of the arguments for the function (must be present if function has arguments and function_name is present)

databaseName String

The name of the database containing the current or future functions on which to grant privileges.

enableMultipleGrants Boolean

When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.

functionName String

The name of the function on which to grant privileges immediately (only valid if on_future is false).

onFuture Boolean

When this is set to true and a schemaname is provided, apply this grant on all future functions in the given schema. When this is true and no schemaname is provided apply this grant on all future functions in the given database. The functionname, arguments, returntype, and shares fields must be unset in order to use on_future.

privilege String

The privilege to grant on the current or future function. Must be one of USAGE or OWNERSHIP.

returnType String

The return type of the function (must be present if function_name is present)

roles List

Grants privilege to these roles.

schemaName String

The name of the schema containing the current or future functions on which to grant privileges.

shares List

Grants privilege to these shares (only valid if on_future is false).

withGrantOption Boolean

When this is set to true, allows the recipient role to grant the privileges to other roles.

arguments FunctionGrantArgumentArgs[]

List of the arguments for the function (must be present if function has arguments and function_name is present)

databaseName string

The name of the database containing the current or future functions on which to grant privileges.

enableMultipleGrants boolean

When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.

functionName string

The name of the function on which to grant privileges immediately (only valid if on_future is false).

onFuture boolean

When this is set to true and a schemaname is provided, apply this grant on all future functions in the given schema. When this is true and no schemaname is provided apply this grant on all future functions in the given database. The functionname, arguments, returntype, and shares fields must be unset in order to use on_future.

privilege string

The privilege to grant on the current or future function. Must be one of USAGE or OWNERSHIP.

returnType string

The return type of the function (must be present if function_name is present)

roles string[]

Grants privilege to these roles.

schemaName string

The name of the schema containing the current or future functions on which to grant privileges.

shares string[]

Grants privilege to these shares (only valid if on_future is false).

withGrantOption boolean

When this is set to true, allows the recipient role to grant the privileges to other roles.

arguments Sequence[FunctionGrantArgumentArgs]

List of the arguments for the function (must be present if function has arguments and function_name is present)

database_name str

The name of the database containing the current or future functions on which to grant privileges.

enable_multiple_grants bool

When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.

function_name str

The name of the function on which to grant privileges immediately (only valid if on_future is false).

on_future bool

When this is set to true and a schemaname is provided, apply this grant on all future functions in the given schema. When this is true and no schemaname is provided apply this grant on all future functions in the given database. The functionname, arguments, returntype, and shares fields must be unset in order to use on_future.

privilege str

The privilege to grant on the current or future function. Must be one of USAGE or OWNERSHIP.

return_type str

The return type of the function (must be present if function_name is present)

roles Sequence[str]

Grants privilege to these roles.

schema_name str

The name of the schema containing the current or future functions on which to grant privileges.

shares Sequence[str]

Grants privilege to these shares (only valid if on_future is false).

with_grant_option bool

When this is set to true, allows the recipient role to grant the privileges to other roles.

arguments List

List of the arguments for the function (must be present if function has arguments and function_name is present)

databaseName String

The name of the database containing the current or future functions on which to grant privileges.

enableMultipleGrants Boolean

When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.

functionName String

The name of the function on which to grant privileges immediately (only valid if on_future is false).

onFuture Boolean

When this is set to true and a schemaname is provided, apply this grant on all future functions in the given schema. When this is true and no schemaname is provided apply this grant on all future functions in the given database. The functionname, arguments, returntype, and shares fields must be unset in order to use on_future.

privilege String

The privilege to grant on the current or future function. Must be one of USAGE or OWNERSHIP.

returnType String

The return type of the function (must be present if function_name is present)

roles List

Grants privilege to these roles.

schemaName String

The name of the schema containing the current or future functions on which to grant privileges.

shares List

Grants privilege to these shares (only valid if on_future is false).

withGrantOption Boolean

When this is set to true, allows the recipient role to grant the privileges to other roles.

Supporting Types

FunctionGrantArgument

Name string

The argument name

Type string

The argument type

Name string

The argument name

Type string

The argument type

name String

The argument name

type String

The argument type

name string

The argument name

type string

The argument type

name str

The argument name

type str

The argument type

name String

The argument name

type String

The argument type

Package Details

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

This Pulumi package is based on the snowflake Terraform Provider.