1. Packages
  2. Snowflake
  3. API Docs
  4. RoleGrants
Snowflake v0.50.2 published on Friday, Mar 8, 2024 by Pulumi

snowflake.RoleGrants

Explore with Pulumi AI

snowflake logo
Snowflake v0.50.2 published on Friday, Mar 8, 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

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Snowflake = Pulumi.Snowflake;
    
    return await Deployment.RunAsync(() => 
    {
        var role = new Snowflake.Role("role", new()
        {
            Comment = "for testing",
        });
    
        var user = new Snowflake.User("user", new()
        {
            Comment = "for testing",
        });
    
        var user2 = new Snowflake.User("user2", new()
        {
            Comment = "for testing",
        });
    
        var otherRole = new Snowflake.Role("otherRole");
    
        var grants = new Snowflake.RoleGrants("grants", new()
        {
            RoleName = role.Name,
            Roles = new[]
            {
                otherRole.Name,
            },
            Users = new[]
            {
                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{
    			Comment: pulumi.String("for testing"),
    		})
    		if err != nil {
    			return err
    		}
    		user, err := snowflake.NewUser(ctx, "user", &snowflake.UserArgs{
    			Comment: pulumi.String("for testing"),
    		})
    		if err != nil {
    			return err
    		}
    		user2, err := snowflake.NewUser(ctx, "user2", &snowflake.UserArgs{
    			Comment: pulumi.String("for testing"),
    		})
    		if err != nil {
    			return err
    		}
    		otherRole, err := snowflake.NewRole(ctx, "otherRole", nil)
    		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
    	})
    }
    
    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()        
                .comment("for testing")
                .build());
    
            var user = new User("user", UserArgs.builder()        
                .comment("for testing")
                .build());
    
            var user2 = new User("user2", UserArgs.builder()        
                .comment("for testing")
                .build());
    
            var otherRole = new Role("otherRole");
    
            var grants = new RoleGrants("grants", RoleGrantsArgs.builder()        
                .roleName(role.name())
                .roles(otherRole.name())
                .users(            
                    user.name(),
                    user2.name())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_snowflake as snowflake
    
    role = snowflake.Role("role", comment="for testing")
    user = snowflake.User("user", comment="for testing")
    user2 = snowflake.User("user2", comment="for testing")
    other_role = snowflake.Role("otherRole")
    grants = snowflake.RoleGrants("grants",
        role_name=role.name,
        roles=[other_role.name],
        users=[
            user.name,
            user2.name,
        ])
    
    import * as pulumi from "@pulumi/pulumi";
    import * as snowflake from "@pulumi/snowflake";
    
    const role = new snowflake.Role("role", {comment: "for testing"});
    const user = new snowflake.User("user", {comment: "for testing"});
    const user2 = new snowflake.User("user2", {comment: "for testing"});
    const otherRole = new snowflake.Role("otherRole", {});
    const grants = new snowflake.RoleGrants("grants", {
        roleName: role.name,
        roles: [otherRole.name],
        users: [
            user.name,
            user2.name,
        ],
    });
    
    resources:
      role:
        type: snowflake:Role
        properties:
          comment: for testing
      user:
        type: snowflake:User
        properties:
          comment: for testing
      user2:
        type: snowflake:User
        properties:
          comment: for testing
      otherRole:
        type: snowflake:Role
      grants:
        type: snowflake:RoleGrants
        properties:
          roleName: ${role.name}
          roles:
            - ${otherRole.name}
          users:
            - ${user.name}
            - ${user2.name}
    

    Create RoleGrants Resource

    new RoleGrants(name: string, args: RoleGrantsArgs, opts?: CustomResourceOptions);
    @overload
    def RoleGrants(resource_name: 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)
    @overload
    def RoleGrants(resource_name: str,
                   args: RoleGrantsArgs,
                   opts: Optional[ResourceOptions] = 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.
    
    
    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.

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

    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.50.2 published on Friday, Mar 8, 2024 by Pulumi