Skip to content

Commit 67e21c2

Browse files
ccushingdshelbyo
authored andcommitted
Explicitly set compartmentID for User, Group and Compartment resources in Identity example
* describe `enable_delete` behavior for Compartment resource in notes
1 parent e6e4c03 commit 67e21c2

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

docs/examples/identity/compartment.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
* This example file shows how to create a compartment or reference an existing compartment as a resource.
33
*
44
* Note: the compartment resource internally resolves name collisions and returns a reference to the preexisting
5-
* compartment. Compartments can not be deleted, so removing a compartment resource from your .tf file will only
6-
* remove it from your statefile.
5+
* compartment by default. Use `enable_delete` to allow compartment deletion and prevent implicitly importing compartments.
76
*/
87

98
resource "oci_identity_compartment" "compartment1" {
109
name = "tf-example-compartment"
1110
description = "compartment created by terraform"
11+
compartment_id = "${var.tenancy_ocid}"
12+
enable_delete = false // true will cause this compartment to be deleted when running `terrafrom destroy`
1213
}
1314

1415
data "oci_identity_compartments" "compartments1" {

docs/examples/identity/group.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
resource "oci_identity_group" "group1" {
66
name = "tf-example-group"
77
description = "group created by terraform"
8+
compartment_id = "${var.tenancy_ocid}"
89
}
910

1011
resource "oci_identity_user_group_membership" "user-group-mem1" {

docs/examples/identity/user.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
resource "oci_identity_user" "user1" {
66
name = "tf-example-user"
77
description = "user created by terraform"
8+
compartment_id = "${var.tenancy_ocid}"
89
}
910

1011
data "oci_identity_users" "users1" {

0 commit comments

Comments
 (0)