mirror of
https://github.com/kittywitch/nixfiles.git
synced 2026-02-09 04:19:19 -08:00
feat(oci): add admin policy
This commit is contained in:
parent
3711cf0255
commit
0505f506d2
10 changed files with 244 additions and 12 deletions
6
tf/oci_compartment_bootstrap/group.tf
Normal file
6
tf/oci_compartment_bootstrap/group.tf
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
resource "oci_identity_group" "this" {
|
||||
compartment_id = var.tenancy_ocid
|
||||
|
||||
name = "terraform"
|
||||
description = "terraform"
|
||||
}
|
||||
4
tf/oci_compartment_bootstrap/group_membership.tf
Normal file
4
tf/oci_compartment_bootstrap/group_membership.tf
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
resource "oci_identity_user_group_membership" "this" {
|
||||
user_id = oci_identity_user.this.id
|
||||
group_id = oci_identity_group.this.id
|
||||
}
|
||||
21
tf/oci_compartment_bootstrap/policy.tf
Normal file
21
tf/oci_compartment_bootstrap/policy.tf
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
locals {
|
||||
policy_multi_line_statement = <<EOF
|
||||
Allow group ${oci_identity_group.this.name} to manage vcns in compartment id ${var.tenancy_ocid} where ALL {
|
||||
ANY { request.operation = 'CreateNetworkSecurityGroup', request.operation = 'DeleteNetworkSecurityGroup' }
|
||||
}
|
||||
EOF
|
||||
|
||||
}
|
||||
|
||||
resource "oci_identity_policy" "terraform-admin" {
|
||||
compartment_id = var.tenancy_ocid
|
||||
|
||||
name = "terraform-admin"
|
||||
description = "terraform-admin"
|
||||
|
||||
statements = [
|
||||
"Allow group ${oci_identity_group.this.name} to manage all-resources in compartment id ${local.child_compartment_id}",
|
||||
"Allow group ${oci_identity_group.this.name} to read virtual-network-family in compartment id ${var.tenancy_ocid}",
|
||||
local.policy_multi_line_statement,
|
||||
]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue