Skip to content

Commit 2ee5720

Browse files
committed
oke compartment simplification
Signed-off-by: junior <[email protected]>
1 parent 1ec0b85 commit 2ee5720

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

terraform/oke-datasources.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ data "oci_containerengine_node_pool_option" "oke" {
1919
node_pool_option_id = "all"
2020
}
2121
data "oci_containerengine_clusters" "oke" {
22-
compartment_id = local.oke_compartment_ocid
22+
compartment_id = local.oke_compartment_ocid
2323
}
2424

2525
# Gets a list of Availability Domains

terraform/oke-variables.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ variable "existent_oke_cluster_id" {
1616
default = ""
1717
description = "Using existent OKE Cluster. Only the application and services will be provisioned. If select cluster autoscaler feature, you need to get the node pool id and enter when required"
1818
}
19-
variable "existent_oke_cluster_compartment_ocid" {
20-
default = ""
21-
description = "Existent OKE Cluster Compartment"
22-
}
2319
variable "create_new_compartment_for_oke" {
2420
default = false
2521
description = "Creates new compartment for OKE Nodes and OCI Services deployed. NOTE: The creation of the compartment increases the deployment time by at least 3 minutes, and can increase by 15 minutes when destroying"

terraform/oke.tf

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ resource "oci_identity_compartment" "oke_compartment" {
8989
count = var.create_new_compartment_for_oke ? 1 : 0
9090
}
9191
locals {
92-
# oke_compartment_ocid = var.create_new_compartment_for_oke ? oci_identity_compartment.oke_compartment.0.id : var.compartment_ocid
93-
oke_compartment_ocid = var.create_new_oke_cluster ? (var.create_new_compartment_for_oke ? oci_identity_compartment.oke_compartment.0.id : var.compartment_ocid) : var.existent_oke_cluster_compartment_ocid
92+
oke_compartment_ocid = var.create_new_oke_cluster ? (var.create_new_compartment_for_oke ? oci_identity_compartment.oke_compartment.0.id : var.compartment_ocid) : var.compartment_ocid
9493
}
9594

9695
# Local kubeconfig for when using Terraform locally. Not used by Oracle Resource Manager
@@ -109,8 +108,8 @@ resource "tls_private_key" "oke_worker_node_ssh_key" {
109108
locals {
110109
cluster_k8s_latest_version = reverse(sort(data.oci_containerengine_cluster_option.oke.kubernetes_versions))[0]
111110
node_pool_k8s_latest_version = reverse(sort(data.oci_containerengine_node_pool_option.oke.kubernetes_versions))[0]
112-
deployed_k8s_version = var.create_new_oke_cluster ? (var.k8s_version == "Latest") ? local.cluster_k8s_latest_version : var.k8s_version :[
113-
for x in data.oci_containerengine_clusters.oke.clusters : x.kubernetes_version if x.id == var.existent_oke_cluster_id][0]
111+
deployed_k8s_version = var.create_new_oke_cluster ? (var.k8s_version == "Latest") ? local.cluster_k8s_latest_version : var.k8s_version : [
112+
for x in data.oci_containerengine_clusters.oke.clusters : x.kubernetes_version if x.id == var.existent_oke_cluster_id][0]
114113
}
115114

116115
# Checks if is using Flexible Compute Shapes

0 commit comments

Comments
 (0)