canonical / observability

Apache License 2.0
7 stars 11 forks source link

[tf] Use namespaced output variables for endpoints #214

Open sed-i opened 1 month ago

sed-i commented 1 month ago

We should have "static" entries for all relations. This would also help with code generation. They should be nested under requires and provides. We should keep the same structure in the higher level modules (e.g. mimir-ha and then cos-ha). When we autogenerate this from charm source, the description could be added in as a comment.

Option 1: Mapping from string to string

output "requires" {
  value = {
    mimir_cluster = "mimir-cluster"
  }
}

Option 2: Mapping from string to application

This way, the output variable could be readily used in a juju_integration block.

For example:

output "requires" {
  value = {
    mimir_cluster = application {
      name     = self.app_name
      endpoint = "mimir-cluster"
    }
  }  
}

Not sure if we can use application though.

sed-i commented 1 month ago

Currently, specifying juju integrations has these shortcomings:

  1. We need to explicitly have .provides and .requires, whereas when we juju integrate it is not necessary to know which app is which.
  2. We specify the endpoint indirectly (module.tempo.provides.grafana_source), but the application name directly (module.tempo.app_names.tempo_coordinator) so we leak implementation detail by asking the user to know to which app exactly to relate to.