File tree Expand file tree Collapse file tree 4 files changed +17
-16
lines changed
Expand file tree Collapse file tree 4 files changed +17
-16
lines changed Original file line number Diff line number Diff line change @@ -57,12 +57,13 @@ locals {
5757 }
5858
5959 oci_admin = {
60- admin_enabled = var.oci_base_admin.admin_enabled
61- admin_image_id = var.oci_base_admin.admin_image_id
62- admin_shape = var.oci_base_admin.admin_shape
63- admin_upgrade = var.oci_base_admin.admin_upgrade
64- ssh_public_key_path = var.oci_base_admin.ssh_public_key_path
65- timezone = var.oci_base_admin.timezone
60+ admin_enabled = var.oci_base_admin.admin_enabled
61+ admin_image_id = var.oci_base_admin.admin_image_id
62+ admin_shape = var.oci_base_admin.admin_shape
63+ admin_upgrade = var.oci_base_admin.admin_upgrade
64+ enable_instance_principal = var.oci_base_admin.enable_instance_principal
65+ ssh_public_key_path = var.oci_base_admin.ssh_public_key_path
66+ timezone = var.oci_base_admin.timezone
6667 }
6768
6869 oci_admin_notification = {
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ resource "oci_identity_dynamic_group" "admin_instance_principal" {
2828 description = " dynamic group to allow instances to call services for 1 admin"
2929 matching_rule = " ALL {instance.id = '${ join (" ," , data. oci_core_instance . admin . * . id )} '}"
3030 name = " ${ var . oci_admin_general . label_prefix } -admin_instance_principal"
31- count = var. oci_admin . admin_enabled == true ? 1 : 0
31+ count = var. oci_admin . admin_enabled == true && var . oci_admin . enable_instance_principal == true ? 1 : 0
3232}
3333
3434resource "oci_identity_policy" "admin_instance_principal" {
@@ -37,5 +37,5 @@ resource "oci_identity_policy" "admin_instance_principal" {
3737 description = " policy to allow admin host to call services"
3838 name = " ${ var . oci_admin_general . label_prefix } -admin_instance_principal"
3939 statements = [" Allow dynamic-group ${ oci_identity_dynamic_group . admin_instance_principal [0 ]. name } to manage all-resources in compartment id ${ data . oci_identity_compartments . compartments_id . compartments . 0 . id } " ]
40- count = var. oci_admin . admin_enabled == true ? 1 : 0
40+ count = var. oci_admin . admin_enabled == true && var . oci_admin . enable_instance_principal == true ? 1 : 0
4141}
Original file line number Diff line number Diff line change @@ -6,5 +6,5 @@ output "admin_private_ip" {
66}
77
88output "admin_instance_principal_group_name" {
9- value = oci_identity_dynamic_group. admin_instance_principal [0 ]. name
9+ value = var . oci_admin . admin_enabled == true && var . oci_admin . enable_instance_principal == true ? oci_identity_dynamic_group. admin_instance_principal [0 ]. name : null
1010}
Original file line number Diff line number Diff line change @@ -25,12 +25,13 @@ variable "oci_admin_general" {
2525
2626variable "oci_admin" {
2727 type = object ({
28- admin_image_id = string
29- admin_shape = string
30- admin_upgrade = bool
31- admin_enabled = bool
32- ssh_public_key_path = string
33- timezone = string
28+ admin_image_id = string
29+ admin_shape = string
30+ admin_upgrade = bool
31+ admin_enabled = bool
32+ enable_instance_principal = bool
33+ ssh_public_key_path = string
34+ timezone = string
3435 })
3536}
3637
@@ -52,6 +53,5 @@ variable "oci_admin_notification" {
5253 notification_endpoint = string
5354 notification_protocol = string
5455 notification_topic = string
55-
5656 })
5757}
You can’t perform that action at this time.
0 commit comments