1. Packages
  2. Snowflake
  3. API Docs
  4. GrantAccountRole
Snowflake v0.52.0 published on Thursday, Apr 18, 2024 by Pulumi

snowflake.GrantAccountRole

Explore with Pulumi AI

snowflake logo
Snowflake v0.52.0 published on Thursday, Apr 18, 2024 by Pulumi

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as snowflake from "@pulumi/snowflake";
    
    //#################################
    //## grant account role to account role
    //#################################
    const roleRole = new snowflake.Role("roleRole", {});
    const parentRole = new snowflake.Role("parentRole", {});
    const grantAccountRole = new snowflake.GrantAccountRole("grantAccountRole", {
        roleName: roleRole.name,
        parentRoleName: parentRole.name,
    });
    //#################################
    //## grant account role to user
    //#################################
    const roleIndex_roleRole = new snowflake.Role("roleIndex/roleRole", {});
    const user = new snowflake.User("user", {});
    const index_grantAccountRoleGrantAccountRole = new snowflake.GrantAccountRole("index/grantAccountRoleGrantAccountRole", {
        roleName: roleRole.name,
        userName: user.name,
    });
    
    import pulumi
    import pulumi_snowflake as snowflake
    
    ##################################
    ### grant account role to account role
    ##################################
    role_role = snowflake.Role("roleRole")
    parent_role = snowflake.Role("parentRole")
    grant_account_role = snowflake.GrantAccountRole("grantAccountRole",
        role_name=role_role.name,
        parent_role_name=parent_role.name)
    ##################################
    ### grant account role to user
    ##################################
    role_index_role_role = snowflake.Role("roleIndex/roleRole")
    user = snowflake.User("user")
    index_grant_account_role_grant_account_role = snowflake.GrantAccountRole("index/grantAccountRoleGrantAccountRole",
        role_name=role_role.name,
        user_name=user.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 {
    		// #################################
    		// ## grant account role to account role
    		// #################################
    		roleRole, err := snowflake.NewRole(ctx, "roleRole", nil)
    		if err != nil {
    			return err
    		}
    		parentRole, err := snowflake.NewRole(ctx, "parentRole", nil)
    		if err != nil {
    			return err
    		}
    		_, err = snowflake.NewGrantAccountRole(ctx, "grantAccountRole", &snowflake.GrantAccountRoleArgs{
    			RoleName:       roleRole.Name,
    			ParentRoleName: parentRole.Name,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = snowflake.NewRole(ctx, "roleIndex/roleRole", nil)
    		if err != nil {
    			return err
    		}
    		user, err := snowflake.NewUser(ctx, "user", nil)
    		if err != nil {
    			return err
    		}
    		_, err = snowflake.NewGrantAccountRole(ctx, "index/grantAccountRoleGrantAccountRole", &snowflake.GrantAccountRoleArgs{
    			RoleName: roleRole.Name,
    			UserName: user.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(() => 
    {
        //#################################
        //## grant account role to account role
        //#################################
        var roleRole = new Snowflake.Role("roleRole");
    
        var parentRole = new Snowflake.Role("parentRole");
    
        var grantAccountRole = new Snowflake.GrantAccountRole("grantAccountRole", new()
        {
            RoleName = roleRole.Name,
            ParentRoleName = parentRole.Name,
        });
    
        //#################################
        //## grant account role to user
        //#################################
        var roleIndex_roleRole = new Snowflake.Role("roleIndex/roleRole");
    
        var user = new Snowflake.User("user");
    
        var index_grantAccountRoleGrantAccountRole = new Snowflake.GrantAccountRole("index/grantAccountRoleGrantAccountRole", new()
        {
            RoleName = roleRole.Name,
            UserName = user.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.GrantAccountRole;
    import com.pulumi.snowflake.GrantAccountRoleArgs;
    import com.pulumi.snowflake.User;
    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) {
            //#################################
            //## grant account role to account role
            //#################################
            var roleRole = new Role("roleRole");
    
            var parentRole = new Role("parentRole");
    
            var grantAccountRole = new GrantAccountRole("grantAccountRole", GrantAccountRoleArgs.builder()        
                .roleName(roleRole.name())
                .parentRoleName(parentRole.name())
                .build());
    
            //#################################
            //## grant account role to user
            //#################################
            var roleIndex_roleRole = new Role("roleIndex/roleRole");
    
            var user = new User("user");
    
            var index_grantAccountRoleGrantAccountRole = new GrantAccountRole("index/grantAccountRoleGrantAccountRole", GrantAccountRoleArgs.builder()        
                .roleName(roleRole.name())
                .userName(user.name())
                .build());
    
        }
    }
    
    resources:
      ##################################
      ### grant account role to account role
      ##################################
      roleRole:
        type: snowflake:Role
      parentRole:
        type: snowflake:Role
      grantAccountRole: ##################################
      ### grant account role to user
      ##################################
        type: snowflake:GrantAccountRole
        properties:
          roleName: ${roleRole.name}
          parentRoleName: ${parentRole.name}
      roleIndex/roleRole:
        type: snowflake:Role
      user:
        type: snowflake:User
      index/grantAccountRoleGrantAccountRole:
        type: snowflake:GrantAccountRole
        properties:
          roleName: ${roleRole.name}
          userName: ${user.name}
    

    Create GrantAccountRole Resource

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

    Constructor syntax

    new GrantAccountRole(name: string, args: GrantAccountRoleArgs, opts?: CustomResourceOptions);
    @overload
    def GrantAccountRole(resource_name: str,
                         args: GrantAccountRoleArgs,
                         opts: Optional[ResourceOptions] = None)
    
    @overload
    def GrantAccountRole(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         role_name: Optional[str] = None,
                         parent_role_name: Optional[str] = None,
                         user_name: Optional[str] = None)
    func NewGrantAccountRole(ctx *Context, name string, args GrantAccountRoleArgs, opts ...ResourceOption) (*GrantAccountRole, error)
    public GrantAccountRole(string name, GrantAccountRoleArgs args, CustomResourceOptions? opts = null)
    public GrantAccountRole(String name, GrantAccountRoleArgs args)
    public GrantAccountRole(String name, GrantAccountRoleArgs args, CustomResourceOptions options)
    
    type: snowflake:GrantAccountRole
    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 GrantAccountRoleArgs
    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 GrantAccountRoleArgs
    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 GrantAccountRoleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args GrantAccountRoleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args GrantAccountRoleArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var grantAccountRoleResource = new Snowflake.GrantAccountRole("grantAccountRoleResource", new()
    {
        RoleName = "string",
        ParentRoleName = "string",
        UserName = "string",
    });
    
    example, err := snowflake.NewGrantAccountRole(ctx, "grantAccountRoleResource", &snowflake.GrantAccountRoleArgs{
    	RoleName:       pulumi.String("string"),
    	ParentRoleName: pulumi.String("string"),
    	UserName:       pulumi.String("string"),
    })
    
    var grantAccountRoleResource = new GrantAccountRole("grantAccountRoleResource", GrantAccountRoleArgs.builder()        
        .roleName("string")
        .parentRoleName("string")
        .userName("string")
        .build());
    
    grant_account_role_resource = snowflake.GrantAccountRole("grantAccountRoleResource",
        role_name="string",
        parent_role_name="string",
        user_name="string")
    
    const grantAccountRoleResource = new snowflake.GrantAccountRole("grantAccountRoleResource", {
        roleName: "string",
        parentRoleName: "string",
        userName: "string",
    });
    
    type: snowflake:GrantAccountRole
    properties:
        parentRoleName: string
        roleName: string
        userName: string
    

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

    RoleName string
    The fully qualified name of the role which will be granted to the user or parent role.
    ParentRoleName string
    The fully qualified name of the parent role which will create a parent-child relationship between the roles.
    UserName string
    The fully qualified name of the user on which specified role will be granted.
    RoleName string
    The fully qualified name of the role which will be granted to the user or parent role.
    ParentRoleName string
    The fully qualified name of the parent role which will create a parent-child relationship between the roles.
    UserName string
    The fully qualified name of the user on which specified role will be granted.
    roleName String
    The fully qualified name of the role which will be granted to the user or parent role.
    parentRoleName String
    The fully qualified name of the parent role which will create a parent-child relationship between the roles.
    userName String
    The fully qualified name of the user on which specified role will be granted.
    roleName string
    The fully qualified name of the role which will be granted to the user or parent role.
    parentRoleName string
    The fully qualified name of the parent role which will create a parent-child relationship between the roles.
    userName string
    The fully qualified name of the user on which specified role will be granted.
    role_name str
    The fully qualified name of the role which will be granted to the user or parent role.
    parent_role_name str
    The fully qualified name of the parent role which will create a parent-child relationship between the roles.
    user_name str
    The fully qualified name of the user on which specified role will be granted.
    roleName String
    The fully qualified name of the role which will be granted to the user or parent role.
    parentRoleName String
    The fully qualified name of the parent role which will create a parent-child relationship between the roles.
    userName String
    The fully qualified name of the user on which specified role will be granted.

    Outputs

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

    Get an existing GrantAccountRole 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?: GrantAccountRoleState, opts?: CustomResourceOptions): GrantAccountRole
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            parent_role_name: Optional[str] = None,
            role_name: Optional[str] = None,
            user_name: Optional[str] = None) -> GrantAccountRole
    func GetGrantAccountRole(ctx *Context, name string, id IDInput, state *GrantAccountRoleState, opts ...ResourceOption) (*GrantAccountRole, error)
    public static GrantAccountRole Get(string name, Input<string> id, GrantAccountRoleState? state, CustomResourceOptions? opts = null)
    public static GrantAccountRole get(String name, Output<String> id, GrantAccountRoleState 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:
    ParentRoleName string
    The fully qualified name of the parent role which will create a parent-child relationship between the roles.
    RoleName string
    The fully qualified name of the role which will be granted to the user or parent role.
    UserName string
    The fully qualified name of the user on which specified role will be granted.
    ParentRoleName string
    The fully qualified name of the parent role which will create a parent-child relationship between the roles.
    RoleName string
    The fully qualified name of the role which will be granted to the user or parent role.
    UserName string
    The fully qualified name of the user on which specified role will be granted.
    parentRoleName String
    The fully qualified name of the parent role which will create a parent-child relationship between the roles.
    roleName String
    The fully qualified name of the role which will be granted to the user or parent role.
    userName String
    The fully qualified name of the user on which specified role will be granted.
    parentRoleName string
    The fully qualified name of the parent role which will create a parent-child relationship between the roles.
    roleName string
    The fully qualified name of the role which will be granted to the user or parent role.
    userName string
    The fully qualified name of the user on which specified role will be granted.
    parent_role_name str
    The fully qualified name of the parent role which will create a parent-child relationship between the roles.
    role_name str
    The fully qualified name of the role which will be granted to the user or parent role.
    user_name str
    The fully qualified name of the user on which specified role will be granted.
    parentRoleName String
    The fully qualified name of the parent role which will create a parent-child relationship between the roles.
    roleName String
    The fully qualified name of the role which will be granted to the user or parent role.
    userName String
    The fully qualified name of the user on which specified role will be granted.

    Import

    format is role_name (string) | grantee_object_type (ROLE|USER) | grantee_name (string)

    $ pulumi import snowflake:index/grantAccountRole:GrantAccountRole "\"test_role\"|ROLE|\"test_parent_role\""
    

    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.52.0 published on Thursday, Apr 18, 2024 by Pulumi