1. Packages
  2. Oracle Cloud Infrastructure
  3. API Docs
  4. Identity
  5. getGroups
Oracle Cloud Infrastructure v2.30.0 published on Monday, Apr 14, 2025 by Pulumi

oci.Identity.getGroups

Explore with Pulumi AI

Oracle Cloud Infrastructure v2.30.0 published on Monday, Apr 14, 2025 by Pulumi

This data source provides the list of Groups in Oracle Cloud Infrastructure Identity service.

Lists the groups in your tenancy. You must specify your tenancy’s OCID as the value for the compartment ID (remember that the tenancy is simply the root compartment). See Where to Get the Tenancy’s OCID and User’s OCID.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as oci from "@pulumi/oci";

const testGroups = oci.Identity.getGroups({
    compartmentId: tenancyOcid,
    name: groupName,
    state: groupState,
});
Copy
import pulumi
import pulumi_oci as oci

test_groups = oci.Identity.get_groups(compartment_id=tenancy_ocid,
    name=group_name,
    state=group_state)
Copy
package main

import (
	"github.com/pulumi/pulumi-oci/sdk/v2/go/oci/identity"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := identity.GetGroups(ctx, &identity.GetGroupsArgs{
			CompartmentId: tenancyOcid,
			Name:          pulumi.StringRef(groupName),
			State:         pulumi.StringRef(groupState),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Oci = Pulumi.Oci;

return await Deployment.RunAsync(() => 
{
    var testGroups = Oci.Identity.GetGroups.Invoke(new()
    {
        CompartmentId = tenancyOcid,
        Name = groupName,
        State = groupState,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.oci.Identity.IdentityFunctions;
import com.pulumi.oci.Identity.inputs.GetGroupsArgs;
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) {
        final var testGroups = IdentityFunctions.getGroups(GetGroupsArgs.builder()
            .compartmentId(tenancyOcid)
            .name(groupName)
            .state(groupState)
            .build());

    }
}
Copy
variables:
  testGroups:
    fn::invoke:
      function: oci:Identity:getGroups
      arguments:
        compartmentId: ${tenancyOcid}
        name: ${groupName}
        state: ${groupState}
Copy

Using getGroups

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getGroups(args: GetGroupsArgs, opts?: InvokeOptions): Promise<GetGroupsResult>
function getGroupsOutput(args: GetGroupsOutputArgs, opts?: InvokeOptions): Output<GetGroupsResult>
Copy
def get_groups(compartment_id: Optional[str] = None,
               filters: Optional[Sequence[_identity.GetGroupsFilter]] = None,
               name: Optional[str] = None,
               state: Optional[str] = None,
               opts: Optional[InvokeOptions] = None) -> GetGroupsResult
def get_groups_output(compartment_id: Optional[pulumi.Input[str]] = None,
               filters: Optional[pulumi.Input[Sequence[pulumi.Input[_identity.GetGroupsFilterArgs]]]] = None,
               name: Optional[pulumi.Input[str]] = None,
               state: Optional[pulumi.Input[str]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetGroupsResult]
Copy
func GetGroups(ctx *Context, args *GetGroupsArgs, opts ...InvokeOption) (*GetGroupsResult, error)
func GetGroupsOutput(ctx *Context, args *GetGroupsOutputArgs, opts ...InvokeOption) GetGroupsResultOutput
Copy

> Note: This function is named GetGroups in the Go SDK.

public static class GetGroups 
{
    public static Task<GetGroupsResult> InvokeAsync(GetGroupsArgs args, InvokeOptions? opts = null)
    public static Output<GetGroupsResult> Invoke(GetGroupsInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetGroupsResult> getGroups(GetGroupsArgs args, InvokeOptions options)
public static Output<GetGroupsResult> getGroups(GetGroupsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: oci:Identity/getGroups:getGroups
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

CompartmentId This property is required. string
The OCID of the compartment (remember that the tenancy is simply the root compartment).
Filters Changes to this property will trigger replacement. List<GetGroupsFilter>
Name string
A filter to only return resources that match the given name exactly.
State string
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
CompartmentId This property is required. string
The OCID of the compartment (remember that the tenancy is simply the root compartment).
Filters Changes to this property will trigger replacement. []GetGroupsFilter
Name string
A filter to only return resources that match the given name exactly.
State string
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
compartmentId This property is required. String
The OCID of the compartment (remember that the tenancy is simply the root compartment).
filters Changes to this property will trigger replacement. List<GetGroupsFilter>
name String
A filter to only return resources that match the given name exactly.
state String
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
compartmentId This property is required. string
The OCID of the compartment (remember that the tenancy is simply the root compartment).
filters Changes to this property will trigger replacement. GetGroupsFilter[]
name string
A filter to only return resources that match the given name exactly.
state string
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
compartment_id This property is required. str
The OCID of the compartment (remember that the tenancy is simply the root compartment).
filters Changes to this property will trigger replacement. Sequence[identity.GetGroupsFilter]
name str
A filter to only return resources that match the given name exactly.
state str
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
compartmentId This property is required. String
The OCID of the compartment (remember that the tenancy is simply the root compartment).
filters Changes to this property will trigger replacement. List<Property Map>
name String
A filter to only return resources that match the given name exactly.
state String
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.

getGroups Result

The following output properties are available:

CompartmentId string
The OCID of the tenancy containing the group.
Groups List<GetGroupsGroup>
The list of groups.
Id string
The provider-assigned unique ID for this managed resource.
Filters List<GetGroupsFilter>
Name string
The name you assign to the group during creation. The name must be unique across all groups in the tenancy and cannot be changed.
State string
The group's current state.
CompartmentId string
The OCID of the tenancy containing the group.
Groups []GetGroupsGroup
The list of groups.
Id string
The provider-assigned unique ID for this managed resource.
Filters []GetGroupsFilter
Name string
The name you assign to the group during creation. The name must be unique across all groups in the tenancy and cannot be changed.
State string
The group's current state.
compartmentId String
The OCID of the tenancy containing the group.
groups List<GetGroupsGroup>
The list of groups.
id String
The provider-assigned unique ID for this managed resource.
filters List<GetGroupsFilter>
name String
The name you assign to the group during creation. The name must be unique across all groups in the tenancy and cannot be changed.
state String
The group's current state.
compartmentId string
The OCID of the tenancy containing the group.
groups GetGroupsGroup[]
The list of groups.
id string
The provider-assigned unique ID for this managed resource.
filters GetGroupsFilter[]
name string
The name you assign to the group during creation. The name must be unique across all groups in the tenancy and cannot be changed.
state string
The group's current state.
compartment_id str
The OCID of the tenancy containing the group.
groups Sequence[identity.GetGroupsGroup]
The list of groups.
id str
The provider-assigned unique ID for this managed resource.
filters Sequence[identity.GetGroupsFilter]
name str
The name you assign to the group during creation. The name must be unique across all groups in the tenancy and cannot be changed.
state str
The group's current state.
compartmentId String
The OCID of the tenancy containing the group.
groups List<Property Map>
The list of groups.
id String
The provider-assigned unique ID for this managed resource.
filters List<Property Map>
name String
The name you assign to the group during creation. The name must be unique across all groups in the tenancy and cannot be changed.
state String
The group's current state.

Supporting Types

GetGroupsFilter

Name This property is required. string
A filter to only return resources that match the given name exactly.
Values This property is required. List<string>
Regex bool
Name This property is required. string
A filter to only return resources that match the given name exactly.
Values This property is required. []string
Regex bool
name This property is required. String
A filter to only return resources that match the given name exactly.
values This property is required. List<String>
regex Boolean
name This property is required. string
A filter to only return resources that match the given name exactly.
values This property is required. string[]
regex boolean
name This property is required. str
A filter to only return resources that match the given name exactly.
values This property is required. Sequence[str]
regex bool
name This property is required. String
A filter to only return resources that match the given name exactly.
values This property is required. List<String>
regex Boolean

GetGroupsGroup

CompartmentId This property is required. string
The OCID of the compartment (remember that the tenancy is simply the root compartment).
DefinedTags This property is required. Dictionary<string, string>
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
Description This property is required. string
The description you assign to the group. Does not have to be unique, and it's changeable.
FreeformTags This property is required. Dictionary<string, string>
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
Id This property is required. string
The OCID of the group.
InactiveState This property is required. string
The detailed status of INACTIVE lifecycleState.
Name This property is required. string
A filter to only return resources that match the given name exactly.
State This property is required. string
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
TimeCreated This property is required. string
Date and time the group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
CompartmentId This property is required. string
The OCID of the compartment (remember that the tenancy is simply the root compartment).
DefinedTags This property is required. map[string]string
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
Description This property is required. string
The description you assign to the group. Does not have to be unique, and it's changeable.
FreeformTags This property is required. map[string]string
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
Id This property is required. string
The OCID of the group.
InactiveState This property is required. string
The detailed status of INACTIVE lifecycleState.
Name This property is required. string
A filter to only return resources that match the given name exactly.
State This property is required. string
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
TimeCreated This property is required. string
Date and time the group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
compartmentId This property is required. String
The OCID of the compartment (remember that the tenancy is simply the root compartment).
definedTags This property is required. Map<String,String>
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
description This property is required. String
The description you assign to the group. Does not have to be unique, and it's changeable.
freeformTags This property is required. Map<String,String>
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
id This property is required. String
The OCID of the group.
inactiveState This property is required. String
The detailed status of INACTIVE lifecycleState.
name This property is required. String
A filter to only return resources that match the given name exactly.
state This property is required. String
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
timeCreated This property is required. String
Date and time the group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
compartmentId This property is required. string
The OCID of the compartment (remember that the tenancy is simply the root compartment).
definedTags This property is required. {[key: string]: string}
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
description This property is required. string
The description you assign to the group. Does not have to be unique, and it's changeable.
freeformTags This property is required. {[key: string]: string}
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
id This property is required. string
The OCID of the group.
inactiveState This property is required. string
The detailed status of INACTIVE lifecycleState.
name This property is required. string
A filter to only return resources that match the given name exactly.
state This property is required. string
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
timeCreated This property is required. string
Date and time the group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
compartment_id This property is required. str
The OCID of the compartment (remember that the tenancy is simply the root compartment).
defined_tags This property is required. Mapping[str, str]
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
description This property is required. str
The description you assign to the group. Does not have to be unique, and it's changeable.
freeform_tags This property is required. Mapping[str, str]
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
id This property is required. str
The OCID of the group.
inactive_state This property is required. str
The detailed status of INACTIVE lifecycleState.
name This property is required. str
A filter to only return resources that match the given name exactly.
state This property is required. str
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
time_created This property is required. str
Date and time the group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
compartmentId This property is required. String
The OCID of the compartment (remember that the tenancy is simply the root compartment).
definedTags This property is required. Map<String>
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
description This property is required. String
The description you assign to the group. Does not have to be unique, and it's changeable.
freeformTags This property is required. Map<String>
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
id This property is required. String
The OCID of the group.
inactiveState This property is required. String
The detailed status of INACTIVE lifecycleState.
name This property is required. String
A filter to only return resources that match the given name exactly.
state This property is required. String
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
timeCreated This property is required. String
Date and time the group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z

Package Details

Repository
oci pulumi/pulumi-oci
License
Apache-2.0
Notes
This Pulumi package is based on the oci Terraform Provider.
Oracle Cloud Infrastructure v2.30.0 published on Monday, Apr 14, 2025 by Pulumi