Skip to content

Commit

Permalink
Identity Domain Users/Groups Change
Browse files Browse the repository at this point in the history
  • Loading branch information
xs2suruchi authored Sep 19, 2024
1 parent 5839c6f commit e60203a
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions examples/identity/identity.tf
Original file line number Diff line number Diff line change
Expand Up @@ -113,42 +113,42 @@ output "root_compartments_map" {
description = "Compartment ocid"
// This allows the compartment ID to be retrieved from the resource if it exists, and if not to use the data source.
#value = element(concat(oci_identity_compartment.this.*.id, tolist([""])), 0)
value = [ for k,v in merge(module.iam-compartments.*...) : v.compartment_id]
value = [ for k,v in merge(module.iam-compartments.*...) : v.compartment_tf_id]
}
output "sub_compartments_level1_map" {
description = "Compartment ocid"
// This allows the compartment ID to be retrieved from the resource if it exists, and if not to use the data source.
#value = element(concat(oci_identity_compartment.this.*.id, tolist([""])), 0)
value = [ for k,v in merge(module.sub-compartments-level1.*...) : v.compartment_id]
value = [ for k,v in merge(module.sub-compartments-level1.*...) : v.compartment_tf_id]
}
output "sub_compartments_level2_map" {
description = "Compartment ocid"
// This allows the compartment ID to be retrieved from the resource if it exists, and if not to use the data source.
#value = element(concat(oci_identity_compartment.this.*.id, tolist([""])), 0)
value = [ for k,v in merge(module.sub-compartments-level2.*...) : v.compartment_id]
value = [ for k,v in merge(module.sub-compartments-level2.*...) : v.compartment_tf_id]
}
output "sub_compartments_level3_map" {
description = "Compartment ocid"
// This allows the compartment ID to be retrieved from the resource if it exists, and if not to use the data source.
#value = element(concat(oci_identity_compartment.this.*.id, tolist([""])), 0)
value = [ for k,v in merge(module.sub-compartments-level3.*...) : v.compartment_id]
value = [ for k,v in merge(module.sub-compartments-level3.*...) : v.compartment_tf_id]
}
output "sub_compartments_level4_map" {
description = "Compartment ocid"
// This allows the compartment ID to be retrieved from the resource if it exists, and if not to use the data source.
#value = element(concat(oci_identity_compartment.this.*.id, tolist([""])), 0)
value = [ for k,v in merge(module.sub-compartments-level4.*...) : v.compartment_id]
value = [ for k,v in merge(module.sub-compartments-level4.*...) : v.compartment_tf_id]
}
output "sub_compartments_level5_map" {
description = "Compartment ocid"
// This allows the compartment ID to be retrieved from the resource if it exists, and if not to use the data source.
#value = element(concat(oci_identity_compartment.this.*.id, tolist([""])), 0)
value = [ for k,v in merge(module.sub-compartments-level5.*...) : v.compartment_id]
value = [ for k,v in merge(module.sub-compartments-level5.*...) : v.compartment_tf_id]
}
*/

Expand Down Expand Up @@ -285,7 +285,7 @@ module "iam-network-sources" {
data "oci_identity_domains" "iam_domains" {
for_each = merge(var.identity_domain_groups,var.identity_domain_users)
# Required
compartment_id = var.compartment_ocids[each.value.compartment_id]
compartment_id = var.compartment_ocids[each.value.domain_compartment_id]
# Optional
display_name = each.value.idcs_endpoint
}
Expand All @@ -300,12 +300,13 @@ module "groups" {
group_name = each.value.group_name
group_description = each.value.group_description
matching_rule = each.value.matching_rule
compartment_id = each.value.compartment_id != "root" ? (length(regexall("ocid1.compartment.oc*", each.value.compartment_id)) > 0 ? each.value.compartment_id : var.compartment_ocids[each.value.compartment_id]) : var.tenancy_ocid
compartment_id = each.value.domain_compartment_id != "root" ? (length(regexall("ocid1.compartment.oc*", each.value.domain_compartment_id)) > 0 ? each.value.domain_compartment_id : var.compartment_ocids[each.value.domain_compartment_id]) : var.tenancy_ocid
identity_domain = data.oci_identity_domains.iam_domains[each.key].domains[0]
tenancy_ocid = var.tenancy_ocid
members = each.value.members != null ? each.value.members : []

#Optional
user_can_request_access = each.value.user_can_request_access
defined_tags = each.value.defined_tags
freeform_tags_key = each.value.freeform_tags != null ? each.value.freeform_tags.key : null
freeform_tags_value = each.value.freeform_tags != null ? each.value.freeform_tags.value : null
Expand All @@ -322,19 +323,26 @@ module "users" {
#depends_on = [module.iam-groups]
for_each = var.identity_domain_users
user_name = each.value.user_name
family_name = each.value.family_name
family_name = each.value.name.family_name
given_name = each.value.name.given_name
middle_name = each.value.name.middle_name
honorific_prefix = each.value.name.honorific_prefix
display_name = each.value.display_name
identity_domain = data.oci_identity_domains.iam_domains[each.key].domains[0]
compartment_id = each.value.compartment_id != "root" ? (length(regexall("ocid1.compartment.oc*", each.value.compartment_id)) > 0 ? each.value.compartment_id : var.compartment_ocids[each.value.compartment_id]) : var.tenancy_ocid
compartment_id = each.value.domain_compartment_id != "root" ? (length(regexall("ocid1.compartment.oc*", each.value.domain_compartment_id)) > 0 ? each.value.domain_compartment_id : var.compartment_ocids[each.value.domain_compartment_id]) : var.tenancy_ocid
description = each.value.description
email = each.value.email
recovery_email = each.value.recovery_email
tenancy_ocid = var.tenancy_ocid
groups = each.value.groups != null ? each.value.groups : null

home_phone_number = each.value.home_phone_number
mobile_phone_number = each.value.mobile_phone_number
enabled_capabilities = each.value.enabled_capabilities

#Optional
defined_tags = each.value.defined_tags
freeform_tags_key = each.value.freeform_tags != null ? each.value.freeform_tags.key : null
freeform_tags_value = each.value.freeform_tags != null ? each.value.freeform_tags.value : null


}

0 comments on commit e60203a

Please sign in to comment.