Skip to content

Commit

Permalink
Adding resource tagging and enhanced data tracking.
Browse files Browse the repository at this point in the history
Spacing
  • Loading branch information
dkennetzoracle committed Feb 11, 2025
1 parent d48ed86 commit a17bf54
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 27 deletions.
3 changes: 3 additions & 0 deletions terraform/app-configmap.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@ resource "kubernetes_config_map" "corrino-configmap" {
REGION_NAME = local.oci.region_name
TENANCY_ID = local.oci.tenancy_id
TENANCY_NAMESPACE = local.oci.tenancy_namespace
DATA_UPLOAD_PATH = var.share_data_with_corrino_team_enabled ? local.registration.upload_path : ""
DEPLOYMENT_UUID = var.share_data_with_corrino_team_enabled ? random_uuid.registration_id.result : ""
DATA_SHARING_ENABLED = var.share_data_with_corrino_team_enabled ? "True" : "False"
}
}
2 changes: 1 addition & 1 deletion terraform/app-registration.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ resource "null_resource" "registration" {
}
provisioner "local-exec" {
command = <<-EOT
curl -X PUT --data-binary '@${local.registration.object_filepath}' ${local.registration.bucket_par}${local.registration.object_filename}
curl -X PUT --data-binary '@${local.registration.object_filepath}' ${local.registration.upload_path}${local.registration.object_filename}
EOT
}
count = var.share_data_with_corrino_team_enabled ? 1 : 0
Expand Down
1 change: 1 addition & 0 deletions terraform/database.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ resource "oci_database_autonomous_database" "autonomous_database" {
is_free_tier = var.autonomous_database_is_free_tier

count = 1
freeform_tags = local.corrino_tags
}


Expand Down
40 changes: 21 additions & 19 deletions terraform/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,27 @@ locals {
}

registration = {
object_filename = format("corrino-registration-%s", random_string.registration_id.result)
object_filepath = format("%s/%s", abspath(path.root), random_string.registration_id.result)
object_content = join("\n", [
"-----------------------------------------------",
"Corrino Registration",
"-----------------------------------------------",
format("Registration ID : %s", random_string.registration_id.result),
format("Deploy DateTime : %s", local.ts),
format("Administrator : %s", var.corrino_admin_email),
format("Workspace Name : %s", local.app_name),
format("Deploy ID : %s", local.deploy_id),
format("Corrino Version : %s", var.corrino_version),
format("FQDN : %s", local.fqdn.name),
format("Tenancy OCID : %s", local.oci.tenancy_id),
format("OKE Cluster OCID : %s", local.oke.cluster_ocid),
format("Region : %s", local.oci.region_name),
]
)
bucket_par = "https://objectstorage.us-ashburn-1.oraclecloud.com/p/bqCfQwvzAZPCnxehCZs1Le5V2Pajn3j4JsFzb5CWHRNvtQ4Je-Lk_ApwCcurdpYT/n/iduyx1qnmway/b/corrino-terraform-registry/o/"
#object_filename = format("corrino-registration-%s", random_string.registration_id.result)
object_filename = "corrino_registration.json"
object_filepath = format("%s/%s", abspath(path.root), random_uuid.registration_id.result)
object_content = jsonencode({
"Registration ID" = random_uuid.registration_id.result
"Deploy DateTime" = local.ts
"Administrator" = var.corrino_admin_email
"Workspace Name" = local.app_name
"Deploy ID" = local.deploy_id
"Corrino Version" = var.corrino_version
"FQDN" = local.fqdn.name
"Tenancy OCID" = local.oci.tenancy_id
"OKE Cluster OCID" = local.oke.cluster_ocid
"Region" = local.oci.region_name
})
upload_path = "https://objectstorage.us-ashburn-1.oraclecloud.com/p/bqCfQwvzAZPCnxehCZs1Le5V2Pajn3j4JsFzb5CWHRNvtQ4Je-Lk_ApwCcurdpYT/n/iduyx1qnmway/b/corrino-terraform-registry/o/${random_uuid.registration_id.result}/"
}

corrino_tags = {
"corrino_installed" = timestamp()
"corrino_uuid" = random_uuid.registration_id.result
}

versions = {
Expand Down
4 changes: 4 additions & 0 deletions terraform/modules/corrino/modules/cluster-tools/grafana.tf
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ dashboards:
gnetId: 13594
revision: 1
datasource: Oracle Cloud Infrastructure Metrics
nvidia-dcgm:
gnetId: 12239
revision: 2
datasource: Prometheus
dashboardProviders:
dashboardproviders.yaml:
apiVersion: 1
Expand Down
6 changes: 4 additions & 2 deletions terraform/policies.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ resource "oci_identity_dynamic_group" "dyn_group" {
description = "Dynamic group for OKE instances across the tenancy"
compartment_id = var.tenancy_ocid
matching_rule = "ALL {instance.compartment.id = '${var.compartment_ocid}'}"
freeform_tags = local.corrino_tags
count = var.policy_creation_enabled ? 1 : 0
}

Expand All @@ -24,6 +25,7 @@ resource "oci_identity_policy" "oke_instances_tenancy_policy" {
"Allow dynamic-group 'Default'/'${oci_identity_dynamic_group.dyn_group[0].name}' to manage all-resources in compartment ${data.oci_identity_compartment.oci_compartment.name}",
"Allow dynamic-group 'Default'/'${oci_identity_dynamic_group.dyn_group[0].name}' to use all-resources in tenancy",
]
count = var.policy_creation_enabled ? 1 : 0
depends_on = [oci_identity_dynamic_group.dyn_group]
freeform_tags = local.corrino_tags
count = var.policy_creation_enabled ? 1 : 0
depends_on = [oci_identity_dynamic_group.dyn_group]
}
12 changes: 7 additions & 5 deletions terraform/random.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ resource "random_string" "subdomain" {
upper = false
}

resource "random_uuid" "registration_id" {
}

resource "random_string" "registration_id" {
length = 8
special = false
upper = false
}
#resource "random_string" "registration_id" {
# length = 8
# special = false
# upper = false
#}

0 comments on commit a17bf54

Please sign in to comment.