Skip to content

Commit 80b691f

Browse files
authored
added a generated suffix so dynamic group name will be unique (#19)
1 parent 474065b commit 80b691f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

instance_principal.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@ resource "oci_identity_dynamic_group" "operator_instance_principal" {
1616

1717
compartment_id = var.tenancy_id
1818
description = "dynamic group to allow instances to call services for 1 operator"
19+
20+
lifecycle {
21+
ignore_changes = [name]
22+
}
23+
1924
matching_rule = "ALL {instance.id = '${join(",", data.oci_core_instance.operator.*.id)}'}"
20-
name = var.label_prefix == "none" ? "operator-instance-principal" : "${var.label_prefix}-operator-instance-principal"
25+
name = var.label_prefix == "none" ? "operator-instance-principal-${substr(uuid(),0,8)}" : "${var.label_prefix}-operator-instance-principal-${substr(uuid(),0,8)}"
2126

2227
count = var.operator_enabled == true && var.operator_instance_principal == true ? 1 : 0
2328
}

0 commit comments

Comments
 (0)