diff --git a/modules/sdcore-k8s/README.md b/modules/sdcore-k8s/README.md index 29d34a0..4392c42 100644 --- a/modules/sdcore-k8s/README.md +++ b/modules/sdcore-k8s/README.md @@ -11,7 +11,7 @@ This module is used to deploy a standalone 5G core network including 5G control - **main.tf** - Defines the Juju application to be deployed. - **variables.tf** - Allows customization of the deployment including Juju model name, charm's channel and configuration. - **output.tf** - Responsible for integrating the module with other Terraform modules, primarily by defining potential integration endpoints (charm integrations). -- **terraform.tf** - Defines the Terraform provider. +- **versions.tf** - Defines the Terraform provider. ## Deploying sdcore-k8s module @@ -74,7 +74,7 @@ Create the `terraform.tfvars` file to specify the name of the Juju model to depl ```console cat << EOF | tee terraform.tfvars -model_name = "put your model-name here" +model = "put your model-name here" # Customize the configuration variables here if needed EOF diff --git a/modules/sdcore-k8s/main.tf b/modules/sdcore-k8s/main.tf index 893f001..6424e12 100644 --- a/modules/sdcore-k8s/main.tf +++ b/modules/sdcore-k8s/main.tf @@ -1,210 +1,209 @@ # Copyright 2024 Canonical Ltd. # See LICENSE file for licensing details. -resource "juju_model" "sdcore" { - count = var.create_model == true ? 1 : 0 - name = var.model_name +data "juju_model" "sdcore" { + name = var.model } module "amf" { - source = "git::https://github.com/canonical/sdcore-amf-k8s-operator//terraform" - model_name = var.create_model == true ? juju_model.sdcore[0].name : var.model_name - channel = var.sdcore_channel - config = var.amf_config + source = "git::https://github.com/canonical/sdcore-amf-k8s-operator//terraform?ref=chore-cc006" + model = data.juju_model.sdcore.name + channel = var.sdcore_channel + config = var.amf_config } module "ausf" { - source = "git::https://github.com/canonical/sdcore-ausf-k8s-operator//terraform" - model_name = var.create_model == true ? juju_model.sdcore[0].name : var.model_name - channel = var.sdcore_channel + source = "git::https://github.com/canonical/sdcore-ausf-k8s-operator//terraform?ref=chore-cc006" + model = data.juju_model.sdcore.name + channel = var.sdcore_channel } module "nms" { - source = "git::https://github.com/canonical/sdcore-nms-k8s-operator//terraform" - model_name = var.create_model == true ? juju_model.sdcore[0].name : var.model_name - channel = var.sdcore_channel + source = "git::https://github.com/canonical/sdcore-nms-k8s-operator//terraform?ref=chore-cc006" + model = data.juju_model.sdcore.name + channel = var.sdcore_channel } module "nrf" { - source = "git::https://github.com/canonical/sdcore-nrf-k8s-operator//terraform" - model_name = var.create_model == true ? juju_model.sdcore[0].name : var.model_name - channel = var.sdcore_channel + source = "git::https://github.com/canonical/sdcore-nrf-k8s-operator//terraform?ref=chore-cc006" + model = data.juju_model.sdcore.name + channel = var.sdcore_channel } module "nssf" { - source = "git::https://github.com/canonical/sdcore-nssf-k8s-operator//terraform" - model_name = var.create_model == true ? juju_model.sdcore[0].name : var.model_name - channel = var.sdcore_channel - config = var.nssf_config + source = "git::https://github.com/canonical/sdcore-nssf-k8s-operator//terraform?ref=chore-cc006" + model = data.juju_model.sdcore.name + channel = var.sdcore_channel + config = var.nssf_config } module "pcf" { - source = "git::https://github.com/canonical/sdcore-pcf-k8s-operator//terraform" - model_name = var.create_model == true ? juju_model.sdcore[0].name : var.model_name - channel = var.sdcore_channel + source = "git::https://github.com/canonical/sdcore-pcf-k8s-operator//terraform?ref=chore-cc006" + model = data.juju_model.sdcore.name + channel = var.sdcore_channel } module "smf" { - source = "git::https://github.com/canonical/sdcore-smf-k8s-operator//terraform" - model_name = var.create_model == true ? juju_model.sdcore[0].name : var.model_name - channel = var.sdcore_channel + source = "git::https://github.com/canonical/sdcore-smf-k8s-operator//terraform?ref=chore-cc006" + model = data.juju_model.sdcore.name + channel = var.sdcore_channel } module "udm" { - source = "git::https://github.com/canonical/sdcore-udm-k8s-operator//terraform" - model_name = var.create_model == true ? juju_model.sdcore[0].name : var.model_name - channel = var.sdcore_channel + source = "git::https://github.com/canonical/sdcore-udm-k8s-operator//terraform?ref=chore-cc006" + model = data.juju_model.sdcore.name + channel = var.sdcore_channel } module "udr" { - source = "git::https://github.com/canonical/sdcore-udr-k8s-operator//terraform" - model_name = var.create_model == true ? juju_model.sdcore[0].name : var.model_name - channel = var.sdcore_channel + source = "git::https://github.com/canonical/sdcore-udr-k8s-operator//terraform?ref=chore-cc006" + model = data.juju_model.sdcore.name + channel = var.sdcore_channel } module "mongodb" { source = "../external/mongodb-k8s" - model_name = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model_name = data.juju_model.sdcore.name channel = var.mongo_channel config = var.mongo_config } module "grafana-agent" { source = "../external/grafana-agent-k8s" - model_name = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model_name = data.juju_model.sdcore.name channel = var.grafana_agent_channel config = var.grafana_agent_config } module "self-signed-certificates" { source = "git::https://github.com/canonical/self-signed-certificates-operator//terraform" - model_name = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model_name = data.juju_model.sdcore.name channel = var.self_signed_certificates_channel config = var.self_signed_certificates_config } module "traefik" { source = "../external/traefik-k8s" - model_name = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model_name = data.juju_model.sdcore.name channel = var.traefik_channel config = var.traefik_config } module "upf" { - source = "git::https://github.com/canonical/sdcore-upf-k8s-operator//terraform" - model_name = var.create_model == true ? juju_model.sdcore[0].name : var.model_name - channel = var.sdcore_channel - config = var.upf_config + source = "git::https://github.com/canonical/sdcore-upf-k8s-operator//terraform?ref=chore-cc006" + model = data.juju_model.sdcore.name + channel = var.sdcore_channel + config = var.upf_config } # Integrations for `fiveg-nrf` endpoint resource "juju_integration" "amf-fiveg-nrf" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.amf.app_name - endpoint = module.amf.fiveg_nrf_endpoint + endpoint = module.amf.requires.fiveg_nrf } application { name = module.nrf.app_name - endpoint = module.nrf.fiveg_nrf_endpoint + endpoint = module.nrf.provides.fiveg_nrf } } resource "juju_integration" "udm-fiveg-nrf" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.udm.app_name - endpoint = module.udm.fiveg_nrf_endpoint + endpoint = module.udm.requires.fiveg_nrf } application { name = module.nrf.app_name - endpoint = module.nrf.fiveg_nrf_endpoint + endpoint = module.nrf.provides.fiveg_nrf } } resource "juju_integration" "smf-fiveg-nrf" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.smf.app_name - endpoint = module.smf.fiveg_nrf_endpoint + endpoint = module.smf.requires.fiveg_nrf } application { name = module.nrf.app_name - endpoint = module.nrf.fiveg_nrf_endpoint + endpoint = module.nrf.provides.fiveg_nrf } } resource "juju_integration" "pcf-fiveg-nrf" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.pcf.app_name - endpoint = module.pcf.fiveg_nrf_endpoint + endpoint = module.pcf.requires.fiveg_nrf } application { name = module.nrf.app_name - endpoint = module.nrf.fiveg_nrf_endpoint + endpoint = module.nrf.provides.fiveg_nrf } } resource "juju_integration" "nssf-fiveg-nrf" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.nssf.app_name - endpoint = module.nssf.fiveg_nrf_endpoint + endpoint = module.nssf.requires.fiveg_nrf } application { name = module.nrf.app_name - endpoint = module.nrf.fiveg_nrf_endpoint + endpoint = module.nrf.provides.fiveg_nrf } } resource "juju_integration" "udr-fiveg-nrf" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.udr.app_name - endpoint = module.udr.fiveg_nrf_endpoint + endpoint = module.udr.requires.fiveg_nrf } application { name = module.nrf.app_name - endpoint = module.nrf.fiveg_nrf_endpoint + endpoint = module.nrf.provides.fiveg_nrf } } resource "juju_integration" "ausf-fiveg-nrf" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.ausf.app_name - endpoint = module.ausf.fiveg_nrf_endpoint + endpoint = module.ausf.requires.fiveg_nrf } application { name = module.nrf.app_name - endpoint = module.nrf.fiveg_nrf_endpoint + endpoint = module.nrf.provides.fiveg_nrf } } # Integrations for `database` endpoint resource "juju_integration" "udr-auth-database" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.udr.app_name - endpoint = module.udr.auth_database_endpoint + endpoint = module.udr.requires.auth_database } application { @@ -214,11 +213,11 @@ resource "juju_integration" "udr-auth-database" { } resource "juju_integration" "udr-common-database" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.udr.app_name - endpoint = module.udr.common_database_endpoint + endpoint = module.udr.requires.common_database } application { @@ -228,11 +227,11 @@ resource "juju_integration" "udr-common-database" { } resource "juju_integration" "nrf-database" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.nrf.app_name - endpoint = module.nrf.database_endpoint + endpoint = module.nrf.requires.database } application { @@ -242,11 +241,11 @@ resource "juju_integration" "nrf-database" { } resource "juju_integration" "nms-auth-database" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.nms.app_name - endpoint = module.nms.auth_database_endpoint + endpoint = module.nms.requires.auth_database } application { @@ -256,11 +255,11 @@ resource "juju_integration" "nms-auth-database" { } resource "juju_integration" "nms-common-database" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.nms.app_name - endpoint = module.nms.common_database_endpoint + endpoint = module.nms.requires.common_database } application { @@ -272,125 +271,125 @@ resource "juju_integration" "nms-common-database" { # Integrations for `sdcore_config` endpoint resource "juju_integration" "amf-sdcore-config" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.amf.app_name - endpoint = module.amf.sdcore_config_endpoint + endpoint = module.amf.requires.sdcore_config } application { name = module.nms.app_name - endpoint = module.nms.sdcore_config_endpoint + endpoint = module.nms.provides.sdcore_config } } resource "juju_integration" "ausf-sdcore-config" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.ausf.app_name - endpoint = module.ausf.sdcore_config_endpoint + endpoint = module.ausf.requires.sdcore_config } application { name = module.nms.app_name - endpoint = module.nms.sdcore_config_endpoint + endpoint = module.nms.provides.sdcore_config } } resource "juju_integration" "nrf-sdcore-config" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.nrf.app_name - endpoint = module.nrf.sdcore_config_endpoint + endpoint = module.nrf.requires.sdcore_config } application { name = module.nms.app_name - endpoint = module.nms.sdcore_config_endpoint + endpoint = module.nms.provides.sdcore_config } } resource "juju_integration" "nssf-sdcore-config" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.nssf.app_name - endpoint = module.nssf.sdcore_config_endpoint + endpoint = module.nssf.requires.sdcore_config } application { name = module.nms.app_name - endpoint = module.nms.sdcore_config_endpoint + endpoint = module.nms.provides.sdcore_config } } resource "juju_integration" "pcf-sdcore-config" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.pcf.app_name - endpoint = module.pcf.sdcore_config_endpoint + endpoint = module.pcf.requires.sdcore_config } application { name = module.nms.app_name - endpoint = module.nms.sdcore_config_endpoint + endpoint = module.nms.provides.sdcore_config } } resource "juju_integration" "smf-sdcore-config" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.smf.app_name - endpoint = module.smf.sdcore_config_endpoint + endpoint = module.smf.requires.sdcore_config } application { name = module.nms.app_name - endpoint = module.nms.sdcore_config_endpoint + endpoint = module.nms.provides.sdcore_config } } resource "juju_integration" "udm-sdcore-config" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.udm.app_name - endpoint = module.udm.sdcore_config_endpoint + endpoint = module.udm.requires.sdcore_config } application { name = module.nms.app_name - endpoint = module.nms.sdcore_config_endpoint + endpoint = module.nms.provides.sdcore_config } } resource "juju_integration" "udr-sdcore-config" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.udr.app_name - endpoint = module.udr.sdcore_config_endpoint + endpoint = module.udr.requires.sdcore_config } application { name = module.nms.app_name - endpoint = module.nms.sdcore_config_endpoint + endpoint = module.nms.provides.sdcore_config } } # Integrations for `metrics` endpoint resource "juju_integration" "amf-metrics" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.amf.app_name - endpoint = module.amf.metrics_endpoint + endpoint = module.amf.provides.metrics } application { @@ -400,11 +399,11 @@ resource "juju_integration" "amf-metrics" { } resource "juju_integration" "ausf-metrics" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.ausf.app_name - endpoint = module.ausf.metrics_endpoint + endpoint = module.ausf.provides.metrics } application { @@ -414,7 +413,7 @@ resource "juju_integration" "ausf-metrics" { } resource "juju_integration" "mongodb-metrics" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.mongodb.app_name @@ -428,11 +427,11 @@ resource "juju_integration" "mongodb-metrics" { } resource "juju_integration" "nrf-metrics" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.nrf.app_name - endpoint = module.nrf.metrics_endpoint + endpoint = module.nrf.provides.metrics } application { @@ -442,11 +441,11 @@ resource "juju_integration" "nrf-metrics" { } resource "juju_integration" "nssf-metrics" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.nssf.app_name - endpoint = module.nssf.metrics_endpoint + endpoint = module.nssf.provides.metrics } application { @@ -456,11 +455,11 @@ resource "juju_integration" "nssf-metrics" { } resource "juju_integration" "pcf-metrics" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.pcf.app_name - endpoint = module.pcf.metrics_endpoint + endpoint = module.pcf.provides.metrics } application { @@ -470,11 +469,11 @@ resource "juju_integration" "pcf-metrics" { } resource "juju_integration" "smf-metrics" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.smf.app_name - endpoint = module.smf.metrics_endpoint + endpoint = module.smf.provides.metrics } application { @@ -484,11 +483,11 @@ resource "juju_integration" "smf-metrics" { } resource "juju_integration" "udm-metrics" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.udm.app_name - endpoint = module.udm.metrics_endpoint + endpoint = module.udm.provides.metrics } application { @@ -498,11 +497,11 @@ resource "juju_integration" "udm-metrics" { } resource "juju_integration" "udr-metrics" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.udr.app_name - endpoint = module.udr.metrics_endpoint + endpoint = module.udr.provides.metrics } application { @@ -512,11 +511,11 @@ resource "juju_integration" "udr-metrics" { } resource "juju_integration" "upf-metrics" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.upf.app_name - endpoint = module.upf.metrics_endpoint + endpoint = module.upf.provides.metrics } application { @@ -528,11 +527,11 @@ resource "juju_integration" "upf-metrics" { # Integrations for `certificates` endpoint resource "juju_integration" "amf-certificates" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.amf.app_name - endpoint = module.amf.certificates_endpoint + endpoint = module.amf.requires.certificates } application { @@ -542,11 +541,11 @@ resource "juju_integration" "amf-certificates" { } resource "juju_integration" "udm-certificates" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.udm.app_name - endpoint = module.udm.certificates_endpoint + endpoint = module.udm.requires.certificates } application { @@ -556,11 +555,11 @@ resource "juju_integration" "udm-certificates" { } resource "juju_integration" "smf-certificates" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.smf.app_name - endpoint = module.smf.certificates_endpoint + endpoint = module.smf.requires.certificates } application { @@ -570,11 +569,11 @@ resource "juju_integration" "smf-certificates" { } resource "juju_integration" "pcf-certificates" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.pcf.app_name - endpoint = module.pcf.certificates_endpoint + endpoint = module.pcf.requires.certificates } application { @@ -584,11 +583,11 @@ resource "juju_integration" "pcf-certificates" { } resource "juju_integration" "nssf-certificates" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.nssf.app_name - endpoint = module.nssf.certificates_endpoint + endpoint = module.nssf.requires.certificates } application { @@ -598,11 +597,11 @@ resource "juju_integration" "nssf-certificates" { } resource "juju_integration" "nrf-certificates" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.nrf.app_name - endpoint = module.nrf.certificates_endpoint + endpoint = module.nrf.requires.certificates } application { @@ -612,11 +611,11 @@ resource "juju_integration" "nrf-certificates" { } resource "juju_integration" "ausf-certificates" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.ausf.app_name - endpoint = module.ausf.certificates_endpoint + endpoint = module.ausf.requires.certificates } application { @@ -626,11 +625,11 @@ resource "juju_integration" "ausf-certificates" { } resource "juju_integration" "udr-certificates" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.udr.app_name - endpoint = module.udr.certificates_endpoint + endpoint = module.udr.requires.certificates } application { @@ -642,11 +641,11 @@ resource "juju_integration" "udr-certificates" { # Integrations for `ingress` endpoint resource "juju_integration" "nms-ingress" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.nms.app_name - endpoint = module.nms.ingress_endpoint + endpoint = module.nms.requires.ingress } application { @@ -658,7 +657,7 @@ resource "juju_integration" "nms-ingress" { # Integrations for `logging` endpoint resource "juju_integration" "mongodb-logging" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.mongodb.app_name @@ -672,11 +671,11 @@ resource "juju_integration" "mongodb-logging" { } resource "juju_integration" "amf-logging" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.amf.app_name - endpoint = module.amf.logging_endpoint + endpoint = module.amf.requires.logging } application { @@ -686,11 +685,11 @@ resource "juju_integration" "amf-logging" { } resource "juju_integration" "ausf-logging" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.ausf.app_name - endpoint = module.ausf.logging_endpoint + endpoint = module.ausf.requires.logging } application { @@ -700,11 +699,11 @@ resource "juju_integration" "ausf-logging" { } resource "juju_integration" "nrf-logging" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.nrf.app_name - endpoint = module.nrf.logging_endpoint + endpoint = module.nrf.requires.logging } application { @@ -714,11 +713,11 @@ resource "juju_integration" "nrf-logging" { } resource "juju_integration" "nssf-logging" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.nssf.app_name - endpoint = module.nssf.logging_endpoint + endpoint = module.nssf.requires.logging } application { @@ -728,11 +727,11 @@ resource "juju_integration" "nssf-logging" { } resource "juju_integration" "pcf-logging" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.pcf.app_name - endpoint = module.pcf.logging_endpoint + endpoint = module.pcf.requires.logging } application { @@ -742,11 +741,11 @@ resource "juju_integration" "pcf-logging" { } resource "juju_integration" "smf-logging" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.smf.app_name - endpoint = module.smf.logging_endpoint + endpoint = module.smf.requires.logging } application { @@ -756,11 +755,11 @@ resource "juju_integration" "smf-logging" { } resource "juju_integration" "udm-logging" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.udm.app_name - endpoint = module.udm.logging_endpoint + endpoint = module.udm.requires.logging } application { @@ -770,11 +769,11 @@ resource "juju_integration" "udm-logging" { } resource "juju_integration" "udr-logging" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.udr.app_name - endpoint = module.udr.logging_endpoint + endpoint = module.udr.requires.logging } application { @@ -784,11 +783,11 @@ resource "juju_integration" "udr-logging" { } resource "juju_integration" "upf-logging" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.upf.app_name - endpoint = module.upf.logging_endpoint + endpoint = module.upf.requires.logging } application { @@ -798,11 +797,11 @@ resource "juju_integration" "upf-logging" { } resource "juju_integration" "nms-logging" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.nms.app_name - endpoint = module.nms.logging_endpoint + endpoint = module.nms.requires.logging } application { @@ -814,29 +813,29 @@ resource "juju_integration" "nms-logging" { # Integrations for `fiveg-n4` endpoint resource "juju_integration" "upf-nms" { - model = var.create_model == true ? juju_model.sdcore[0].name : var.model_name + model = data.juju_model.sdcore.name application { name = module.upf.app_name - endpoint = module.upf.fiveg_n4_endpoint + endpoint = module.upf.provides.fiveg_n4 } application { name = module.nms.app_name - endpoint = module.nms.fiveg_n4_endpoint + endpoint = module.nms.requires.fiveg_n4 } } # Cross-model integrations resource "juju_offer" "amf-fiveg-n2" { - model = var.model_name + model = data.juju_model.sdcore.name application_name = module.amf.app_name - endpoint = module.amf.fiveg_n2_endpoint + endpoint = module.amf.provides.fiveg_n2 } resource "juju_offer" "upf-fiveg-n3" { - model = var.model_name + model = data.juju_model.sdcore.name application_name = module.upf.app_name - endpoint = module.upf.fiveg_n3_endpoint + endpoint = module.upf.provides.fiveg_n3 } diff --git a/modules/sdcore-k8s/outputs.tf b/modules/sdcore-k8s/outputs.tf index ca79fde..fcf4a55 100644 --- a/modules/sdcore-k8s/outputs.tf +++ b/modules/sdcore-k8s/outputs.tf @@ -21,7 +21,7 @@ output "nms_app_name" { } output "fiveg_gnb_identity_endpoint" { description = "Name of the endpoint to integrate with fiveg_gnb_identity interface." - value = module.nms.fiveg_gnb_identity_endpoint + value = module.nms.requires.fiveg_gnb_identity } output "grafana_agent_app_name" { diff --git a/modules/sdcore-k8s/variables.tf b/modules/sdcore-k8s/variables.tf index a692d36..7881b20 100644 --- a/modules/sdcore-k8s/variables.tf +++ b/modules/sdcore-k8s/variables.tf @@ -1,10 +1,9 @@ # Copyright 2024 Canonical Ltd. # See LICENSE file for licensing details. -variable "model_name" { - description = "Name of Juju model to deploy application to." +variable "model" { + description = "Reference to the Juju model to deploy application to." type = string - default = "sdcore" } variable "create_model" {