1. Packages
  2. Snowflake
  3. API Docs
  4. RoleGrants
Snowflake v0.55.0 published on Friday, Jun 7, 2024 by Pulumi

snowflake.RoleGrants

Explore with Pulumi AI

snowflake logo
Snowflake v0.55.0 published on Friday, Jun 7, 2024 by Pulumi

    Deprecation This resource is deprecated and will be removed in a future major version release. Please use snowflake.GrantAccountRole instead.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as snowflake from "@pulumi/snowflake";
    
    const role = new snowflake.Role("role", {
        name: "rking_test_role",
        comment: "for testing",
    });
    const user = new snowflake.User("user", {
        name: "rking_test_user",
        comment: "for testing",
    });
    const user2 = new snowflake.User("user2", {
        name: "rking_test_user2",
        comment: "for testing",
    });
    const otherRole = new snowflake.Role("other_role", {name: "rking_test_role2"});
    const grants = new snowflake.RoleGrants("grants", {
        roleName: role.name,
        roles: [otherRole.name],
        users: [
            user.name,
            user2.name,
        ],
    });
    
    import pulumi
    import pulumi_snowflake as snowflake
    
    role = snowflake.Role("role",
        name="rking_test_role",
        comment="for testing")
    user = snowflake.User("user",
        name="rking_test_user",
        comment="for testing")
    user2 = snowflake.User("user2",
        name="rking_test_user2",
        comment="for testing")
    other_role = snowflake.Role("other_role", name="rking_test_role2")
    grants = snowflake.RoleGrants("grants",
        role_name=role.name,
        roles=[other_role.name],
        users=[
            user.name,
            user2.name,
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-snowflake/sdk/go/snowflake"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		role, err := snowflake.NewRole(ctx, "role", &snowflake.RoleArgs{
    			Name:    pulumi.String("rking_test_role"),
    			Comment: pulumi.String("for testing"),
    		})
    		if err != nil {
    			return err
    		}
    		user, err := snowflake.NewUser(ctx, "user", &snowflake.UserArgs{
    			Name:    pulumi.String("rking_test_user"),
    			Comment: pulumi.String("for testing"),
    		})
    		if err != nil {
    			return err
    		}
    		user2, err := snowflake.NewUser(ctx, "user2", &snowflake.UserArgs{
    			Name:    pulumi.String("rking_test_user2"),
    			Comment: pulumi.String("for testing"),
    		})
    		if err != nil {
    			return err
    		}
    		otherRole, err := snowflake.NewRole(ctx, "other_role", &snowflake.RoleArgs{
    			Name: pulumi.String("rking_test_role2"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = snowflake.NewRoleGrants(ctx, "grants", &snowflake.RoleGrantsArgs{
    			RoleName: role.Name,
    			Roles: pulumi.StringArray{
    				otherRole.Name,
    			},
    			Users: pulumi.StringArray{
    				user.Name,
    				user2.Name,
    			},
    		})
    		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 role = new Snowflake.Role("role", new()
        {
            Name = "rking_test_role",
            Comment = "for testing",
        });
    
        var user = new Snowflake.User("user", new()
        {
            Name = "rking_test_user",
            Comment = "for testing",
        });
    
        var user2 = new Snowflake.User("user2", new()
        {
            Name = "rking_test_user2",
            Comment = "for testing",
        });
    
        var otherRole = new Snowflake.Role("other_role", new()
        {
            Name = "rking_test_role2",
        });
    
        var grants = new Snowflake.RoleGrants("grants", new()
        {
            RoleName = role.Name,
            Roles = new[]
            {
                otherRole.Name,
            },
            Users = new[]
            {
                user.Name,
                user2.Name,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.snowflake.Role;
    import com.pulumi.snowflake.RoleArgs;
    import com.pulumi.snowflake.User;
    import com.pulumi.snowflake.UserArgs;
    import com.pulumi.snowflake.RoleGrants;
    import com.pulumi.snowflake.RoleGrantsArgs;
    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 role = new Role("role", RoleArgs.builder()
                .name("rking_test_role")
                .comment("for testing")
                .build());
    
            var user = new User("user", UserArgs.builder()
                .name("rking_test_user")
                .comment("for testing")
                .build());
    
            var user2 = new User("user2", UserArgs.builder()
                .name("rking_test_user2")
                .comment("for testing")
                .build());
    
            var otherRole = new Role("otherRole", RoleArgs.builder()
                .name("rking_test_role2")
                .build());
    
            var grants = new RoleGrants("grants", RoleGrantsArgs.builder()
                .roleName(role.name())
                .roles(otherRole.name())
                .users(            
                    user.name(),
                    user2.name())
                .build());
    
        }
    }
    
    resources:
      role:
        type: snowflake:Role
        properties:
          name: rking_test_role
          comment: for testing
      user:
        type: snowflake:User
        properties:
          name: rking_test_user
          comment: for testing
      user2:
        type: snowflake:User
        properties:
          name: rking_test_user2
          comment: for testing
      otherRole:
        type: snowflake:Role
        name: other_role
        properties:
          name: rking_test_role2
      grants:
        type: snowflake:RoleGrants
        properties:
          roleName: ${role.name}
          roles:
            - ${otherRole.name}
          users:
            - ${user.name}
            - ${user2.name}
    

    Create RoleGrants Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new RoleGrants(name: string, args: RoleGrantsArgs, opts?: CustomResourceOptions);
    @overload
    def RoleGrants(resource_name: str,
                   args: RoleGrantsArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def RoleGrants(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   role_name: Optional[str] = None,
                   enable_multiple_grants: Optional[bool] = None,
                   roles: Optional[Sequence[str]] = None,
                   users: Optional[Sequence[str]] = None)
    func NewRoleGrants(ctx *Context, name string, args RoleGrantsArgs, opts ...ResourceOption) (*RoleGrants, error)
    public RoleGrants(string name, RoleGrantsArgs args, CustomResourceOptions? opts = null)
    public RoleGrants(String name, RoleGrantsArgs args)
    public RoleGrants(String name, RoleGrantsArgs args, CustomResourceOptions options)
    
    type: snowflake:RoleGrants
    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 RoleGrantsArgs
    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 RoleGrantsArgs
    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 RoleGrantsArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RoleGrantsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RoleGrantsArgs
    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 roleGrantsResource = new Snowflake.RoleGrants("roleGrantsResource", new()
    {
        RoleName = "string",
        EnableMultipleGrants = false,
        Roles = new[]
        {
            "string",
        },
        Users = new[]
        {
            "string",
        },
    });
    
    example, err := snowflake.NewRoleGrants(ctx, "roleGrantsResource", &snowflake.RoleGrantsArgs{
    	RoleName:             pulumi.String("string"),
    	EnableMultipleGrants: pulumi.Bool(false),
    	Roles: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Users: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    })
    
    var roleGrantsResource = new RoleGrants("roleGrantsResource", RoleGrantsArgs.builder()
        .roleName("string")
        .enableMultipleGrants(false)
        .roles("string")
        .users("string")
        .build());
    
    role_grants_resource = snowflake.RoleGrants("roleGrantsResource",
        role_name="string",
        enable_multiple_grants=False,
        roles=["string"],
        users=["string"])
    
    const roleGrantsResource = new snowflake.RoleGrants("roleGrantsResource", {
        roleName: "string",
        enableMultipleGrants: false,
        roles: ["string"],
        users: ["string"],
    });
    
    type: snowflake:RoleGrants
    properties:
        enableMultipleGrants: false
        roleName: string
        roles:
            - string
        users:
            - string
    

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

    RoleName string
    The name of the role we are granting.
    EnableMultipleGrants bool
    Roles List<string>
    Grants role to this specified role.
    Users List<string>
    Grants role to this specified user.
    RoleName string
    The name of the role we are granting.
    EnableMultipleGrants bool
    Roles []string
    Grants role to this specified role.
    Users []string
    Grants role to this specified user.
    roleName String
    The name of the role we are granting.
    enableMultipleGrants Boolean
    roles List<String>
    Grants role to this specified role.
    users List<String>
    Grants role to this specified user.
    roleName string
    The name of the role we are granting.
    enableMultipleGrants boolean
    roles string[]
    Grants role to this specified role.
    users string[]
    Grants role to this specified user.
    role_name str
    The name of the role we are granting.
    enable_multiple_grants bool
    roles Sequence[str]
    Grants role to this specified role.
    users Sequence[str]
    Grants role to this specified user.
    roleName String
    The name of the role we are granting.
    enableMultipleGrants Boolean
    roles List<String>
    Grants role to this specified role.
    users List<String>
    Grants role to this specified user.

    Outputs

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

    Get an existing RoleGrants 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?: RoleGrantsState, opts?: CustomResourceOptions): RoleGrants
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            enable_multiple_grants: Optional[bool] = None,
            role_name: Optional[str] = None,
            roles: Optional[Sequence[str]] = None,
            users: Optional[Sequence[str]] = None) -> RoleGrants
    func GetRoleGrants(ctx *Context, name string, id IDInput, state *RoleGrantsState, opts ...ResourceOption) (*RoleGrants, error)
    public static RoleGrants Get(string name, Input<string> id, RoleGrantsState? state, CustomResourceOptions? opts = null)
    public static RoleGrants get(String name, Output<String> id, RoleGrantsState 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:
    EnableMultipleGrants bool
    RoleName string
    The name of the role we are granting.
    Roles List<string>
    Grants role to this specified role.
    Users List<string>
    Grants role to this specified user.
    EnableMultipleGrants bool
    RoleName string
    The name of the role we are granting.
    Roles []string
    Grants role to this specified role.
    Users []string
    Grants role to this specified user.
    enableMultipleGrants Boolean
    roleName String
    The name of the role we are granting.
    roles List<String>
    Grants role to this specified role.
    users List<String>
    Grants role to this specified user.
    enableMultipleGrants boolean
    roleName string
    The name of the role we are granting.
    roles string[]
    Grants role to this specified role.
    users string[]
    Grants role to this specified user.
    enable_multiple_grants bool
    role_name str
    The name of the role we are granting.
    roles Sequence[str]
    Grants role to this specified role.
    users Sequence[str]
    Grants role to this specified user.
    enableMultipleGrants Boolean
    roleName String
    The name of the role we are granting.
    roles List<String>
    Grants role to this specified role.
    users List<String>
    Grants role to this specified user.

    Import

    format is role_name|roles|users

    $ pulumi import snowflake:index/roleGrants:RoleGrants example "role_name|role1,role2|user1,user2"
    

    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 snowflake Terraform Provider.
    snowflake logo
    Snowflake v0.55.0 published on Friday, Jun 7, 2024 by Pulumi