1. Packages
  2. Snowflake Provider
  3. API Docs
  4. getGrants
Snowflake v1.2.0 published on Monday, Apr 14, 2025 by Pulumi

snowflake.getGrants

Explore with Pulumi AI

Snowflake v1.2.0 published on Monday, Apr 14, 2025 by Pulumi

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as snowflake from "@pulumi/snowflake";

//#################################
//## SHOW GRANTS ON ...
//#################################
// account
const exampleOnAccount = snowflake.getGrants({
    grantsOn: {
        account: true,
    },
});
// account object (e.g. database)
const exampleOnAccountObject = snowflake.getGrants({
    grantsOn: {
        objectName: "some_database",
        objectType: "DATABASE",
    },
});
// database object (e.g. schema)
const exampleOnDatabaseObject = snowflake.getGrants({
    grantsOn: {
        objectName: "\"some_database\".\"some_schema\"",
        objectType: "SCHEMA",
    },
});
// schema object (e.g. table)
const exampleOnSchemaObject = snowflake.getGrants({
    grantsOn: {
        objectName: "\"some_database\".\"some_schema\".\"some_table\"",
        objectType: "TABLE",
    },
});
// application
const exampleToApplication = snowflake.getGrants({
    grantsTo: {
        application: "some_application",
    },
});
// application role
const exampleToApplicationRole = snowflake.getGrants({
    grantsTo: {
        applicationRole: "\"some_application\".\"some_application_role\"",
    },
});
// account role
const exampleToRole = snowflake.getGrants({
    grantsTo: {
        accountRole: "some_role",
    },
});
// database role
const exampleToDatabaseRole = snowflake.getGrants({
    grantsTo: {
        databaseRole: "\"some_database\".\"some_database_role\"",
    },
});
// share
const exampleToShare = snowflake.getGrants({
    grantsTo: {
        share: {
            shareName: "some_share",
        },
    },
});
// user
const exampleToUser = snowflake.getGrants({
    grantsTo: {
        user: "some_user",
    },
});
// application role
const exampleOfApplicationRole = snowflake.getGrants({
    grantsOf: {
        applicationRole: "\"some_application\".\"some_application_role\"",
    },
});
// database role
const exampleOfDatabaseRole = snowflake.getGrants({
    grantsOf: {
        databaseRole: "\"some_database\".\"some_database_role\"",
    },
});
// account role
const exampleOfRole = snowflake.getGrants({
    grantsOf: {
        accountRole: "some_role",
    },
});
// share
const exampleOfShare = snowflake.getGrants({
    grantsOf: {
        share: "some_share",
    },
});
// database
const exampleFutureInDatabase = snowflake.getGrants({
    futureGrantsIn: {
        database: "some_database",
    },
});
// schema
const exampleFutureInSchema = snowflake.getGrants({
    futureGrantsIn: {
        schema: "\"some_database\".\"some_schema\"",
    },
});
// account role
const exampleFutureToRole = snowflake.getGrants({
    futureGrantsTo: {
        accountRole: "some_role",
    },
});
// database role
const exampleFutureToDatabaseRole = snowflake.getGrants({
    futureGrantsTo: {
        databaseRole: "\"some_database\".\"some_database_role\"",
    },
});
Copy
import pulumi
import pulumi_snowflake as snowflake

##################################
### SHOW GRANTS ON ...
##################################
# account
example_on_account = snowflake.get_grants(grants_on={
    "account": True,
})
# account object (e.g. database)
example_on_account_object = snowflake.get_grants(grants_on={
    "object_name": "some_database",
    "object_type": "DATABASE",
})
# database object (e.g. schema)
example_on_database_object = snowflake.get_grants(grants_on={
    "object_name": "\"some_database\".\"some_schema\"",
    "object_type": "SCHEMA",
})
# schema object (e.g. table)
example_on_schema_object = snowflake.get_grants(grants_on={
    "object_name": "\"some_database\".\"some_schema\".\"some_table\"",
    "object_type": "TABLE",
})
# application
example_to_application = snowflake.get_grants(grants_to={
    "application": "some_application",
})
# application role
example_to_application_role = snowflake.get_grants(grants_to={
    "application_role": "\"some_application\".\"some_application_role\"",
})
# account role
example_to_role = snowflake.get_grants(grants_to={
    "account_role": "some_role",
})
# database role
example_to_database_role = snowflake.get_grants(grants_to={
    "database_role": "\"some_database\".\"some_database_role\"",
})
# share
example_to_share = snowflake.get_grants(grants_to={
    "share": {
        "share_name": "some_share",
    },
})
# user
example_to_user = snowflake.get_grants(grants_to={
    "user": "some_user",
})
# application role
example_of_application_role = snowflake.get_grants(grants_of={
    "application_role": "\"some_application\".\"some_application_role\"",
})
# database role
example_of_database_role = snowflake.get_grants(grants_of={
    "database_role": "\"some_database\".\"some_database_role\"",
})
# account role
example_of_role = snowflake.get_grants(grants_of={
    "account_role": "some_role",
})
# share
example_of_share = snowflake.get_grants(grants_of={
    "share": "some_share",
})
# database
example_future_in_database = snowflake.get_grants(future_grants_in={
    "database": "some_database",
})
# schema
example_future_in_schema = snowflake.get_grants(future_grants_in={
    "schema": "\"some_database\".\"some_schema\"",
})
# account role
example_future_to_role = snowflake.get_grants(future_grants_to={
    "account_role": "some_role",
})
# database role
example_future_to_database_role = snowflake.get_grants(future_grants_to={
    "database_role": "\"some_database\".\"some_database_role\"",
})
Copy
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 {
		// #################################
		// ## SHOW GRANTS ON ...
		// #################################
		// account
		_, err := snowflake.GetGrants(ctx, &snowflake.GetGrantsArgs{
			GrantsOn: snowflake.GetGrantsGrantsOn{
				Account: pulumi.BoolRef(true),
			},
		}, nil)
		if err != nil {
			return err
		}
		// account object (e.g. database)
		_, err = snowflake.GetGrants(ctx, &snowflake.GetGrantsArgs{
			GrantsOn: snowflake.GetGrantsGrantsOn{
				ObjectName: pulumi.StringRef("some_database"),
				ObjectType: pulumi.StringRef("DATABASE"),
			},
		}, nil)
		if err != nil {
			return err
		}
		// database object (e.g. schema)
		_, err = snowflake.GetGrants(ctx, &snowflake.GetGrantsArgs{
			GrantsOn: snowflake.GetGrantsGrantsOn{
				ObjectName: pulumi.StringRef("\"some_database\".\"some_schema\""),
				ObjectType: pulumi.StringRef("SCHEMA"),
			},
		}, nil)
		if err != nil {
			return err
		}
		// schema object (e.g. table)
		_, err = snowflake.GetGrants(ctx, &snowflake.GetGrantsArgs{
			GrantsOn: snowflake.GetGrantsGrantsOn{
				ObjectName: pulumi.StringRef("\"some_database\".\"some_schema\".\"some_table\""),
				ObjectType: pulumi.StringRef("TABLE"),
			},
		}, nil)
		if err != nil {
			return err
		}
		// application
		_, err = snowflake.GetGrants(ctx, &snowflake.GetGrantsArgs{
			GrantsTo: snowflake.GetGrantsGrantsTo{
				Application: pulumi.StringRef("some_application"),
			},
		}, nil)
		if err != nil {
			return err
		}
		// application role
		_, err = snowflake.GetGrants(ctx, &snowflake.GetGrantsArgs{
			GrantsTo: snowflake.GetGrantsGrantsTo{
				ApplicationRole: pulumi.StringRef("\"some_application\".\"some_application_role\""),
			},
		}, nil)
		if err != nil {
			return err
		}
		// account role
		_, err = snowflake.GetGrants(ctx, &snowflake.GetGrantsArgs{
			GrantsTo: snowflake.GetGrantsGrantsTo{
				AccountRole: pulumi.StringRef("some_role"),
			},
		}, nil)
		if err != nil {
			return err
		}
		// database role
		_, err = snowflake.GetGrants(ctx, &snowflake.GetGrantsArgs{
			GrantsTo: snowflake.GetGrantsGrantsTo{
				DatabaseRole: pulumi.StringRef("\"some_database\".\"some_database_role\""),
			},
		}, nil)
		if err != nil {
			return err
		}
		// share
		_, err = snowflake.GetGrants(ctx, &snowflake.GetGrantsArgs{
			GrantsTo: snowflake.GetGrantsGrantsTo{
				Share: snowflake.GetGrantsGrantsToShare{
					ShareName: "some_share",
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		// user
		_, err = snowflake.GetGrants(ctx, &snowflake.GetGrantsArgs{
			GrantsTo: snowflake.GetGrantsGrantsTo{
				User: pulumi.StringRef("some_user"),
			},
		}, nil)
		if err != nil {
			return err
		}
		// application role
		_, err = snowflake.GetGrants(ctx, &snowflake.GetGrantsArgs{
			GrantsOf: snowflake.GetGrantsGrantsOf{
				ApplicationRole: pulumi.StringRef("\"some_application\".\"some_application_role\""),
			},
		}, nil)
		if err != nil {
			return err
		}
		// database role
		_, err = snowflake.GetGrants(ctx, &snowflake.GetGrantsArgs{
			GrantsOf: snowflake.GetGrantsGrantsOf{
				DatabaseRole: pulumi.StringRef("\"some_database\".\"some_database_role\""),
			},
		}, nil)
		if err != nil {
			return err
		}
		// account role
		_, err = snowflake.GetGrants(ctx, &snowflake.GetGrantsArgs{
			GrantsOf: snowflake.GetGrantsGrantsOf{
				AccountRole: pulumi.StringRef("some_role"),
			},
		}, nil)
		if err != nil {
			return err
		}
		// share
		_, err = snowflake.GetGrants(ctx, &snowflake.GetGrantsArgs{
			GrantsOf: snowflake.GetGrantsGrantsOf{
				Share: pulumi.StringRef("some_share"),
			},
		}, nil)
		if err != nil {
			return err
		}
		// database
		_, err = snowflake.GetGrants(ctx, &snowflake.GetGrantsArgs{
			FutureGrantsIn: snowflake.GetGrantsFutureGrantsIn{
				Database: pulumi.StringRef("some_database"),
			},
		}, nil)
		if err != nil {
			return err
		}
		// schema
		_, err = snowflake.GetGrants(ctx, &snowflake.GetGrantsArgs{
			FutureGrantsIn: snowflake.GetGrantsFutureGrantsIn{
				Schema: pulumi.StringRef("\"some_database\".\"some_schema\""),
			},
		}, nil)
		if err != nil {
			return err
		}
		// account role
		_, err = snowflake.GetGrants(ctx, &snowflake.GetGrantsArgs{
			FutureGrantsTo: snowflake.GetGrantsFutureGrantsTo{
				AccountRole: pulumi.StringRef("some_role"),
			},
		}, nil)
		if err != nil {
			return err
		}
		// database role
		_, err = snowflake.GetGrants(ctx, &snowflake.GetGrantsArgs{
			FutureGrantsTo: snowflake.GetGrantsFutureGrantsTo{
				DatabaseRole: pulumi.StringRef("\"some_database\".\"some_database_role\""),
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Snowflake = Pulumi.Snowflake;

return await Deployment.RunAsync(() => 
{
    //#################################
    //## SHOW GRANTS ON ...
    //#################################
    // account
    var exampleOnAccount = Snowflake.GetGrants.Invoke(new()
    {
        GrantsOn = new Snowflake.Inputs.GetGrantsGrantsOnInputArgs
        {
            Account = true,
        },
    });

    // account object (e.g. database)
    var exampleOnAccountObject = Snowflake.GetGrants.Invoke(new()
    {
        GrantsOn = new Snowflake.Inputs.GetGrantsGrantsOnInputArgs
        {
            ObjectName = "some_database",
            ObjectType = "DATABASE",
        },
    });

    // database object (e.g. schema)
    var exampleOnDatabaseObject = Snowflake.GetGrants.Invoke(new()
    {
        GrantsOn = new Snowflake.Inputs.GetGrantsGrantsOnInputArgs
        {
            ObjectName = "\"some_database\".\"some_schema\"",
            ObjectType = "SCHEMA",
        },
    });

    // schema object (e.g. table)
    var exampleOnSchemaObject = Snowflake.GetGrants.Invoke(new()
    {
        GrantsOn = new Snowflake.Inputs.GetGrantsGrantsOnInputArgs
        {
            ObjectName = "\"some_database\".\"some_schema\".\"some_table\"",
            ObjectType = "TABLE",
        },
    });

    // application
    var exampleToApplication = Snowflake.GetGrants.Invoke(new()
    {
        GrantsTo = new Snowflake.Inputs.GetGrantsGrantsToInputArgs
        {
            Application = "some_application",
        },
    });

    // application role
    var exampleToApplicationRole = Snowflake.GetGrants.Invoke(new()
    {
        GrantsTo = new Snowflake.Inputs.GetGrantsGrantsToInputArgs
        {
            ApplicationRole = "\"some_application\".\"some_application_role\"",
        },
    });

    // account role
    var exampleToRole = Snowflake.GetGrants.Invoke(new()
    {
        GrantsTo = new Snowflake.Inputs.GetGrantsGrantsToInputArgs
        {
            AccountRole = "some_role",
        },
    });

    // database role
    var exampleToDatabaseRole = Snowflake.GetGrants.Invoke(new()
    {
        GrantsTo = new Snowflake.Inputs.GetGrantsGrantsToInputArgs
        {
            DatabaseRole = "\"some_database\".\"some_database_role\"",
        },
    });

    // share
    var exampleToShare = Snowflake.GetGrants.Invoke(new()
    {
        GrantsTo = new Snowflake.Inputs.GetGrantsGrantsToInputArgs
        {
            Share = new Snowflake.Inputs.GetGrantsGrantsToShareInputArgs
            {
                ShareName = "some_share",
            },
        },
    });

    // user
    var exampleToUser = Snowflake.GetGrants.Invoke(new()
    {
        GrantsTo = new Snowflake.Inputs.GetGrantsGrantsToInputArgs
        {
            User = "some_user",
        },
    });

    // application role
    var exampleOfApplicationRole = Snowflake.GetGrants.Invoke(new()
    {
        GrantsOf = new Snowflake.Inputs.GetGrantsGrantsOfInputArgs
        {
            ApplicationRole = "\"some_application\".\"some_application_role\"",
        },
    });

    // database role
    var exampleOfDatabaseRole = Snowflake.GetGrants.Invoke(new()
    {
        GrantsOf = new Snowflake.Inputs.GetGrantsGrantsOfInputArgs
        {
            DatabaseRole = "\"some_database\".\"some_database_role\"",
        },
    });

    // account role
    var exampleOfRole = Snowflake.GetGrants.Invoke(new()
    {
        GrantsOf = new Snowflake.Inputs.GetGrantsGrantsOfInputArgs
        {
            AccountRole = "some_role",
        },
    });

    // share
    var exampleOfShare = Snowflake.GetGrants.Invoke(new()
    {
        GrantsOf = new Snowflake.Inputs.GetGrantsGrantsOfInputArgs
        {
            Share = "some_share",
        },
    });

    // database
    var exampleFutureInDatabase = Snowflake.GetGrants.Invoke(new()
    {
        FutureGrantsIn = new Snowflake.Inputs.GetGrantsFutureGrantsInInputArgs
        {
            Database = "some_database",
        },
    });

    // schema
    var exampleFutureInSchema = Snowflake.GetGrants.Invoke(new()
    {
        FutureGrantsIn = new Snowflake.Inputs.GetGrantsFutureGrantsInInputArgs
        {
            Schema = "\"some_database\".\"some_schema\"",
        },
    });

    // account role
    var exampleFutureToRole = Snowflake.GetGrants.Invoke(new()
    {
        FutureGrantsTo = new Snowflake.Inputs.GetGrantsFutureGrantsToInputArgs
        {
            AccountRole = "some_role",
        },
    });

    // database role
    var exampleFutureToDatabaseRole = Snowflake.GetGrants.Invoke(new()
    {
        FutureGrantsTo = new Snowflake.Inputs.GetGrantsFutureGrantsToInputArgs
        {
            DatabaseRole = "\"some_database\".\"some_database_role\"",
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.snowflake.SnowflakeFunctions;
import com.pulumi.snowflake.inputs.GetGrantsArgs;
import com.pulumi.snowflake.inputs.GetGrantsGrantsOnArgs;
import com.pulumi.snowflake.inputs.GetGrantsGrantsToArgs;
import com.pulumi.snowflake.inputs.GetGrantsGrantsToShareArgs;
import com.pulumi.snowflake.inputs.GetGrantsGrantsOfArgs;
import com.pulumi.snowflake.inputs.GetGrantsFutureGrantsInArgs;
import com.pulumi.snowflake.inputs.GetGrantsFutureGrantsToArgs;
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) {
        //#################################
        //## SHOW GRANTS ON ...
        //#################################
        // account
        final var exampleOnAccount = SnowflakeFunctions.getGrants(GetGrantsArgs.builder()
            .grantsOn(GetGrantsGrantsOnArgs.builder()
                .account(true)
                .build())
            .build());

        // account object (e.g. database)
        final var exampleOnAccountObject = SnowflakeFunctions.getGrants(GetGrantsArgs.builder()
            .grantsOn(GetGrantsGrantsOnArgs.builder()
                .objectName("some_database")
                .objectType("DATABASE")
                .build())
            .build());

        // database object (e.g. schema)
        final var exampleOnDatabaseObject = SnowflakeFunctions.getGrants(GetGrantsArgs.builder()
            .grantsOn(GetGrantsGrantsOnArgs.builder()
                .objectName("\"some_database\".\"some_schema\"")
                .objectType("SCHEMA")
                .build())
            .build());

        // schema object (e.g. table)
        final var exampleOnSchemaObject = SnowflakeFunctions.getGrants(GetGrantsArgs.builder()
            .grantsOn(GetGrantsGrantsOnArgs.builder()
                .objectName("\"some_database\".\"some_schema\".\"some_table\"")
                .objectType("TABLE")
                .build())
            .build());

        // application
        final var exampleToApplication = SnowflakeFunctions.getGrants(GetGrantsArgs.builder()
            .grantsTo(GetGrantsGrantsToArgs.builder()
                .application("some_application")
                .build())
            .build());

        // application role
        final var exampleToApplicationRole = SnowflakeFunctions.getGrants(GetGrantsArgs.builder()
            .grantsTo(GetGrantsGrantsToArgs.builder()
                .applicationRole("\"some_application\".\"some_application_role\"")
                .build())
            .build());

        // account role
        final var exampleToRole = SnowflakeFunctions.getGrants(GetGrantsArgs.builder()
            .grantsTo(GetGrantsGrantsToArgs.builder()
                .accountRole("some_role")
                .build())
            .build());

        // database role
        final var exampleToDatabaseRole = SnowflakeFunctions.getGrants(GetGrantsArgs.builder()
            .grantsTo(GetGrantsGrantsToArgs.builder()
                .databaseRole("\"some_database\".\"some_database_role\"")
                .build())
            .build());

        // share
        final var exampleToShare = SnowflakeFunctions.getGrants(GetGrantsArgs.builder()
            .grantsTo(GetGrantsGrantsToArgs.builder()
                .share(GetGrantsGrantsToShareArgs.builder()
                    .shareName("some_share")
                    .build())
                .build())
            .build());

        // user
        final var exampleToUser = SnowflakeFunctions.getGrants(GetGrantsArgs.builder()
            .grantsTo(GetGrantsGrantsToArgs.builder()
                .user("some_user")
                .build())
            .build());

        // application role
        final var exampleOfApplicationRole = SnowflakeFunctions.getGrants(GetGrantsArgs.builder()
            .grantsOf(GetGrantsGrantsOfArgs.builder()
                .applicationRole("\"some_application\".\"some_application_role\"")
                .build())
            .build());

        // database role
        final var exampleOfDatabaseRole = SnowflakeFunctions.getGrants(GetGrantsArgs.builder()
            .grantsOf(GetGrantsGrantsOfArgs.builder()
                .databaseRole("\"some_database\".\"some_database_role\"")
                .build())
            .build());

        // account role
        final var exampleOfRole = SnowflakeFunctions.getGrants(GetGrantsArgs.builder()
            .grantsOf(GetGrantsGrantsOfArgs.builder()
                .accountRole("some_role")
                .build())
            .build());

        // share
        final var exampleOfShare = SnowflakeFunctions.getGrants(GetGrantsArgs.builder()
            .grantsOf(GetGrantsGrantsOfArgs.builder()
                .share("some_share")
                .build())
            .build());

        // database
        final var exampleFutureInDatabase = SnowflakeFunctions.getGrants(GetGrantsArgs.builder()
            .futureGrantsIn(GetGrantsFutureGrantsInArgs.builder()
                .database("some_database")
                .build())
            .build());

        // schema
        final var exampleFutureInSchema = SnowflakeFunctions.getGrants(GetGrantsArgs.builder()
            .futureGrantsIn(GetGrantsFutureGrantsInArgs.builder()
                .schema("\"some_database\".\"some_schema\"")
                .build())
            .build());

        // account role
        final var exampleFutureToRole = SnowflakeFunctions.getGrants(GetGrantsArgs.builder()
            .futureGrantsTo(GetGrantsFutureGrantsToArgs.builder()
                .accountRole("some_role")
                .build())
            .build());

        // database role
        final var exampleFutureToDatabaseRole = SnowflakeFunctions.getGrants(GetGrantsArgs.builder()
            .futureGrantsTo(GetGrantsFutureGrantsToArgs.builder()
                .databaseRole("\"some_database\".\"some_database_role\"")
                .build())
            .build());

    }
}
Copy
variables:
  ##################################
  ### SHOW GRANTS ON ...
  ##################################

  # account
  exampleOnAccount:
    fn::invoke:
      function: snowflake:getGrants
      arguments:
        grantsOn:
          account: true
  # account object (e.g. database)
  exampleOnAccountObject:
    fn::invoke:
      function: snowflake:getGrants
      arguments:
        grantsOn:
          objectName: some_database
          objectType: DATABASE
  # database object (e.g. schema)
  exampleOnDatabaseObject:
    fn::invoke:
      function: snowflake:getGrants
      arguments:
        grantsOn:
          objectName: '"some_database"."some_schema"'
          objectType: SCHEMA
  # schema object (e.g. table)
  exampleOnSchemaObject: ##################################
  ### SHOW GRANTS TO ...
  ##################################
    fn::invoke:
      function: snowflake:getGrants
      arguments:
        grantsOn:
          objectName: '"some_database"."some_schema"."some_table"'
          objectType: TABLE
  # application
  exampleToApplication:
    fn::invoke:
      function: snowflake:getGrants
      arguments:
        grantsTo:
          application: some_application
  # application role
  exampleToApplicationRole:
    fn::invoke:
      function: snowflake:getGrants
      arguments:
        grantsTo:
          applicationRole: '"some_application"."some_application_role"'
  # account role
  exampleToRole:
    fn::invoke:
      function: snowflake:getGrants
      arguments:
        grantsTo:
          accountRole: some_role
  # database role
  exampleToDatabaseRole:
    fn::invoke:
      function: snowflake:getGrants
      arguments:
        grantsTo:
          databaseRole: '"some_database"."some_database_role"'
  # share
  exampleToShare:
    fn::invoke:
      function: snowflake:getGrants
      arguments:
        grantsTo:
          share:
            shareName: some_share
  # user
  exampleToUser: ##################################
  ### SHOW GRANTS OF ...
  ##################################
    fn::invoke:
      function: snowflake:getGrants
      arguments:
        grantsTo:
          user: some_user
  # application role
  exampleOfApplicationRole:
    fn::invoke:
      function: snowflake:getGrants
      arguments:
        grantsOf:
          applicationRole: '"some_application"."some_application_role"'
  # database role
  exampleOfDatabaseRole:
    fn::invoke:
      function: snowflake:getGrants
      arguments:
        grantsOf:
          databaseRole: '"some_database"."some_database_role"'
  # account role
  exampleOfRole:
    fn::invoke:
      function: snowflake:getGrants
      arguments:
        grantsOf:
          accountRole: some_role
  # share
  exampleOfShare: ##################################
  ### SHOW FUTURE GRANTS IN ...
  ##################################
    fn::invoke:
      function: snowflake:getGrants
      arguments:
        grantsOf:
          share: some_share
  # database
  exampleFutureInDatabase:
    fn::invoke:
      function: snowflake:getGrants
      arguments:
        futureGrantsIn:
          database: some_database
  # schema
  exampleFutureInSchema: ##################################
  ### SHOW FUTURE GRANTS TO ...
  ##################################
    fn::invoke:
      function: snowflake:getGrants
      arguments:
        futureGrantsIn:
          schema: '"some_database"."some_schema"'
  # account role
  exampleFutureToRole:
    fn::invoke:
      function: snowflake:getGrants
      arguments:
        futureGrantsTo:
          accountRole: some_role
  # database role
  exampleFutureToDatabaseRole:
    fn::invoke:
      function: snowflake:getGrants
      arguments:
        futureGrantsTo:
          databaseRole: '"some_database"."some_database_role"'
Copy

Note If a field has a default value, it is shown next to the type in the schema.

Using getGrants

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getGrants(args: GetGrantsArgs, opts?: InvokeOptions): Promise<GetGrantsResult>
function getGrantsOutput(args: GetGrantsOutputArgs, opts?: InvokeOptions): Output<GetGrantsResult>
Copy
def get_grants(future_grants_in: Optional[GetGrantsFutureGrantsIn] = None,
               future_grants_to: Optional[GetGrantsFutureGrantsTo] = None,
               grants_of: Optional[GetGrantsGrantsOf] = None,
               grants_on: Optional[GetGrantsGrantsOn] = None,
               grants_to: Optional[GetGrantsGrantsTo] = None,
               opts: Optional[InvokeOptions] = None) -> GetGrantsResult
def get_grants_output(future_grants_in: Optional[pulumi.Input[GetGrantsFutureGrantsInArgs]] = None,
               future_grants_to: Optional[pulumi.Input[GetGrantsFutureGrantsToArgs]] = None,
               grants_of: Optional[pulumi.Input[GetGrantsGrantsOfArgs]] = None,
               grants_on: Optional[pulumi.Input[GetGrantsGrantsOnArgs]] = None,
               grants_to: Optional[pulumi.Input[GetGrantsGrantsToArgs]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetGrantsResult]
Copy
func GetGrants(ctx *Context, args *GetGrantsArgs, opts ...InvokeOption) (*GetGrantsResult, error)
func GetGrantsOutput(ctx *Context, args *GetGrantsOutputArgs, opts ...InvokeOption) GetGrantsResultOutput
Copy

> Note: This function is named GetGrants in the Go SDK.

public static class GetGrants 
{
    public static Task<GetGrantsResult> InvokeAsync(GetGrantsArgs args, InvokeOptions? opts = null)
    public static Output<GetGrantsResult> Invoke(GetGrantsInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetGrantsResult> getGrants(GetGrantsArgs args, InvokeOptions options)
public static Output<GetGrantsResult> getGrants(GetGrantsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: snowflake:index/getGrants:getGrants
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

FutureGrantsIn GetGrantsFutureGrantsIn
Lists all privileges on new (i.e. future) objects.
FutureGrantsTo GetGrantsFutureGrantsTo
Lists all privileges granted to the object on new (i.e. future) objects.
GrantsOf GetGrantsGrantsOf
Lists all objects to which the given object has been granted.
GrantsOn GetGrantsGrantsOn
Lists all privileges that have been granted on an object or on an account.
GrantsTo GetGrantsGrantsTo
Lists all privileges granted to the object.
FutureGrantsIn GetGrantsFutureGrantsIn
Lists all privileges on new (i.e. future) objects.
FutureGrantsTo GetGrantsFutureGrantsTo
Lists all privileges granted to the object on new (i.e. future) objects.
GrantsOf GetGrantsGrantsOf
Lists all objects to which the given object has been granted.
GrantsOn GetGrantsGrantsOn
Lists all privileges that have been granted on an object or on an account.
GrantsTo GetGrantsGrantsTo
Lists all privileges granted to the object.
futureGrantsIn GetGrantsFutureGrantsIn
Lists all privileges on new (i.e. future) objects.
futureGrantsTo GetGrantsFutureGrantsTo
Lists all privileges granted to the object on new (i.e. future) objects.
grantsOf GetGrantsGrantsOf
Lists all objects to which the given object has been granted.
grantsOn GetGrantsGrantsOn
Lists all privileges that have been granted on an object or on an account.
grantsTo GetGrantsGrantsTo
Lists all privileges granted to the object.
futureGrantsIn GetGrantsFutureGrantsIn
Lists all privileges on new (i.e. future) objects.
futureGrantsTo GetGrantsFutureGrantsTo
Lists all privileges granted to the object on new (i.e. future) objects.
grantsOf GetGrantsGrantsOf
Lists all objects to which the given object has been granted.
grantsOn GetGrantsGrantsOn
Lists all privileges that have been granted on an object or on an account.
grantsTo GetGrantsGrantsTo
Lists all privileges granted to the object.
future_grants_in GetGrantsFutureGrantsIn
Lists all privileges on new (i.e. future) objects.
future_grants_to GetGrantsFutureGrantsTo
Lists all privileges granted to the object on new (i.e. future) objects.
grants_of GetGrantsGrantsOf
Lists all objects to which the given object has been granted.
grants_on GetGrantsGrantsOn
Lists all privileges that have been granted on an object or on an account.
grants_to GetGrantsGrantsTo
Lists all privileges granted to the object.
futureGrantsIn Property Map
Lists all privileges on new (i.e. future) objects.
futureGrantsTo Property Map
Lists all privileges granted to the object on new (i.e. future) objects.
grantsOf Property Map
Lists all objects to which the given object has been granted.
grantsOn Property Map
Lists all privileges that have been granted on an object or on an account.
grantsTo Property Map
Lists all privileges granted to the object.

getGrants Result

The following output properties are available:

Grants List<GetGrantsGrant>
The list of grants
Id string
The provider-assigned unique ID for this managed resource.
FutureGrantsIn GetGrantsFutureGrantsIn
Lists all privileges on new (i.e. future) objects.
FutureGrantsTo GetGrantsFutureGrantsTo
Lists all privileges granted to the object on new (i.e. future) objects.
GrantsOf GetGrantsGrantsOf
Lists all objects to which the given object has been granted.
GrantsOn GetGrantsGrantsOn
Lists all privileges that have been granted on an object or on an account.
GrantsTo GetGrantsGrantsTo
Lists all privileges granted to the object.
Grants []GetGrantsGrant
The list of grants
Id string
The provider-assigned unique ID for this managed resource.
FutureGrantsIn GetGrantsFutureGrantsIn
Lists all privileges on new (i.e. future) objects.
FutureGrantsTo GetGrantsFutureGrantsTo
Lists all privileges granted to the object on new (i.e. future) objects.
GrantsOf GetGrantsGrantsOf
Lists all objects to which the given object has been granted.
GrantsOn GetGrantsGrantsOn
Lists all privileges that have been granted on an object or on an account.
GrantsTo GetGrantsGrantsTo
Lists all privileges granted to the object.
grants List<GetGrantsGrant>
The list of grants
id String
The provider-assigned unique ID for this managed resource.
futureGrantsIn GetGrantsFutureGrantsIn
Lists all privileges on new (i.e. future) objects.
futureGrantsTo GetGrantsFutureGrantsTo
Lists all privileges granted to the object on new (i.e. future) objects.
grantsOf GetGrantsGrantsOf
Lists all objects to which the given object has been granted.
grantsOn GetGrantsGrantsOn
Lists all privileges that have been granted on an object or on an account.
grantsTo GetGrantsGrantsTo
Lists all privileges granted to the object.
grants GetGrantsGrant[]
The list of grants
id string
The provider-assigned unique ID for this managed resource.
futureGrantsIn GetGrantsFutureGrantsIn
Lists all privileges on new (i.e. future) objects.
futureGrantsTo GetGrantsFutureGrantsTo
Lists all privileges granted to the object on new (i.e. future) objects.
grantsOf GetGrantsGrantsOf
Lists all objects to which the given object has been granted.
grantsOn GetGrantsGrantsOn
Lists all privileges that have been granted on an object or on an account.
grantsTo GetGrantsGrantsTo
Lists all privileges granted to the object.
grants Sequence[GetGrantsGrant]
The list of grants
id str
The provider-assigned unique ID for this managed resource.
future_grants_in GetGrantsFutureGrantsIn
Lists all privileges on new (i.e. future) objects.
future_grants_to GetGrantsFutureGrantsTo
Lists all privileges granted to the object on new (i.e. future) objects.
grants_of GetGrantsGrantsOf
Lists all objects to which the given object has been granted.
grants_on GetGrantsGrantsOn
Lists all privileges that have been granted on an object or on an account.
grants_to GetGrantsGrantsTo
Lists all privileges granted to the object.
grants List<Property Map>
The list of grants
id String
The provider-assigned unique ID for this managed resource.
futureGrantsIn Property Map
Lists all privileges on new (i.e. future) objects.
futureGrantsTo Property Map
Lists all privileges granted to the object on new (i.e. future) objects.
grantsOf Property Map
Lists all objects to which the given object has been granted.
grantsOn Property Map
Lists all privileges that have been granted on an object or on an account.
grantsTo Property Map
Lists all privileges granted to the object.

Supporting Types

GetGrantsFutureGrantsIn

Database string
Lists all privileges on new (i.e. future) objects of a specified type in the database granted to a role.
Schema string
Lists all privileges on new (i.e. future) objects of a specified type in the schema granted to a role. Schema must be a fully qualified name ("<dbname>"."<schemaname>").
Database string
Lists all privileges on new (i.e. future) objects of a specified type in the database granted to a role.
Schema string
Lists all privileges on new (i.e. future) objects of a specified type in the schema granted to a role. Schema must be a fully qualified name ("<dbname>"."<schemaname>").
database String
Lists all privileges on new (i.e. future) objects of a specified type in the database granted to a role.
schema String
Lists all privileges on new (i.e. future) objects of a specified type in the schema granted to a role. Schema must be a fully qualified name ("<dbname>"."<schemaname>").
database string
Lists all privileges on new (i.e. future) objects of a specified type in the database granted to a role.
schema string
Lists all privileges on new (i.e. future) objects of a specified type in the schema granted to a role. Schema must be a fully qualified name ("<dbname>"."<schemaname>").
database str
Lists all privileges on new (i.e. future) objects of a specified type in the database granted to a role.
schema str
Lists all privileges on new (i.e. future) objects of a specified type in the schema granted to a role. Schema must be a fully qualified name ("<dbname>"."<schemaname>").
database String
Lists all privileges on new (i.e. future) objects of a specified type in the database granted to a role.
schema String
Lists all privileges on new (i.e. future) objects of a specified type in the schema granted to a role. Schema must be a fully qualified name ("<dbname>"."<schemaname>").

GetGrantsFutureGrantsTo

AccountRole string
Lists all privileges on new (i.e. future) objects of a specified type in a database or schema granted to the account role.
DatabaseRole string
Lists all privileges on new (i.e. future) objects granted to the database role. Must be a fully qualified name ("<dbname>"."<databaserole_name>").
AccountRole string
Lists all privileges on new (i.e. future) objects of a specified type in a database or schema granted to the account role.
DatabaseRole string
Lists all privileges on new (i.e. future) objects granted to the database role. Must be a fully qualified name ("<dbname>"."<databaserole_name>").
accountRole String
Lists all privileges on new (i.e. future) objects of a specified type in a database or schema granted to the account role.
databaseRole String
Lists all privileges on new (i.e. future) objects granted to the database role. Must be a fully qualified name ("<dbname>"."<databaserole_name>").
accountRole string
Lists all privileges on new (i.e. future) objects of a specified type in a database or schema granted to the account role.
databaseRole string
Lists all privileges on new (i.e. future) objects granted to the database role. Must be a fully qualified name ("<dbname>"."<databaserole_name>").
account_role str
Lists all privileges on new (i.e. future) objects of a specified type in a database or schema granted to the account role.
database_role str
Lists all privileges on new (i.e. future) objects granted to the database role. Must be a fully qualified name ("<dbname>"."<databaserole_name>").
accountRole String
Lists all privileges on new (i.e. future) objects of a specified type in a database or schema granted to the account role.
databaseRole String
Lists all privileges on new (i.e. future) objects granted to the database role. Must be a fully qualified name ("<dbname>"."<databaserole_name>").

GetGrantsGrant

CreatedOn This property is required. string
The date and time the grant was created.
GrantOption This property is required. bool
Whether the grantee can grant the privilege to others.
GrantedBy This property is required. string
The role that granted the privilege.
GrantedOn This property is required. string
The object on which the privilege was granted.
GrantedTo This property is required. string
The role to which the privilege was granted.
GranteeName This property is required. string
The name of the role to which the privilege was granted.
Name This property is required. string
The name of the object on which the privilege was granted.
Privilege This property is required. string
The privilege granted.
CreatedOn This property is required. string
The date and time the grant was created.
GrantOption This property is required. bool
Whether the grantee can grant the privilege to others.
GrantedBy This property is required. string
The role that granted the privilege.
GrantedOn This property is required. string
The object on which the privilege was granted.
GrantedTo This property is required. string
The role to which the privilege was granted.
GranteeName This property is required. string
The name of the role to which the privilege was granted.
Name This property is required. string
The name of the object on which the privilege was granted.
Privilege This property is required. string
The privilege granted.
createdOn This property is required. String
The date and time the grant was created.
grantOption This property is required. Boolean
Whether the grantee can grant the privilege to others.
grantedBy This property is required. String
The role that granted the privilege.
grantedOn This property is required. String
The object on which the privilege was granted.
grantedTo This property is required. String
The role to which the privilege was granted.
granteeName This property is required. String
The name of the role to which the privilege was granted.
name This property is required. String
The name of the object on which the privilege was granted.
privilege This property is required. String
The privilege granted.
createdOn This property is required. string
The date and time the grant was created.
grantOption This property is required. boolean
Whether the grantee can grant the privilege to others.
grantedBy This property is required. string
The role that granted the privilege.
grantedOn This property is required. string
The object on which the privilege was granted.
grantedTo This property is required. string
The role to which the privilege was granted.
granteeName This property is required. string
The name of the role to which the privilege was granted.
name This property is required. string
The name of the object on which the privilege was granted.
privilege This property is required. string
The privilege granted.
created_on This property is required. str
The date and time the grant was created.
grant_option This property is required. bool
Whether the grantee can grant the privilege to others.
granted_by This property is required. str
The role that granted the privilege.
granted_on This property is required. str
The object on which the privilege was granted.
granted_to This property is required. str
The role to which the privilege was granted.
grantee_name This property is required. str
The name of the role to which the privilege was granted.
name This property is required. str
The name of the object on which the privilege was granted.
privilege This property is required. str
The privilege granted.
createdOn This property is required. String
The date and time the grant was created.
grantOption This property is required. Boolean
Whether the grantee can grant the privilege to others.
grantedBy This property is required. String
The role that granted the privilege.
grantedOn This property is required. String
The object on which the privilege was granted.
grantedTo This property is required. String
The role to which the privilege was granted.
granteeName This property is required. String
The name of the role to which the privilege was granted.
name This property is required. String
The name of the object on which the privilege was granted.
privilege This property is required. String
The privilege granted.

GetGrantsGrantsOf

AccountRole string
Lists all users and roles to which the account role has been granted.
ApplicationRole string
Lists all the users and roles to which the application role has been granted. Must be a fully qualified name ("<dbname>"."<databaserole_name>").
DatabaseRole string
Lists all users and roles to which the database role has been granted. Must be a fully qualified name ("<dbname>"."<databaserole_name>").
Share string
Lists all the accounts for the share and indicates the accounts that are using the share.
AccountRole string
Lists all users and roles to which the account role has been granted.
ApplicationRole string
Lists all the users and roles to which the application role has been granted. Must be a fully qualified name ("<dbname>"."<databaserole_name>").
DatabaseRole string
Lists all users and roles to which the database role has been granted. Must be a fully qualified name ("<dbname>"."<databaserole_name>").
Share string
Lists all the accounts for the share and indicates the accounts that are using the share.
accountRole String
Lists all users and roles to which the account role has been granted.
applicationRole String
Lists all the users and roles to which the application role has been granted. Must be a fully qualified name ("<dbname>"."<databaserole_name>").
databaseRole String
Lists all users and roles to which the database role has been granted. Must be a fully qualified name ("<dbname>"."<databaserole_name>").
share String
Lists all the accounts for the share and indicates the accounts that are using the share.
accountRole string
Lists all users and roles to which the account role has been granted.
applicationRole string
Lists all the users and roles to which the application role has been granted. Must be a fully qualified name ("<dbname>"."<databaserole_name>").
databaseRole string
Lists all users and roles to which the database role has been granted. Must be a fully qualified name ("<dbname>"."<databaserole_name>").
share string
Lists all the accounts for the share and indicates the accounts that are using the share.
account_role str
Lists all users and roles to which the account role has been granted.
application_role str
Lists all the users and roles to which the application role has been granted. Must be a fully qualified name ("<dbname>"."<databaserole_name>").
database_role str
Lists all users and roles to which the database role has been granted. Must be a fully qualified name ("<dbname>"."<databaserole_name>").
share str
Lists all the accounts for the share and indicates the accounts that are using the share.
accountRole String
Lists all users and roles to which the account role has been granted.
applicationRole String
Lists all the users and roles to which the application role has been granted. Must be a fully qualified name ("<dbname>"."<databaserole_name>").
databaseRole String
Lists all users and roles to which the database role has been granted. Must be a fully qualified name ("<dbname>"."<databaserole_name>").
share String
Lists all the accounts for the share and indicates the accounts that are using the share.

GetGrantsGrantsOn

Account bool
Object hierarchy to list privileges on. The only valid value is: ACCOUNT. Setting this attribute lists all the account-level (i.e. global) privileges that have been granted to roles.
ObjectName string
Name of object to list privileges on.
ObjectType string
Type of object to list privileges on.
Account bool
Object hierarchy to list privileges on. The only valid value is: ACCOUNT. Setting this attribute lists all the account-level (i.e. global) privileges that have been granted to roles.
ObjectName string
Name of object to list privileges on.
ObjectType string
Type of object to list privileges on.
account Boolean
Object hierarchy to list privileges on. The only valid value is: ACCOUNT. Setting this attribute lists all the account-level (i.e. global) privileges that have been granted to roles.
objectName String
Name of object to list privileges on.
objectType String
Type of object to list privileges on.
account boolean
Object hierarchy to list privileges on. The only valid value is: ACCOUNT. Setting this attribute lists all the account-level (i.e. global) privileges that have been granted to roles.
objectName string
Name of object to list privileges on.
objectType string
Type of object to list privileges on.
account bool
Object hierarchy to list privileges on. The only valid value is: ACCOUNT. Setting this attribute lists all the account-level (i.e. global) privileges that have been granted to roles.
object_name str
Name of object to list privileges on.
object_type str
Type of object to list privileges on.
account Boolean
Object hierarchy to list privileges on. The only valid value is: ACCOUNT. Setting this attribute lists all the account-level (i.e. global) privileges that have been granted to roles.
objectName String
Name of object to list privileges on.
objectType String
Type of object to list privileges on.

GetGrantsGrantsTo

AccountRole string
Lists all privileges and roles granted to the role.
Application string
Lists all the privileges and roles granted to the application.
ApplicationRole string
Lists all the privileges and roles granted to the application role. Must be a fully qualified name ("<appname>"."<approle_name>").
DatabaseRole string
Lists all privileges and roles granted to the database role. Must be a fully qualified name ("<dbname>"."<databaserole_name>").
Share GetGrantsGrantsToShare
Lists all the privileges granted to the share.
User string
Lists all the roles granted to the user. Note that the PUBLIC role, which is automatically available to every user, is not listed.
AccountRole string
Lists all privileges and roles granted to the role.
Application string
Lists all the privileges and roles granted to the application.
ApplicationRole string
Lists all the privileges and roles granted to the application role. Must be a fully qualified name ("<appname>"."<approle_name>").
DatabaseRole string
Lists all privileges and roles granted to the database role. Must be a fully qualified name ("<dbname>"."<databaserole_name>").
Share GetGrantsGrantsToShare
Lists all the privileges granted to the share.
User string
Lists all the roles granted to the user. Note that the PUBLIC role, which is automatically available to every user, is not listed.
accountRole String
Lists all privileges and roles granted to the role.
application String
Lists all the privileges and roles granted to the application.
applicationRole String
Lists all the privileges and roles granted to the application role. Must be a fully qualified name ("<appname>"."<approle_name>").
databaseRole String
Lists all privileges and roles granted to the database role. Must be a fully qualified name ("<dbname>"."<databaserole_name>").
share GetGrantsGrantsToShare
Lists all the privileges granted to the share.
user String
Lists all the roles granted to the user. Note that the PUBLIC role, which is automatically available to every user, is not listed.
accountRole string
Lists all privileges and roles granted to the role.
application string
Lists all the privileges and roles granted to the application.
applicationRole string
Lists all the privileges and roles granted to the application role. Must be a fully qualified name ("<appname>"."<approle_name>").
databaseRole string
Lists all privileges and roles granted to the database role. Must be a fully qualified name ("<dbname>"."<databaserole_name>").
share GetGrantsGrantsToShare
Lists all the privileges granted to the share.
user string
Lists all the roles granted to the user. Note that the PUBLIC role, which is automatically available to every user, is not listed.
account_role str
Lists all privileges and roles granted to the role.
application str
Lists all the privileges and roles granted to the application.
application_role str
Lists all the privileges and roles granted to the application role. Must be a fully qualified name ("<appname>"."<approle_name>").
database_role str
Lists all privileges and roles granted to the database role. Must be a fully qualified name ("<dbname>"."<databaserole_name>").
share GetGrantsGrantsToShare
Lists all the privileges granted to the share.
user str
Lists all the roles granted to the user. Note that the PUBLIC role, which is automatically available to every user, is not listed.
accountRole String
Lists all privileges and roles granted to the role.
application String
Lists all the privileges and roles granted to the application.
applicationRole String
Lists all the privileges and roles granted to the application role. Must be a fully qualified name ("<appname>"."<approle_name>").
databaseRole String
Lists all privileges and roles granted to the database role. Must be a fully qualified name ("<dbname>"."<databaserole_name>").
share Property Map
Lists all the privileges granted to the share.
user String
Lists all the roles granted to the user. Note that the PUBLIC role, which is automatically available to every user, is not listed.

GetGrantsGrantsToShare

ShareName This property is required. string
Lists all of the privileges and roles granted to the specified share.
ShareName This property is required. string
Lists all of the privileges and roles granted to the specified share.
shareName This property is required. String
Lists all of the privileges and roles granted to the specified share.
shareName This property is required. string
Lists all of the privileges and roles granted to the specified share.
share_name This property is required. str
Lists all of the privileges and roles granted to the specified share.
shareName This property is required. String
Lists all of the privileges and roles granted to the specified share.

Package Details

Repository
Snowflake pulumi/pulumi-snowflake
License
Apache-2.0
Notes
This Pulumi package is based on the snowflake Terraform Provider.
Snowflake v1.2.0 published on Monday, Apr 14, 2025 by Pulumi