juju / terraform-provider-juju

A Terraform provider for Juju
Apache License 2.0
21 stars 40 forks source link

deploying etcd or cinder not possible due to storage issues #481

Open arif-ali opened 6 months ago

arif-ali commented 6 months ago

Description

When deploying etcd or cinder, it is expecting to add storage. However, when deploying these 2 applications in LXD or KVM, this is not possible in juju, and doesn't allow it to go through.

Deploying the same 2 application via the bundle.yaml we don't face the same issues at all. We should be able to mimic the old way

Urgency

Blocker for our release

Terraform Juju Provider version

0.12.0

Terraform version

1.8.2

Juju version

2.9.49

Terraform Configuration(s)

resource "juju_application" "etcd" {
  name = "etcd"

  model = juju_model.cpe-focal.name

  charm {
    name     = "etcd"
    channel  = "latest/stable"
    base     = "ubuntu@20.04"
    revision = 583
  }

  placement = "${join(",",sort([
    juju_machine.etcd-1.machine_id,
    juju_machine.etcd-2.machine_id,
    juju_machine.etcd-3.machine_id,
  ]))}"

  endpoint_bindings = [{
    space = "oam"
  },{
    space = "oam"
    endpoint = "cluster"
  },{
    space = "oam"
    endpoint = "db"
  }]

  units = 3

  config = {
    channel = "3.2/stable"
  }
}

Reproduce / Test

terraform apply of the above plan gives us the following error

ERROR cannot add application "etcd": cannot deploy to machine 1/lxd/2: adding storage to lxd container not supported

Now using the following bundle, we are able to deploy the etcd application

applications:
  etcd:
    charm: cs:etcd
    num_units: 3
    bindings:
      "": *oam-space   
      cluster: *internal-space
      db: *internal-space
    options:
      channel: 3.2/stable
    to:
      - lxd:400
      - lxd:401
      - lxd:402

Debug/Panic Output

No response

Notes & References

Further analysis shows that, when deploying the above bundle, the following excerpt is from the export-bundle, and shows that we have storage data=loop,1024M.

  etcd:
    charm: etcd
    channel: latest/stable
    revision: 583
    resources:
      core: 0
      etcd: 3
      snapshot: 0
    num_units: 3
    to:
    - lxd:1
    - lxd:8
    - lxd:9
    options:
      channel: 3.2/stable
    constraints: arch=amd64
    storage:
      data: loop,1024M
    bindings:
      "": oam
      certificates: oam
      cluster: oam
      db: oam
      nrpe-external-master: oam
      proxy: oam

Now,i if we run the following command, we get the same error.

juju deploy etcd -n 3 --to 1/lxd/2,8/lxd/3,9/lxd/2 --storage data=loop,1024M

Ultimately, it would be good to be able to deploy the terraform plan above so, that it can mimic the bundle behaviour

arif-ali commented 5 months ago

I have now also encountered the same issue with the prometheus2 charm, here it has the following in the metadata.yaml

storage:
  metrics-filesystem:
    type: filesystem
    description: Storage for prometheus data
    location: /var/snap
    multiple:
      range: 0-1

The error below (the actual charm is prometheus2)

╷
│ Error: Client Error
│ 
│   with juju_application.prometheus,
│   on 25-prometheus.tf line 7, in resource "juju_application" "prometheus":
│    7: resource "juju_application" "prometheus" {
│ 
│ Unable to create application, got error: legacy deploy method: cannot add application "prometheus": cannot deploy to machine 0/lxd/1: adding storage to lxd container not supported
╵

It would be cool to get this covered, especially if the bundle allows us to deploy these without any problems

anvial commented 3 months ago

Duplicate of #198

hmlanigan commented 2 months ago

This issue is hitting an error message from juju itself, it's not a duplicate of #198.