1. Packages
  2. dbt Cloud
  3. API Docs
  4. UserGroups
dbt Cloud v0.1.8 published on Tuesday, Jun 11, 2024 by Pulumi

dbtcloud.UserGroups

Explore with Pulumi AI

dbtcloud logo
dbt Cloud v0.1.8 published on Tuesday, Jun 11, 2024 by Pulumi

    Assigns a set of dbt Cloud groups to a given User ID.

    If additional groups were assigned manually in dbt Cloud, they will be removed. The full list of groups need to be provided as config.

    This resource does not currently support deletion (e.g. a deleted resource will stay as-is in dbt Cloud). This is intentional in order to prevent accidental deletion of all users groups assigned to a user. If you would like a different behavior, please open an issue on GitHub. To remove all groups for a user, set “group_ids” to the empty set “[]”.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as dbtcloud from "@pulumi/dbtcloud";
    
    // we can assign groups to users
    const myUserGroups = new dbtcloud.UserGroups("my_user_groups", {
        userId: myUser.id,
        groupIds: [
            1234,
            myGroup.id,
            myGroupId,
        ],
    });
    // as Delete is not handled currently, by design, removing all groups from a user can be done with
    const myOtherUserGroups = new dbtcloud.UserGroups("my_other_user_groups", {
        userId: 123456,
        groupIds: [],
    });
    
    import pulumi
    import pulumi_dbtcloud as dbtcloud
    
    # we can assign groups to users
    my_user_groups = dbtcloud.UserGroups("my_user_groups",
        user_id=my_user["id"],
        group_ids=[
            1234,
            my_group["id"],
            my_group_id,
        ])
    # as Delete is not handled currently, by design, removing all groups from a user can be done with
    my_other_user_groups = dbtcloud.UserGroups("my_other_user_groups",
        user_id=123456,
        group_ids=[])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-dbtcloud/sdk/go/dbtcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// we can assign groups to users
    		_, err := dbtcloud.NewUserGroups(ctx, "my_user_groups", &dbtcloud.UserGroupsArgs{
    			UserId: pulumi.Any(myUser.Id),
    			GroupIds: pulumi.IntArray{
    				pulumi.Int(1234),
    				myGroup.Id,
    				myGroupId,
    			},
    		})
    		if err != nil {
    			return err
    		}
    		// as Delete is not handled currently, by design, removing all groups from a user can be done with
    		_, err = dbtcloud.NewUserGroups(ctx, "my_other_user_groups", &dbtcloud.UserGroupsArgs{
    			UserId:   pulumi.Int(123456),
    			GroupIds: pulumi.IntArray{},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using DbtCloud = Pulumi.DbtCloud;
    
    return await Deployment.RunAsync(() => 
    {
        // we can assign groups to users
        var myUserGroups = new DbtCloud.UserGroups("my_user_groups", new()
        {
            UserId = myUser.Id,
            GroupIds = new[]
            {
                1234,
                myGroup.Id,
                myGroupId,
            },
        });
    
        // as Delete is not handled currently, by design, removing all groups from a user can be done with
        var myOtherUserGroups = new DbtCloud.UserGroups("my_other_user_groups", new()
        {
            UserId = 123456,
            GroupIds = new[] {},
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.dbtcloud.UserGroups;
    import com.pulumi.dbtcloud.UserGroupsArgs;
    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) {
            // we can assign groups to users
            var myUserGroups = new UserGroups("myUserGroups", UserGroupsArgs.builder()
                .userId(myUser.id())
                .groupIds(            
                    1234,
                    myGroup.id(),
                    myGroupId)
                .build());
    
            // as Delete is not handled currently, by design, removing all groups from a user can be done with
            var myOtherUserGroups = new UserGroups("myOtherUserGroups", UserGroupsArgs.builder()
                .userId(123456)
                .groupIds()
                .build());
    
        }
    }
    
    resources:
      # we can assign groups to users
      myUserGroups:
        type: dbtcloud:UserGroups
        name: my_user_groups
        properties:
          userId: ${myUser.id}
          groupIds:
            - 1234
            - ${myGroup.id}
            - ${myGroupId}
      # as Delete is not handled currently, by design, removing all groups from a user can be done with
      myOtherUserGroups:
        type: dbtcloud:UserGroups
        name: my_other_user_groups
        properties:
          userId: 123456
          groupIds: []
    

    Create UserGroups Resource

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

    Constructor syntax

    new UserGroups(name: string, args: UserGroupsArgs, opts?: CustomResourceOptions);
    @overload
    def UserGroups(resource_name: str,
                   args: UserGroupsArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def UserGroups(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   group_ids: Optional[Sequence[int]] = None,
                   user_id: Optional[int] = None)
    func NewUserGroups(ctx *Context, name string, args UserGroupsArgs, opts ...ResourceOption) (*UserGroups, error)
    public UserGroups(string name, UserGroupsArgs args, CustomResourceOptions? opts = null)
    public UserGroups(String name, UserGroupsArgs args)
    public UserGroups(String name, UserGroupsArgs args, CustomResourceOptions options)
    
    type: dbtcloud:UserGroups
    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 UserGroupsArgs
    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 UserGroupsArgs
    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 UserGroupsArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args UserGroupsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args UserGroupsArgs
    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 userGroupsResource = new DbtCloud.UserGroups("userGroupsResource", new()
    {
        GroupIds = new[]
        {
            0,
        },
        UserId = 0,
    });
    
    example, err := dbtcloud.NewUserGroups(ctx, "userGroupsResource", &dbtcloud.UserGroupsArgs{
    	GroupIds: pulumi.IntArray{
    		pulumi.Int(0),
    	},
    	UserId: pulumi.Int(0),
    })
    
    var userGroupsResource = new UserGroups("userGroupsResource", UserGroupsArgs.builder()
        .groupIds(0)
        .userId(0)
        .build());
    
    user_groups_resource = dbtcloud.UserGroups("userGroupsResource",
        group_ids=[0],
        user_id=0)
    
    const userGroupsResource = new dbtcloud.UserGroups("userGroupsResource", {
        groupIds: [0],
        userId: 0,
    });
    
    type: dbtcloud:UserGroups
    properties:
        groupIds:
            - 0
        userId: 0
    

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

    GroupIds List<int>
    IDs of the groups to assign to the user. If additional groups were assigned manually in dbt Cloud, they will be removed.
    UserId int
    The internal ID of a dbt Cloud user
    GroupIds []int
    IDs of the groups to assign to the user. If additional groups were assigned manually in dbt Cloud, they will be removed.
    UserId int
    The internal ID of a dbt Cloud user
    groupIds List<Integer>
    IDs of the groups to assign to the user. If additional groups were assigned manually in dbt Cloud, they will be removed.
    userId Integer
    The internal ID of a dbt Cloud user
    groupIds number[]
    IDs of the groups to assign to the user. If additional groups were assigned manually in dbt Cloud, they will be removed.
    userId number
    The internal ID of a dbt Cloud user
    group_ids Sequence[int]
    IDs of the groups to assign to the user. If additional groups were assigned manually in dbt Cloud, they will be removed.
    user_id int
    The internal ID of a dbt Cloud user
    groupIds List<Number>
    IDs of the groups to assign to the user. If additional groups were assigned manually in dbt Cloud, they will be removed.
    userId Number
    The internal ID of a dbt Cloud user

    Outputs

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

    Get an existing UserGroups 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?: UserGroupsState, opts?: CustomResourceOptions): UserGroups
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            group_ids: Optional[Sequence[int]] = None,
            user_id: Optional[int] = None) -> UserGroups
    func GetUserGroups(ctx *Context, name string, id IDInput, state *UserGroupsState, opts ...ResourceOption) (*UserGroups, error)
    public static UserGroups Get(string name, Input<string> id, UserGroupsState? state, CustomResourceOptions? opts = null)
    public static UserGroups get(String name, Output<String> id, UserGroupsState 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:
    GroupIds List<int>
    IDs of the groups to assign to the user. If additional groups were assigned manually in dbt Cloud, they will be removed.
    UserId int
    The internal ID of a dbt Cloud user
    GroupIds []int
    IDs of the groups to assign to the user. If additional groups were assigned manually in dbt Cloud, they will be removed.
    UserId int
    The internal ID of a dbt Cloud user
    groupIds List<Integer>
    IDs of the groups to assign to the user. If additional groups were assigned manually in dbt Cloud, they will be removed.
    userId Integer
    The internal ID of a dbt Cloud user
    groupIds number[]
    IDs of the groups to assign to the user. If additional groups were assigned manually in dbt Cloud, they will be removed.
    userId number
    The internal ID of a dbt Cloud user
    group_ids Sequence[int]
    IDs of the groups to assign to the user. If additional groups were assigned manually in dbt Cloud, they will be removed.
    user_id int
    The internal ID of a dbt Cloud user
    groupIds List<Number>
    IDs of the groups to assign to the user. If additional groups were assigned manually in dbt Cloud, they will be removed.
    userId Number
    The internal ID of a dbt Cloud user

    Import

    Import using the User ID

    using import blocks (requires Terraform >= 1.5)

    import {

    to = dbtcloud_user_groups.my_user_groups

    id = “user_id”

    }

    import {

    to = dbtcloud_user_groups.my_user_groups

    id = “123456”

    }

    using the older import command

    $ pulumi import dbtcloud:index/userGroups:UserGroups my_user_groups "user_id"
    
    $ pulumi import dbtcloud:index/userGroups:UserGroups my_user_groups 123456
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    dbtcloud pulumi/pulumi-dbtcloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the dbtcloud Terraform Provider.
    dbtcloud logo
    dbt Cloud v0.1.8 published on Tuesday, Jun 11, 2024 by Pulumi