1. Packages
  2. Okta
  3. API Docs
  4. GroupMemberships
Okta v4.8.0 published on Saturday, Mar 2, 2024 by Pulumi

okta.GroupMemberships

Explore with Pulumi AI

okta logo
Okta v4.8.0 published on Saturday, Mar 2, 2024 by Pulumi

    Resource to manage a set of memberships for a specific group.

    This resource will allow you to bulk manage group membership in Okta for a given group. This offers an interface to pass multiple users into a single resource call, for better API resource usage. If you need a relationship of a single user to many groups, please use the okta.UserGroupMemberships resource.

    Important: The default behavior of the resource is to only maintain the state of user ids that are assigned it. This behavior will signal drift only if those users stop being part of the group. If the desired behavior is track all users that are added/removed from the group make use of the track_all_users argument with this resource.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Okta = Pulumi.Okta;
    
    return await Deployment.RunAsync(() => 
    {
        var testGroup = new Okta.Group.Group("testGroup", new()
        {
            Description = "testing, testing",
        });
    
        var testGroupMemberships = new Okta.GroupMemberships("testGroupMemberships", new()
        {
            GroupId = testGroup.Id,
            Users = new[]
            {
                okta_user.Test1.Id,
                okta_user.Test2.Id,
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-okta/sdk/v4/go/okta"
    	"github.com/pulumi/pulumi-okta/sdk/v4/go/okta/group"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		testGroup, err := group.NewGroup(ctx, "testGroup", &group.GroupArgs{
    			Description: pulumi.String("testing, testing"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = okta.NewGroupMemberships(ctx, "testGroupMemberships", &okta.GroupMembershipsArgs{
    			GroupId: testGroup.ID(),
    			Users: pulumi.StringArray{
    				okta_user.Test1.Id,
    				okta_user.Test2.Id,
    			},
    		})
    		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.okta.group.Group;
    import com.pulumi.okta.group.GroupArgs;
    import com.pulumi.okta.GroupMemberships;
    import com.pulumi.okta.GroupMembershipsArgs;
    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 testGroup = new Group("testGroup", GroupArgs.builder()        
                .description("testing, testing")
                .build());
    
            var testGroupMemberships = new GroupMemberships("testGroupMemberships", GroupMembershipsArgs.builder()        
                .groupId(testGroup.id())
                .users(            
                    okta_user.test1().id(),
                    okta_user.test2().id())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_okta as okta
    
    test_group = okta.group.Group("testGroup", description="testing, testing")
    test_group_memberships = okta.GroupMemberships("testGroupMemberships",
        group_id=test_group.id,
        users=[
            okta_user["test1"]["id"],
            okta_user["test2"]["id"],
        ])
    
    import * as pulumi from "@pulumi/pulumi";
    import * as okta from "@pulumi/okta";
    
    const testGroup = new okta.group.Group("testGroup", {description: "testing, testing"});
    const testGroupMemberships = new okta.GroupMemberships("testGroupMemberships", {
        groupId: testGroup.id,
        users: [
            okta_user.test1.id,
            okta_user.test2.id,
        ],
    });
    
    resources:
      testGroup:
        type: okta:group:Group
        properties:
          description: testing, testing
      testGroupMemberships:
        type: okta:GroupMemberships
        properties:
          groupId: ${testGroup.id}
          users:
            - ${okta_user.test1.id}
            - ${okta_user.test2.id}
    

    Create GroupMemberships Resource

    new GroupMemberships(name: string, args: GroupMembershipsArgs, opts?: CustomResourceOptions);
    @overload
    def GroupMemberships(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         group_id: Optional[str] = None,
                         track_all_users: Optional[bool] = None,
                         users: Optional[Sequence[str]] = None)
    @overload
    def GroupMemberships(resource_name: str,
                         args: GroupMembershipsArgs,
                         opts: Optional[ResourceOptions] = None)
    func NewGroupMemberships(ctx *Context, name string, args GroupMembershipsArgs, opts ...ResourceOption) (*GroupMemberships, error)
    public GroupMemberships(string name, GroupMembershipsArgs args, CustomResourceOptions? opts = null)
    public GroupMemberships(String name, GroupMembershipsArgs args)
    public GroupMemberships(String name, GroupMembershipsArgs args, CustomResourceOptions options)
    
    type: okta:GroupMemberships
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args GroupMembershipsArgs
    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 GroupMembershipsArgs
    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 GroupMembershipsArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args GroupMembershipsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args GroupMembershipsArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    GroupId string
    Okta group ID.
    Users List<string>
    The list of Okta user IDs which the group should have membership managed for.
    TrackAllUsers bool
    The resource will concern itself with all users added/deleted to the group; even those managed outside of the resource.
    GroupId string
    Okta group ID.
    Users []string
    The list of Okta user IDs which the group should have membership managed for.
    TrackAllUsers bool
    The resource will concern itself with all users added/deleted to the group; even those managed outside of the resource.
    groupId String
    Okta group ID.
    users List<String>
    The list of Okta user IDs which the group should have membership managed for.
    trackAllUsers Boolean
    The resource will concern itself with all users added/deleted to the group; even those managed outside of the resource.
    groupId string
    Okta group ID.
    users string[]
    The list of Okta user IDs which the group should have membership managed for.
    trackAllUsers boolean
    The resource will concern itself with all users added/deleted to the group; even those managed outside of the resource.
    group_id str
    Okta group ID.
    users Sequence[str]
    The list of Okta user IDs which the group should have membership managed for.
    track_all_users bool
    The resource will concern itself with all users added/deleted to the group; even those managed outside of the resource.
    groupId String
    Okta group ID.
    users List<String>
    The list of Okta user IDs which the group should have membership managed for.
    trackAllUsers Boolean
    The resource will concern itself with all users added/deleted to the group; even those managed outside of the resource.

    Outputs

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

    Get an existing GroupMemberships 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?: GroupMembershipsState, opts?: CustomResourceOptions): GroupMemberships
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            group_id: Optional[str] = None,
            track_all_users: Optional[bool] = None,
            users: Optional[Sequence[str]] = None) -> GroupMemberships
    func GetGroupMemberships(ctx *Context, name string, id IDInput, state *GroupMembershipsState, opts ...ResourceOption) (*GroupMemberships, error)
    public static GroupMemberships Get(string name, Input<string> id, GroupMembershipsState? state, CustomResourceOptions? opts = null)
    public static GroupMemberships get(String name, Output<String> id, GroupMembershipsState 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:
    GroupId string
    Okta group ID.
    TrackAllUsers bool
    The resource will concern itself with all users added/deleted to the group; even those managed outside of the resource.
    Users List<string>
    The list of Okta user IDs which the group should have membership managed for.
    GroupId string
    Okta group ID.
    TrackAllUsers bool
    The resource will concern itself with all users added/deleted to the group; even those managed outside of the resource.
    Users []string
    The list of Okta user IDs which the group should have membership managed for.
    groupId String
    Okta group ID.
    trackAllUsers Boolean
    The resource will concern itself with all users added/deleted to the group; even those managed outside of the resource.
    users List<String>
    The list of Okta user IDs which the group should have membership managed for.
    groupId string
    Okta group ID.
    trackAllUsers boolean
    The resource will concern itself with all users added/deleted to the group; even those managed outside of the resource.
    users string[]
    The list of Okta user IDs which the group should have membership managed for.
    group_id str
    Okta group ID.
    track_all_users bool
    The resource will concern itself with all users added/deleted to the group; even those managed outside of the resource.
    users Sequence[str]
    The list of Okta user IDs which the group should have membership managed for.
    groupId String
    Okta group ID.
    trackAllUsers Boolean
    The resource will concern itself with all users added/deleted to the group; even those managed outside of the resource.
    users List<String>
    The list of Okta user IDs which the group should have membership managed for.

    Import

    an Okta Group’s memberships can be imported via the Okta group ID.

    $ pulumi import okta:index/groupMemberships:GroupMemberships test &#60;group id&#62;
    

    optional parameter track all users will also import all user id currently assigned to the group

    $ pulumi import okta:index/groupMemberships:GroupMemberships test &#60;group id&#62;/&#60;true&#62;
    

    Package Details

    Repository
    Okta pulumi/pulumi-okta
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the okta Terraform Provider.
    okta logo
    Okta v4.8.0 published on Saturday, Mar 2, 2024 by Pulumi