1. Packages
  2. Snowflake Provider
  3. API Docs
  4. getDatabaseRole
Snowflake v1.1.4 published on Wednesday, Mar 26, 2025 by Pulumi

snowflake.getDatabaseRole

Explore with Pulumi AI

Snowflake v1.1.4 published on Wednesday, Mar 26, 2025 by Pulumi

!> 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.

Example Usage

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

const dbRole = snowflake.getDatabaseRole({
    database: "MYDB",
    name: "DBROLE",
});
Copy
import pulumi
import pulumi_snowflake as snowflake

db_role = snowflake.get_database_role(database="MYDB",
    name="DBROLE")
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 {
		_, err := snowflake.LookupDatabaseRole(ctx, &snowflake.LookupDatabaseRoleArgs{
			Database: "MYDB",
			Name:     "DBROLE",
		}, 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(() => 
{
    var dbRole = Snowflake.GetDatabaseRole.Invoke(new()
    {
        Database = "MYDB",
        Name = "DBROLE",
    });

});
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.GetDatabaseRoleArgs;
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) {
        final var dbRole = SnowflakeFunctions.getDatabaseRole(GetDatabaseRoleArgs.builder()
            .database("MYDB")
            .name("DBROLE")
            .build());

    }
}
Copy
variables:
  dbRole:
    fn::invoke:
      function: snowflake:getDatabaseRole
      arguments:
        database: MYDB
        name: DBROLE
Copy

Using getDatabaseRole

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 getDatabaseRole(args: GetDatabaseRoleArgs, opts?: InvokeOptions): Promise<GetDatabaseRoleResult>
function getDatabaseRoleOutput(args: GetDatabaseRoleOutputArgs, opts?: InvokeOptions): Output<GetDatabaseRoleResult>
Copy
def get_database_role(database: Optional[str] = None,
                      name: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetDatabaseRoleResult
def get_database_role_output(database: Optional[pulumi.Input[str]] = None,
                      name: Optional[pulumi.Input[str]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetDatabaseRoleResult]
Copy
func LookupDatabaseRole(ctx *Context, args *LookupDatabaseRoleArgs, opts ...InvokeOption) (*LookupDatabaseRoleResult, error)
func LookupDatabaseRoleOutput(ctx *Context, args *LookupDatabaseRoleOutputArgs, opts ...InvokeOption) LookupDatabaseRoleResultOutput
Copy

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

public static class GetDatabaseRole 
{
    public static Task<GetDatabaseRoleResult> InvokeAsync(GetDatabaseRoleArgs args, InvokeOptions? opts = null)
    public static Output<GetDatabaseRoleResult> Invoke(GetDatabaseRoleInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetDatabaseRoleResult> getDatabaseRole(GetDatabaseRoleArgs args, InvokeOptions options)
public static Output<GetDatabaseRoleResult> getDatabaseRole(GetDatabaseRoleArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: snowflake:index/getDatabaseRole:getDatabaseRole
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Database This property is required. string
The database from which to return the database role from.
Name This property is required. string
Database role name.
Database This property is required. string
The database from which to return the database role from.
Name This property is required. string
Database role name.
database This property is required. String
The database from which to return the database role from.
name This property is required. String
Database role name.
database This property is required. string
The database from which to return the database role from.
name This property is required. string
Database role name.
database This property is required. str
The database from which to return the database role from.
name This property is required. str
Database role name.
database This property is required. String
The database from which to return the database role from.
name This property is required. String
Database role name.

getDatabaseRole Result

The following output properties are available:

Comment string
The comment on the role
Database string
The database from which to return the database role from.
Id string
The provider-assigned unique ID for this managed resource.
Name string
Database role name.
Owner string
The owner of the role
Comment string
The comment on the role
Database string
The database from which to return the database role from.
Id string
The provider-assigned unique ID for this managed resource.
Name string
Database role name.
Owner string
The owner of the role
comment String
The comment on the role
database String
The database from which to return the database role from.
id String
The provider-assigned unique ID for this managed resource.
name String
Database role name.
owner String
The owner of the role
comment string
The comment on the role
database string
The database from which to return the database role from.
id string
The provider-assigned unique ID for this managed resource.
name string
Database role name.
owner string
The owner of the role
comment str
The comment on the role
database str
The database from which to return the database role from.
id str
The provider-assigned unique ID for this managed resource.
name str
Database role name.
owner str
The owner of the role
comment String
The comment on the role
database String
The database from which to return the database role from.
id String
The provider-assigned unique ID for this managed resource.
name String
Database role name.
owner String
The owner of the role

Package Details

Repository
Snowflake pulumi/pulumi-snowflake
License
Apache-2.0
Notes
This Pulumi package is based on the snowflake Terraform Provider.
Snowflake v1.1.4 published on Wednesday, Mar 26, 2025 by Pulumi