Skip to content

[Terraform] Model referencing is broken between cos-lite module and charm modules #344

@deusebio

Description

@deusebio

I'm trying to simply deploy the cos-lite tf module using the following TF file:

resource "juju_model" "cos" {
  name       = "cos"
  credential = var.K8S_CREDENTIAL
  cloud {
    name = var.K8S_CLOUD
  }
}

module "cos" {
  depends_on = [juju_model.cos]
  source     = "git::https://github.com/canonical/observability//terraform/modules/cos-lite"
  model_name = juju_model.cos.name
}

However, when doing terraform plan, I receive the following error:

❯ terraform plan 
╷
│ Error: Missing required argument
│ 
│   on .terraform/modules/cos/terraform/modules/cos-lite/main.tf line 45, in module "traefik":
│   45: module "traefik" {
│ 
│ The argument "model" is required, but no definition was found.
╵
╷
│ Error: Unsupported argument
│ 
│   on .terraform/modules/cos/terraform/modules/cos-lite/main.tf line 48, in module "traefik":
│   48:   model_name = var.model_name
│ 
│ An argument named "model_name" is not expected here.
╵

I believe the problem is due to some recent regressions introduced by this PR and similar PRs also on alertmanager.

I've been trying to fix this myself and raise a PR (see #345 ), but there is a bit of inconsistencies across the stack, some of the charms requires model (e.g. alertmanager, traefik) and some other requires model_name (loki, prometheus)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions