1. Packages
  2. Oracle Cloud Infrastructure
  3. API Docs
  4. Identity
  5. Group
Oracle Cloud Infrastructure v2.31.0 published on Thursday, Apr 17, 2025 by Pulumi

oci.Identity.Group

Explore with Pulumi AI

This resource provides the Group resource in Oracle Cloud Infrastructure Identity service.

Creates a new group in your tenancy.

You must specify your tenancy’s OCID as the compartment ID in the request object (remember that the tenancy is simply the root compartment). Notice that IAM resources (users, groups, compartments, and some policies) reside within the tenancy itself, unlike cloud resources such as compute instances, which typically reside within compartments inside the tenancy. For information about OCIDs, see Resource Identifiers.

You must also specify a name for the group, which must be unique across all groups in your tenancy and cannot be changed. You can use this name or the OCID when writing policies that apply to the group. For more information about policies, see How Policies Work.

You must also specify a description for the group (although it can be an empty string). It does not have to be unique, and you can change it anytime with UpdateGroup. After creating the group, you need to put users in it and write policies for it. See AddUserToGroup and CreatePolicy.

Example Usage

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

const testGroup = new oci.identity.Group("test_group", {
    compartmentId: tenancyOcid,
    description: groupDescription,
    name: groupName,
    definedTags: {
        "Operations.CostCenter": "42",
    },
    freeformTags: {
        Department: "Finance",
    },
});
Copy
import pulumi
import pulumi_oci as oci

test_group = oci.identity.Group("test_group",
    compartment_id=tenancy_ocid,
    description=group_description,
    name=group_name,
    defined_tags={
        "Operations.CostCenter": "42",
    },
    freeform_tags={
        "Department": "Finance",
    })
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.NewGroup(ctx, "test_group", &identity.GroupArgs{
			CompartmentId: pulumi.Any(tenancyOcid),
			Description:   pulumi.Any(groupDescription),
			Name:          pulumi.Any(groupName),
			DefinedTags: pulumi.StringMap{
				"Operations.CostCenter": pulumi.String("42"),
			},
			FreeformTags: pulumi.StringMap{
				"Department": pulumi.String("Finance"),
			},
		})
		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 testGroup = new Oci.Identity.Group("test_group", new()
    {
        CompartmentId = tenancyOcid,
        Description = groupDescription,
        Name = groupName,
        DefinedTags = 
        {
            { "Operations.CostCenter", "42" },
        },
        FreeformTags = 
        {
            { "Department", "Finance" },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.oci.Identity.Group;
import com.pulumi.oci.Identity.GroupArgs;
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()
            .compartmentId(tenancyOcid)
            .description(groupDescription)
            .name(groupName)
            .definedTags(Map.of("Operations.CostCenter", "42"))
            .freeformTags(Map.of("Department", "Finance"))
            .build());

    }
}
Copy
resources:
  testGroup:
    type: oci:Identity:Group
    name: test_group
    properties:
      compartmentId: ${tenancyOcid}
      description: ${groupDescription}
      name: ${groupName}
      definedTags:
        Operations.CostCenter: '42'
      freeformTags:
        Department: Finance
Copy

Create Group Resource

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

Constructor syntax

new Group(name: string, args: GroupArgs, opts?: CustomResourceOptions);
@overload
def Group(resource_name: str,
          args: GroupArgs,
          opts: Optional[ResourceOptions] = None)

@overload
def Group(resource_name: str,
          opts: Optional[ResourceOptions] = None,
          description: Optional[str] = None,
          compartment_id: Optional[str] = None,
          defined_tags: Optional[Mapping[str, str]] = None,
          freeform_tags: Optional[Mapping[str, str]] = None,
          name: Optional[str] = None)
func NewGroup(ctx *Context, name string, args GroupArgs, opts ...ResourceOption) (*Group, error)
public Group(string name, GroupArgs args, CustomResourceOptions? opts = null)
public Group(String name, GroupArgs args)
public Group(String name, GroupArgs args, CustomResourceOptions options)
type: oci:Identity:Group
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. GroupArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. GroupArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. GroupArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. GroupArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. GroupArgs
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 groupResource = new Oci.Identity.Group("groupResource", new()
{
    Description = "string",
    CompartmentId = "string",
    DefinedTags = 
    {
        { "string", "string" },
    },
    FreeformTags = 
    {
        { "string", "string" },
    },
    Name = "string",
});
Copy
example, err := identity.NewGroup(ctx, "groupResource", &identity.GroupArgs{
	Description:   pulumi.String("string"),
	CompartmentId: pulumi.String("string"),
	DefinedTags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	FreeformTags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	Name: pulumi.String("string"),
})
Copy
var groupResource = new Group("groupResource", GroupArgs.builder()
    .description("string")
    .compartmentId("string")
    .definedTags(Map.of("string", "string"))
    .freeformTags(Map.of("string", "string"))
    .name("string")
    .build());
Copy
group_resource = oci.identity.Group("groupResource",
    description="string",
    compartment_id="string",
    defined_tags={
        "string": "string",
    },
    freeform_tags={
        "string": "string",
    },
    name="string")
Copy
const groupResource = new oci.identity.Group("groupResource", {
    description: "string",
    compartmentId: "string",
    definedTags: {
        string: "string",
    },
    freeformTags: {
        string: "string",
    },
    name: "string",
});
Copy
type: oci:Identity:Group
properties:
    compartmentId: string
    definedTags:
        string: string
    description: string
    freeformTags:
        string: string
    name: string
Copy

Group Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Group resource accepts the following input properties:

Description This property is required. string
(Updatable) The description you assign to the group during creation. Does not have to be unique, and it's changeable.
CompartmentId Changes to this property will trigger replacement. string
The OCID of the tenancy containing the group.
DefinedTags Dictionary<string, string>
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
FreeformTags Dictionary<string, string>
(Updatable) 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"}
Name Changes to this property will trigger replacement. 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.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

Description This property is required. string
(Updatable) The description you assign to the group during creation. Does not have to be unique, and it's changeable.
CompartmentId Changes to this property will trigger replacement. string
The OCID of the tenancy containing the group.
DefinedTags map[string]string
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
FreeformTags map[string]string
(Updatable) 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"}
Name Changes to this property will trigger replacement. 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.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

description This property is required. String
(Updatable) The description you assign to the group during creation. Does not have to be unique, and it's changeable.
compartmentId Changes to this property will trigger replacement. String
The OCID of the tenancy containing the group.
definedTags Map<String,String>
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
freeformTags Map<String,String>
(Updatable) 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"}
name Changes to this property will trigger replacement. 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.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

description This property is required. string
(Updatable) The description you assign to the group during creation. Does not have to be unique, and it's changeable.
compartmentId Changes to this property will trigger replacement. string
The OCID of the tenancy containing the group.
definedTags {[key: string]: string}
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
freeformTags {[key: string]: string}
(Updatable) 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"}
name Changes to this property will trigger replacement. 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.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

description This property is required. str
(Updatable) The description you assign to the group during creation. Does not have to be unique, and it's changeable.
compartment_id Changes to this property will trigger replacement. str
The OCID of the tenancy containing the group.
defined_tags Mapping[str, str]
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
freeform_tags Mapping[str, str]
(Updatable) 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"}
name Changes to this property will trigger replacement. 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.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

description This property is required. String
(Updatable) The description you assign to the group during creation. Does not have to be unique, and it's changeable.
compartmentId Changes to this property will trigger replacement. String
The OCID of the tenancy containing the group.
definedTags Map<String>
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
freeformTags Map<String>
(Updatable) 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"}
name Changes to this property will trigger replacement. 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.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

Outputs

All input properties are implicitly available as output properties. Additionally, the Group resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
InactiveState string
The detailed status of INACTIVE lifecycleState.
State string
The group's current state.
TimeCreated string
Date and time the group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
Id string
The provider-assigned unique ID for this managed resource.
InactiveState string
The detailed status of INACTIVE lifecycleState.
State string
The group's current state.
TimeCreated string
Date and time the group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
id String
The provider-assigned unique ID for this managed resource.
inactiveState String
The detailed status of INACTIVE lifecycleState.
state String
The group's current state.
timeCreated String
Date and time the group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
id string
The provider-assigned unique ID for this managed resource.
inactiveState string
The detailed status of INACTIVE lifecycleState.
state string
The group's current state.
timeCreated string
Date and time the group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
id str
The provider-assigned unique ID for this managed resource.
inactive_state str
The detailed status of INACTIVE lifecycleState.
state str
The group's current state.
time_created str
Date and time the group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
id String
The provider-assigned unique ID for this managed resource.
inactiveState String
The detailed status of INACTIVE lifecycleState.
state String
The group's current state.
timeCreated String
Date and time the group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z

Look up Existing Group Resource

Get an existing Group 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?: GroupState, opts?: CustomResourceOptions): Group
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        compartment_id: Optional[str] = None,
        defined_tags: Optional[Mapping[str, str]] = None,
        description: Optional[str] = None,
        freeform_tags: Optional[Mapping[str, str]] = None,
        inactive_state: Optional[str] = None,
        name: Optional[str] = None,
        state: Optional[str] = None,
        time_created: Optional[str] = None) -> Group
func GetGroup(ctx *Context, name string, id IDInput, state *GroupState, opts ...ResourceOption) (*Group, error)
public static Group Get(string name, Input<string> id, GroupState? state, CustomResourceOptions? opts = null)
public static Group get(String name, Output<String> id, GroupState state, CustomResourceOptions options)
resources:  _:    type: oci:Identity:Group    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
CompartmentId Changes to this property will trigger replacement. string
The OCID of the tenancy containing the group.
DefinedTags Dictionary<string, string>
(Updatable) 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 string
(Updatable) The description you assign to the group during creation. Does not have to be unique, and it's changeable.
FreeformTags Dictionary<string, string>
(Updatable) 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"}
InactiveState string
The detailed status of INACTIVE lifecycleState.
Name Changes to this property will trigger replacement. 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.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

State string
The group's current state.
TimeCreated string
Date and time the group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
CompartmentId Changes to this property will trigger replacement. string
The OCID of the tenancy containing the group.
DefinedTags map[string]string
(Updatable) 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 string
(Updatable) The description you assign to the group during creation. Does not have to be unique, and it's changeable.
FreeformTags map[string]string
(Updatable) 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"}
InactiveState string
The detailed status of INACTIVE lifecycleState.
Name Changes to this property will trigger replacement. 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.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

State string
The group's current state.
TimeCreated string
Date and time the group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
compartmentId Changes to this property will trigger replacement. String
The OCID of the tenancy containing the group.
definedTags Map<String,String>
(Updatable) 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 String
(Updatable) The description you assign to the group during creation. Does not have to be unique, and it's changeable.
freeformTags Map<String,String>
(Updatable) 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"}
inactiveState String
The detailed status of INACTIVE lifecycleState.
name Changes to this property will trigger replacement. 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.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

state String
The group's current state.
timeCreated String
Date and time the group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
compartmentId Changes to this property will trigger replacement. string
The OCID of the tenancy containing the group.
definedTags {[key: string]: string}
(Updatable) 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 string
(Updatable) The description you assign to the group during creation. Does not have to be unique, and it's changeable.
freeformTags {[key: string]: string}
(Updatable) 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"}
inactiveState string
The detailed status of INACTIVE lifecycleState.
name Changes to this property will trigger replacement. 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.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

state string
The group's current state.
timeCreated string
Date and time the group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
compartment_id Changes to this property will trigger replacement. str
The OCID of the tenancy containing the group.
defined_tags Mapping[str, str]
(Updatable) 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 str
(Updatable) The description you assign to the group during creation. Does not have to be unique, and it's changeable.
freeform_tags Mapping[str, str]
(Updatable) 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"}
inactive_state str
The detailed status of INACTIVE lifecycleState.
name Changes to this property will trigger replacement. 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.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

state str
The group's current state.
time_created str
Date and time the group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
compartmentId Changes to this property will trigger replacement. String
The OCID of the tenancy containing the group.
definedTags Map<String>
(Updatable) 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 String
(Updatable) The description you assign to the group during creation. Does not have to be unique, and it's changeable.
freeformTags Map<String>
(Updatable) 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"}
inactiveState String
The detailed status of INACTIVE lifecycleState.
name Changes to this property will trigger replacement. 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.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

state String
The group's current state.
timeCreated String
Date and time the group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z

Import

Groups can be imported using the id, e.g.

$ pulumi import oci:Identity/group:Group test_group "id"
Copy

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

Package Details

Repository
oci pulumi/pulumi-oci
License
Apache-2.0
Notes
This Pulumi package is based on the oci Terraform Provider.