Get started with Juju

Hi @tmihoc

In the terraform juju tutorial while trying to run terraform plan, got error “Reference to undeclared resource”

I checked and found some issue with the example in the tutorial’s main.tf file.

while defining the “postgresql-k8s” juju_application resource (lines 21 - 37 ) , the model “welcome-k8s” was referenced (line 23) instead of the “chat” model that was created earlier in the same tf file (lines 8- 10).

I changed line 23 to “model = juju_model.chat.name” and the terraform plan was successful.

My changes below

 21 resource "juju_application" "postgresql-k8s" {
 22 
 23   model = juju_model.welcome-k8s.name (removed)
 24   model = juju_model.chat.name (added)
 25 
 26   charm {
 27     name = "postgresql-k8s"
 28     channel  = "14/stable"
 29   }
 30 
 31   trust = true
 32 
 33   config = {
 34     profile = "testing"
 35    }
 36 
 37 }

The originally created model “chat” should be referenced when creating the resource “juju_application” “postgresql-k8s” or the model “welcome-k8s.name” should be created first before being referenced.

Thank you!

1 Like

Fixed and added your name to the list of Contributors on the bottom of the doc – thanks!

Hello @tmihoc, I’ve spotted an issue. It looks like the line:

the host IP address of the PostgreSQL unit: retrieve it from juju status or juju show-unit (in the sample outputs above, 10.1.170.142);

and the subsequent example psql --host=10.1.170.142 commands refer to an old revision of the tutorial. IP 10.1.170.142 doesn’t appear in the sample outputs and should likely be replaced with 10.1.32.152 to be consistent.

Thanks!