okta.GroupMemberships
Explore with Pulumi AI
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_user_group_memberships’ 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
import * as pulumi from "@pulumi/pulumi";
import * as okta from "@pulumi/okta";
const test = new okta.group.Group("test", {
name: "testAcc_replace_with_uuid",
description: "testing, testing",
});
const testGroupMemberships = new okta.GroupMemberships("test", {
groupId: test.id,
users: [
test1.id,
test2.id,
],
});
import pulumi
import pulumi_okta as okta
test = okta.group.Group("test",
name="testAcc_replace_with_uuid",
description="testing, testing")
test_group_memberships = okta.GroupMemberships("test",
group_id=test.id,
users=[
test1["id"],
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 {
test, err := group.NewGroup(ctx, "test", &group.GroupArgs{
Name: pulumi.String("testAcc_replace_with_uuid"),
Description: pulumi.String("testing, testing"),
})
if err != nil {
return err
}
_, err = okta.NewGroupMemberships(ctx, "test", &okta.GroupMembershipsArgs{
GroupId: test.ID(),
Users: pulumi.StringArray{
test1.Id,
test2.Id,
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Okta = Pulumi.Okta;
return await Deployment.RunAsync(() =>
{
var test = new Okta.Group.Group("test", new()
{
Name = "testAcc_replace_with_uuid",
Description = "testing, testing",
});
var testGroupMemberships = new Okta.GroupMemberships("test", new()
{
GroupId = test.Id,
Users = new[]
{
test1.Id,
test2.Id,
},
});
});
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 test = new Group("test", GroupArgs.builder()
.name("testAcc_replace_with_uuid")
.description("testing, testing")
.build());
var testGroupMemberships = new GroupMemberships("testGroupMemberships", GroupMembershipsArgs.builder()
.groupId(test.id())
.users(
test1.id(),
test2.id())
.build());
}
}
resources:
test:
type: okta:group:Group
properties:
name: testAcc_replace_with_uuid
description: testing, testing
testGroupMemberships:
type: okta:GroupMemberships
name: test
properties:
groupId: ${test.id}
users:
- ${test1.id}
- ${test2.id}
Create GroupMemberships Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new GroupMemberships(name: string, args: GroupMembershipsArgs, opts?: CustomResourceOptions);
@overload
def GroupMemberships(resource_name: str,
args: GroupMembershipsArgs,
opts: Optional[ResourceOptions] = None)
@overload
def GroupMemberships(resource_name: str,
opts: Optional[ResourceOptions] = None,
group_id: Optional[str] = None,
users: Optional[Sequence[str]] = None,
track_all_users: Optional[bool] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var groupMembershipsResource = new Okta.GroupMemberships("groupMembershipsResource", new()
{
GroupId = "string",
Users = new[]
{
"string",
},
TrackAllUsers = false,
});
example, err := okta.NewGroupMemberships(ctx, "groupMembershipsResource", &okta.GroupMembershipsArgs{
GroupId: pulumi.String("string"),
Users: pulumi.StringArray{
pulumi.String("string"),
},
TrackAllUsers: pulumi.Bool(false),
})
var groupMembershipsResource = new GroupMemberships("groupMembershipsResource", GroupMembershipsArgs.builder()
.groupId("string")
.users("string")
.trackAllUsers(false)
.build());
group_memberships_resource = okta.GroupMemberships("groupMembershipsResource",
group_id="string",
users=["string"],
track_all_users=False)
const groupMembershipsResource = new okta.GroupMemberships("groupMembershipsResource", {
groupId: "string",
users: ["string"],
trackAllUsers: false,
});
type: okta:GroupMemberships
properties:
groupId: string
trackAllUsers: false
users:
- string
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:
- Group
Id string - ID of a Okta group.
- Users List<string>
- The list of Okta user IDs which the group should have membership managed for.
- Track
All boolUsers - The resource concerns itself with all users added/deleted to the group; even those managed outside of the resource.
- Group
Id string - ID of a Okta group.
- Users []string
- The list of Okta user IDs which the group should have membership managed for.
- Track
All boolUsers - The resource concerns itself with all users added/deleted to the group; even those managed outside of the resource.
- group
Id String - ID of a Okta group.
- users List<String>
- The list of Okta user IDs which the group should have membership managed for.
- track
All BooleanUsers - The resource concerns itself with all users added/deleted to the group; even those managed outside of the resource.
- group
Id string - ID of a Okta group.
- users string[]
- The list of Okta user IDs which the group should have membership managed for.
- track
All booleanUsers - The resource concerns itself with all users added/deleted to the group; even those managed outside of the resource.
- group_
id str - ID of a Okta group.
- users Sequence[str]
- The list of Okta user IDs which the group should have membership managed for.
- track_
all_ boolusers - The resource concerns itself with all users added/deleted to the group; even those managed outside of the resource.
- group
Id String - ID of a Okta group.
- users List<String>
- The list of Okta user IDs which the group should have membership managed for.
- track
All BooleanUsers - The resource concerns 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.
- Group
Id string - ID of a Okta group.
- Track
All boolUsers - The resource concerns 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.
- Group
Id string - ID of a Okta group.
- Track
All boolUsers - The resource concerns 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 String - ID of a Okta group.
- track
All BooleanUsers - The resource concerns 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.
- group
Id string - ID of a Okta group.
- track
All booleanUsers - The resource concerns 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 - ID of a Okta group.
- track_
all_ boolusers - The resource concerns 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.
- group
Id String - ID of a Okta group.
- track
All BooleanUsers - The resource concerns 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 <group_id>
optional parameter track all users will also import all user id currently assigned to the group
$ pulumi import okta:index/groupMemberships:GroupMemberships test <group_id>/<true>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Okta pulumi/pulumi-okta
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
okta
Terraform Provider.