Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After terraform import the charm channel isn't correctly recognised #95

Closed
mthaddon opened this issue Sep 27, 2022 · 3 comments · Fixed by #98
Closed

After terraform import the charm channel isn't correctly recognised #95

mthaddon opened this issue Sep 27, 2022 · 3 comments · Fixed by #98

Comments

@mthaddon
Copy link

Terraform Version

$ terraform -v
Terraform v1.3.0
on linux_amd64
+ provider registry.terraform.io/juju/juju v0.4.1

Affected Resource(s)

I'm not quite sure, but it affects terraform import of a juju_application resource.

Terraform Configuration Files

resource "juju_application" "redis_cache" {
  name  = "redis-cache2"
  model = juju_model.staging.name

  charm {
    name = "redis-k8s"
    channel = "edge"
  }

  units = 1
}

Debug Output

Here's my juju status output confirming the redis-cache2 application is using the edge channel already:

$ juju status redis-cache2
Model       Controller          Cloud/Region        Version  SLA          Timestamp
stg-events  microk8s-localhost  microk8s/localhost  2.9.34   unsupported  11:27:21+02:00

App           Version  Status  Scale  Charm      Channel  Rev  Address         Exposed  Message
redis-cache2  7.0.4    active      1  redis-k8s  edge      18  10.152.183.133  no       

Unit             Workload  Agent  Address       Ports  Message
redis-cache2/0*  active    idle   10.1.129.145         

I ran the following:

terraform import juju_application.redis_cache stg-events:redis-cache2

This reported a successful output. However, when running terraform plan I see:

  # juju_application.redis_cache will be updated in-place
  ~ resource "juju_application" "redis_cache" {
        id     = "stg-events:redis-cache2"
        name   = "redis-cache2"
        # (4 unchanged attributes hidden)

      ~ charm {
          ~ channel  = "latest/stable" -> "edge"
            name     = "redis-k8s"
            # (2 unchanged attributes hidden)
        }
    }

Panic Output

N/A

Expected Behavior

This should recognise something is deployed with the channel specified in the terraform configs.

Actual Behavior

It says it's going to switch it from the stable channel to the edge channel.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. juju deploy redis-k8s --channel=edge
  2. terraform import (with relevant application name)
  3. Check the output of terraform plan.

Important Factoids

N/A

References

N/A

@mthaddon
Copy link
Author

I've also noticed that charm config isn't imported/recognised. Let me know if I should file a separate issue for this. I confirmed this by applying juju config similar to how it's defined in my terraform plan, and then doing a terraform state rm $juju_application, re-running a terraform import of the same juju application and confirming that terraform plan was still reporting that it would change that config item.

@jnsgruk
Copy link
Member

jnsgruk commented Sep 27, 2022

Thanks Tom - if you could file a separate issue for config that would be useful!

@mthaddon
Copy link
Author

Have created #96.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants