File tree Expand file tree Collapse file tree 6 files changed +15
-21
lines changed
Expand file tree Collapse file tree 6 files changed +15
-21
lines changed Original file line number Diff line number Diff line change @@ -66,4 +66,4 @@ data "oci_core_instance" "bastion" {
6666 # Required
6767 instance_id = oci_core_instance. bastion [0 ]. id
6868 count = var. oci_bastion . create_bastion == true ? 1 : 0
69- }
69+ }
Original file line number Diff line number Diff line change @@ -6,5 +6,5 @@ output "bastion_public_ip" {
66}
77
88output "bastion_instance_principal_group_name" {
9- value = oci_identity_dynamic_group. bastion_instance_principal [0 ]. name
10- }
9+ value = (var . oci_bastion . enable_instance_principal == true ) ? oci_identity_dynamic_group. bastion_instance_principal [0 ]. name : null
10+ }
Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ resource "oci_identity_dynamic_group" "oke-kms-cluster" {
66 compartment_id = var. oci_identity . tenancy_id
77 description = " dynamic group to allow cluster to use kms"
88 matching_rule = local. dynamic_group_rule_all_clusters
9- name = " ${ var . label_prefix } -oke-kms-cluster"
10- count = var. oke_kms . use_encryption == true ? 1 : 0
9+ name = " ${ var . label_prefix } -oke-kms-cluster"
10+ count = ( var. oke_kms . use_encryption == true ) ? 1 : 0
1111
1212 lifecycle {
1313 ignore_changes = [matching_rule ]
@@ -24,7 +24,7 @@ data "template_file" "update_dynamic_group_script" {
2424
2525 depends_on = [" oci_identity_dynamic_group.oke-kms-cluster" ]
2626
27- count = var. oke_kms . use_encryption == true && var. bastion . create_bastion == true && var. bastion . enable_instance_principal == true ? 1 : 0
27+ count = ( var. oke_kms . use_encryption == true && var. bastion . create_bastion == true && var. bastion . enable_instance_principal == true ) ? 1 : 0
2828}
2929
3030resource null_resource "update_dynamic_group" {
@@ -55,5 +55,5 @@ resource null_resource "update_dynamic_group" {
5555 ]
5656 }
5757
58- count = var. oke_kms . use_encryption == true && var. bastion . create_bastion == true && var. bastion . enable_instance_principal == true ? 1 : 0
58+ count = ( var. oke_kms . use_encryption == true && var. bastion . create_bastion == true && var. bastion . enable_instance_principal == true ) ? 1 : 0
5959}
Original file line number Diff line number Diff line change 22# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl
33
44locals {
5-
6- dynamic_group_rule_all_clusters = " ALL {resource.type = 'cluster', resource.compartment.id = '${ var . oci_identity . compartment_id } '}"
7-
8- dynamic_group_rule_this_cluster = " ALL {resource.type = 'cluster', resource.id = '${ var . cluster_id } '}"
95
10- policy_statement = " Allow dynamic-group ${ oci_identity_dynamic_group . oke-kms-cluster [ 0 ] . name } to use keys in compartment ${ var . oci_identity . compartment_name } where target.key .id = '${ var . oke_kms . key_id } ' "
6+ dynamic_group_rule_all_clusters = (var . oke_kms . use_encryption == true ) ? " ALL {resource.type = 'cluster', resource.compartment .id = '${ var . oci_identity . compartment_id } '} " : null
117
12- }
8+ dynamic_group_rule_this_cluster = (var. oke_kms . use_encryption == true ) ? " ALL {resource.type = 'cluster', resource.id = '${ var . cluster_id } '}" : null
9+
10+ policy_statement = (var. oke_kms . use_encryption == true ) ? " Allow dynamic-group ${ oci_identity_dynamic_group . oke-kms-cluster [0 ]. name } to use keys in compartment ${ var . oci_identity . compartment_name } where target.key.id = '${ var . oke_kms . key_id } '" : " "
11+
12+ }
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ resource "oci_identity_policy" "bastion_instance_principal_dynamic_group" {
77 description = " policy to allow bastion host to manage dynamic group"
88 name = " ${ var . label_prefix } -bastion-instance-principal-dynamic-group"
99 statements = [" Allow dynamic-group ${ var . dynamic_group } to use dynamic-groups in tenancy" ]
10- count = var. oke_kms . use_encryption == true ? 1 : 0
10+ count = ( var. oke_kms . use_encryption == true && var . bastion . create_bastion == true && var . bastion . enable_instance_principal == true ) ? 1 : 0
1111}
1212
1313resource "oci_identity_policy" "oke-kms" {
@@ -16,5 +16,5 @@ resource "oci_identity_policy" "oke-kms" {
1616 description = " policy to allow instances to allow dynamic group ${ var . label_prefix } -oke-kms-cluster to use kms"
1717 name = " ${ var . label_prefix } -oke-kms"
1818 statements = [local . policy_statement ]
19- count = var. oke_kms . use_encryption == true ? 1 : 0
19+ count = ( var. oke_kms . use_encryption == true ) ? 1 : 0
2020}
Original file line number Diff line number Diff line change @@ -65,19 +65,13 @@ bastion_access = "ANYWHERE"
6565
6666enable_instance_principal = false
6767
68- image_operating_system = "Oracle Linux"
69-
70- image_operating_system_version = "7.7"
71-
7268# availability_domains
7369
7470# which AD where to place non-OKE resources
7571availability_domains = {
7672 "bastion" = 1
7773}
7874
79- bastion_package_update = false
80-
8175bastion_package_upgrade = true
8276
8377# oke
You can’t perform that action at this time.
0 commit comments