Unable to deploy two applications of the same charm simultaneously

Bug #2071599 reported by Alastair Flynn
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Triaged
Medium
Heather Lanigan

Bug Description

Trying to deploy the same charm twice with the different names can lead to an error.

This issue was discovered via the terraform client with the following terraform plan which deploys 2 instances of traefik charm with different app names:

```
terraform {
  required_providers {
    juju = {
      source = "juju/juju"
      version = "= 0.11.0"
    }
  }
}

provider "juju" {}

variable "cloud" {
  description = "Name of K8S cloud to use for deployment"
  default = "microk8s"
}

variable "model" {
  description = "Name of Juju model to use for deployment"
  default = "ingress"
}

resource "juju_model" "ingress" {
  name = var.model

  cloud {
    name = var.cloud
    region = "localhost"
  }

}

resource "juju_application" "traefik" {
  name = "traefik"
  trust = true
  model = juju_model.ingress.name

  charm {
    name = "traefik-k8s"
    channel = "1.0/candidate"
    base = "ubuntu@20.04"
  }

  units = 1
}

resource "juju_application" "traefik-public" {
  name = "traefik-public"
  trust = true
  model = juju_model.ingress.name

  charm {
    name = "traefik-k8s"
    channel = "1.0/candidate"
    base = "ubuntu@20.04"
  }

  units = 1
}
```

And the resulting error was:

2024-04-03T08:07:59.148Z [ERROR] provider.terraform-provider-juju_v0.11.0: Response contains error diagnostic: tf_proto_version=6.4 tf_req_id=eb3b47d7-e50b-cc32-100a-d05292d8bd4a tf_resource_type=juju_application tf_rpc=ApplyResourceChange diagnostic_summary="Client Error" tf_provider_addr=registry.terraform.io/juju/juju diagnostic_detail="Unable to create application, got error: charm "ch:amd64/focal/traefik-k8s-164" already exists" diagnostic_severity=ERROR @<email address hidden>/tfprotov6/internal/diag/diagnostics.go:58 @module=sdk.proto timestamp=2024-04-03T08:07:59.148Z

This is intermittent and happens rarely but seems like there is a race in Juju.

terraform provider version used: 0.11.0
juju version used: 3.4/stable (3.4.1 at the time this bug is observed)

summary: - unable to deploy two applications of the same charm simultaneously
+ Unable to deploy two applications of the same charm simultaneously
Changed in juju:
assignee: nobody → Heather Lanigan (hmlanigan)
importance: Undecided → Medium
Changed in juju:
status: New → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.