diff --git a/terraform/app-configmap.tf b/terraform/app-configmap.tf index 38224d2..2363675 100644 --- a/terraform/app-configmap.tf +++ b/terraform/app-configmap.tf @@ -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" } } \ No newline at end of file diff --git a/terraform/app-registration.tf b/terraform/app-registration.tf index 4c3b892..804ad90 100644 --- a/terraform/app-registration.tf +++ b/terraform/app-registration.tf @@ -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 diff --git a/terraform/database.tf b/terraform/database.tf index 2b91bc0..d1fe67d 100644 --- a/terraform/database.tf +++ b/terraform/database.tf @@ -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 } diff --git a/terraform/locals.tf b/terraform/locals.tf index ccd7796..49cc55d 100644 --- a/terraform/locals.tf +++ b/terraform/locals.tf @@ -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 = { diff --git a/terraform/modules/corrino/modules/cluster-tools/grafana.tf b/terraform/modules/corrino/modules/cluster-tools/grafana.tf index 3fab98d..4cd1e0b 100644 --- a/terraform/modules/corrino/modules/cluster-tools/grafana.tf +++ b/terraform/modules/corrino/modules/cluster-tools/grafana.tf @@ -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 diff --git a/terraform/policies.tf b/terraform/policies.tf index bd97210..d48567b 100644 --- a/terraform/policies.tf +++ b/terraform/policies.tf @@ -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 } @@ -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] } \ No newline at end of file diff --git a/terraform/random.tf b/terraform/random.tf index de2a1ef..2324366 100644 --- a/terraform/random.tf +++ b/terraform/random.tf @@ -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 -} \ No newline at end of file +#resource "random_string" "registration_id" { +# length = 8 +# special = false +# upper = false +#} \ No newline at end of file