-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiam.tf
51 lines (40 loc) · 1.58 KB
/
iam.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
resource "oci_identity_compartment" "self" {
compartment_id = var.parent_compartment_id
name = local.unique_resource_name
description = "The compartment that is associated with this deployment"
freeform_tags = {
project = var.project_name
}
}
resource "oci_identity_dynamic_group" "self" {
compartment_id = var.parent_compartment_id
name = local.unique_resource_name
description = "MC Servers"
matching_rule = "ALL {instance.compartment.id = '${oci_identity_compartment.self.id}'}"
freeform_tags = {
project = var.project_name
}
}
resource "oci_identity_policy" "self" {
compartment_id = var.parent_compartment_id
name = "${local.unique_resource_name}-instances"
description = "Policy to allow access to buckets"
statements = [
"Allow dynamic-group ${oci_identity_dynamic_group.self.name} to manage objects in compartment ${oci_identity_compartment.self.name}",
"Allow dynamic-group ${oci_identity_dynamic_group.self.name} to manage buckets in compartment ${oci_identity_compartment.self.name}"
]
freeform_tags = {
project = var.project_name
}
}
resource "oci_identity_policy" "bucket_service" {
compartment_id = var.parent_compartment_id
name = "${local.unique_resource_name}-bucket"
description = "Policy to allow bucket service to manage objects in bucket"
statements = [
"Allow service objectstorage-${var.region_name} to manage object-family in compartment ${local.unique_resource_name}"
]
freeform_tags = {
project = var.project_name
}
}