Skip to content

Feature request: need native provider resource to perform juju scp operations #934

Description

@vishvikkrishnan

Requirements

We would benefit from a built-in resource to perform juju scp operations. Currently, this is only possible using the local-exec provisioner and makes our juju TF plans brittle and difficult to maintain/reuse/scale.

Sample local-exec snippet shared in Notes section for reference.

Urgency

It would save from a weird workaround

Notes & References

resource "terraform_data" "copy_oidc_ca_cert" {
  count            = var.path_to_oidc_cert != null ? 1 : 0
  depends_on       = [module.k8s]
  triggers_replace = [module.k8s]
  provisioner "local-exec" {
    command = <<-EOT
      juju wait-for model $MODEL --timeout 3600s --query='forEach(machines, machine => (machine.status == "started"))'
      for machine in $(juju status -m $MODEL --format=json | jq -rM '.machines | keys |  join(" ")'); do
        juju scp -m $MODEL $CERT "$${machine}":oidc_ca.crt
      done
    EOT
    environment = {
      MODEL = module.juju_model.model_name
      CERT  = var.path_to_oidc_cert
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featuresuggests new feature or enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions