|
| 1 | +module "identity_ml_app_tags" { |
| 2 | + source = "../../shared_modules/identity_ml_app_tags" |
| 3 | + namespace_suffix = var.application_name |
| 4 | + environment_name = var.environment_name |
| 5 | + compartment_id = var.tenancy_id |
| 6 | +} |
| 7 | + |
| 8 | +resource "oci_identity_compartment" "app" { |
| 9 | + depends_on = [module.identity_ml_app_tags] |
| 10 | + |
| 11 | + name = "ml-app-${var.application_name}-${var.environment_name}" |
| 12 | + description = "Compartment for ML Application '${var.application_name}'" |
| 13 | + compartment_id = var.tenancy_id |
| 14 | + |
| 15 | + defined_tags = {"${module.identity_ml_app_tags.mlapp_env_namespace}.${module.identity_ml_app_tags.compartment_type_tag}" = "${module.identity_ml_app_tags.compartment_type_app}"} |
| 16 | + freeform_tags = { |
| 17 | + # For app deployments to be able to get environment specific tag namespace |
| 18 | + "MlApplicationTagNamespaceName" = "${module.identity_ml_app_tags.mlapps_namespace}" |
| 19 | + } |
| 20 | +} |
| 21 | + |
| 22 | +module "identity_ml_app_runtime_policies" { |
| 23 | + source = "../../shared_modules/identity_ml_app_runtime" |
| 24 | + depends_on = [oci_identity_compartment.app] |
| 25 | + |
| 26 | + tenancy_id = var.tenancy_id |
| 27 | + app_compartment_id = oci_identity_compartment.app.id |
| 28 | + policy_name_suffix = var.application_name |
| 29 | + environment_name = var.environment_name |
| 30 | + external_subnet_compartment_id = var.subnet_compartment_id |
| 31 | + |
| 32 | + mlapps_tag_namespace = module.identity_ml_app_tags.mlapps_namespace |
| 33 | + mlapp_env_tag_namespace = module.identity_ml_app_tags.mlapp_env_namespace |
| 34 | + mlapp_instance_id_tag = module.identity_ml_app_tags.mlapp_instance_tag |
| 35 | + compartment_type_tag = module.identity_ml_app_tags.compartment_type_tag |
| 36 | +} |
| 37 | + |
| 38 | +module "identity_ml_app_enablement" { |
| 39 | + source = "../../shared_modules/identity_ml_app_enablement" |
| 40 | + depends_on = [oci_identity_compartment.app] |
| 41 | + |
| 42 | + policy_name_suffix = var.application_name |
| 43 | + environment_name = var.environment_name |
| 44 | + tenancy_id = var.tenancy_id |
| 45 | + mlapp_env_tag_namespace = module.identity_ml_app_tags.mlapp_env_namespace |
| 46 | + compartment_type_tag = module.identity_ml_app_tags.compartment_type_tag |
| 47 | +} |
| 48 | + |
| 49 | +module "identity_ml_app_operators" { |
| 50 | + count = var.app_team_group_id != "" ? 1 : 0 # This will be created only if dev team group ID is provided |
| 51 | + source = "../../shared_modules/identity_ml_app_operators" |
| 52 | + depends_on = [oci_identity_compartment.app] |
| 53 | + |
| 54 | + tenancy_id = var.tenancy_id |
| 55 | + app_compartment_id = oci_identity_compartment.app.id |
| 56 | + app_team_group_id = var.app_team_group_id |
| 57 | + application_name = var.application_name |
| 58 | + environment_naming_suffix = var.environment_name |
| 59 | + app_team_group_tenancy_id = var.app_team_group_tenancy_id |
| 60 | +} |
| 61 | + |
| 62 | +output "tenancy_id" { |
| 63 | + value = var.tenancy_id |
| 64 | +} |
| 65 | + |
| 66 | +output "environment_compartment_id" { |
| 67 | + value = oci_identity_compartment.app.id |
| 68 | +} |
| 69 | + |
| 70 | +output "mlapps_tag_namespace" { |
| 71 | + value = module.identity_ml_app_tags.mlapps_namespace |
| 72 | +} |
| 73 | + |
| 74 | + |
0 commit comments