Skip to content

Allow charm source to be fetched directly from Git instead of local path #581

@mateofloreza

Description

@mateofloreza

Steps to reproduce

The current module implementation works perfectly — everything deploys as expected.
However, it would be great to have an option to reference the charm source directly from Git instead of using a local relative path.

This would simplify integration with tools like Terragrunt, making it easier to manage module dependencies and versions consistently across environments.

Expected behavior

module "mongodb" {
  source = "git::https://github.com/canonical/mongodb-operator.git//terraform/charm/replica_set?ref=6/edge"

  channel  = var.mongodb.channel
  revision = var.mongodb.revision
  base     = var.mongodb.base

  app_name          = var.mongodb.app_name
  units             = var.mongodb.units
  machines          = var.mongodb.machines
  config            = merge(var.mongodb.config, { "role" : "replication" })
  model             = var.mongodb.model
  constraints       = var.mongodb.constraints
  storage           = var.mongodb.storage
  endpoint_bindings = var.mongodb.endpoint_bindings
  expose            = var.mongodb.expose
}

Actual behavior

module "mongodb" {
  source = "../../charm/replica_set"

  channel  = var.mongodb.channel
  revision = var.mongodb.revision
  base     = var.mongodb.base

  app_name          = var.mongodb.app_name
  units             = var.mongodb.units
  machines          = var.mongodb.machines
  config            = merge(var.mongodb.config, { "role" : "replication" })
  model             = var.mongodb.model
  constraints       = var.mongodb.constraints
  storage           = var.mongodb.storage
  endpoint_bindings = var.mongodb.endpoint_bindings
  expose            = var.mongodb.expose
}

Versions

Operating system: ubuntu 22.04

Juju CLI: 3.6.9

Juju agent: 3.6.9

Charm revision: 229

LXD: 5.21/stable

Log output

Juju debug log:

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working as expected

    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