Error in creating models using juju terraform provider

Bug #2054553 reported by Hemanth Nakkina
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
High
Heather Lanigan

Bug Description

Sunbeam uses the following terraform plan [1] that creates a juju model on k8s cloud [2]

Creation of model failed with following error on terraform provider side:

```
juju_model.sunbeam: Creating...

Error: Client Error

  with juju_model.sunbeam,
  on main.tf line 38, in resource "juju_model" "sunbeam":
  38: resource "juju_model" "sunbeam" {

Unable to create model, got error: interface conversion: interface {} is nil,
not string

Error configuring cloud
```

Error logs on controller:
```
92d2df2d-6798-4712-816a-ee4bbbdb0cad: machine-0 2024-02-21 09:30:47 CRITICAL juju.rpc server.go:557 panic running request {MethodCaller:0xc000f24a80 transformErrors:0x3a759a0 hdr:{RequestId:2 Request:{Type:ModelManager Version:9 Id: Action:CreateModel} Error: ErrorCode: ErrorInfo:map[] Version:1}} with arg {Name:openstack OwnerTag:user-sunbeam1.lxd Config:map[workload-storage:microk8s-hostpath] CloudTag:cloud-sunbeam-microk8s CloudRegion:localhost CloudCredentialTag:cloudcred-sunbeam-microk8s_sunbeam1.lxd_sunbeam-microk8s-creds}: interface conversion: interface {} is nil, not string
goroutine 42448 [running]:
runtime/debug.Stack()
 /snap/go/10455/src/runtime/debug/stack.go:24 +0x5e
github.com/juju/juju/rpc.(*Conn).runRequest.func1()
 /build/snapcraft-juju-648c11e0c4a42ad58276cc9a6cf111a2/parts/jujud/build/rpc/server.go:558 +0x6e
panic({0x6857b80?, 0xc000439dd0?})
 /snap/go/10455/src/runtime/panic.go:914 +0x21f
github.com/juju/juju/controller/modelmanager.ModelConfigCreator.NewModelConfig({0x787efa0, 0xc0033ca2a0}, {{0xc0033e7020, 0xa}, {0xc0033e7010, 0x10}, {0xc00398ff20, 0x9}, {0xc001f389a0, 0x1b}, ...}, ...)
 /build/snapcraft-juju-648c11e0c4a42ad58276cc9a6cf111a2/parts/jujud/build/controller/modelmanager/createmodel.go:88 +0x552
github.com/juju/juju/apiserver/facades/client/modelmanager.(*ModelManagerAPI).newModelConfig(0xc001a0b130, {{0xc0033e7020, 0xa}, {0xc0033e7010, 0x10}, {0xc00398ff20, 0x9}, {0xc001f389a0, 0x1b}, {0x0, ...}, ...}, ...)
 /build/snapcraft-juju-648c11e0c4a42ad58276cc9a6cf111a2/parts/jujud/build/apiserver/facades/client/modelmanager/modelmanager.go:184 +0x359
github.com/juju/juju/apiserver/facades/client/modelmanager.(*ModelManagerAPI).newCAASModel(_, {{0xc0033e7020, 0xa}, {0xc0033e7010, 0x10}, {0xc00398ff20, 0x9}, {0xc001f389a0, 0x1b}, {0x0, ...}, ...}, ...)
 /build/snapcraft-juju-648c11e0c4a42ad58276cc9a6cf111a2/parts/jujud/build/apiserver/facades/client/modelmanager/modelmanager.go:375 +0x10b
github.com/juju/juju/apiserver/facades/client/modelmanager.(*ModelManagerAPI).CreateModel(_, {{0xc00398ff00, 0x9}, {0xc00081bc50, 0x11}, 0xc000f24b10, {0xc00081bc80, 0x16}, {0xc00398ff20, 0x9}, ...})
 /build/snapcraft-juju-648c11e0c4a42ad58276cc9a6cf111a2/parts/jujud/build/apiserver/facades/client/modelmanager/modelmanager.go:342 +0x1630
reflect.Value.call({0x72ffaa0?, 0xc001a0b130?, 0x411c25?}, {0x75aad0e, 0x4}, {0xc002e4f110, 0x1, 0xac12f3?})
 /snap/go/10455/src/reflect/value.go:596 +0xce7
reflect.Value.Call({0x72ffaa0?, 0xc001a0b130?, 0x700cc60?}, {0xc002e4f110?, 0x0?, 0x10?})
 /snap/go/10455/src/reflect/value.go:380 +0xb9
github.com/juju/rpcreflect.newMethod.func8({0x80f14f8, 0xc0004eedc0}, {0x72ffaa0?, 0xc001a0b130?, 0x5bd185?}, {0x700cc60?, 0xc002afefc0?, 0xc000117040?})
 /build/snapcraft-juju-648c11e0c4a42ad58276cc9a6cf111a2/parts/jujud/build/vendor/github.com/juju/rpcreflect/type.go:365 +0xc8
github.com/juju/juju/apiserver.(*srvCaller).Call(0xc000f24a80, {0x80f14f8, 0xc0004eedc0}, {0x0?, 0xc003d0ee20?}, {0x700cc60?, 0xc002afefc0?, 0x120?})
 /build/snapcraft-juju-648c11e0c4a42ad58276cc9a6cf111a2/parts/jujud/build/apiserver/root.go:191 +0x9a
github.com/juju/juju/rpc.(*Conn).runRequest(0xc002bc94a0, {{0x80da370, 0xc000f24a80}, 0x7880370, {0x2, {{0xc00398fed0, 0xc}, 0x9, {0x0, 0x0}, ...}, ...}}, ...)
 /build/snapcraft-juju-648c11e0c4a42ad58276cc9a6cf111a2/parts/jujud/build/rpc/server.go:571 +0x1b2
created by github.com/juju/juju/rpc.(*Conn).handleRequest in goroutine 42439
 /build/snapcraft-juju-648c11e0c4a42ad58276cc9a6cf111a2/parts/jujud/build/rpc/server.go:475 +0x63d
```

The same plan worked with juju 3.2/stable.
Problem with juju 3.3/stable.

Note in both the cases, the juju is bootstrapped on manual provider.

[1] https://github.com/canonical/sunbeam-terraform
[2] https://github.com/canonical/sunbeam-terraform/blob/main/main.tf#L38-L48

Changed in juju:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Jack Shaw (jack-shaw)
milestone: none → 3.3.3
Revision history for this message
Hemanth Nakkina (hemanth-n) wrote :

Just a note, creating model using juju cli worked
juju add-model openstack sunbeam-microk8s/localhost --credential sunbeam-microk8s-creds --config workload-storage=microk8s-hostpath

Revision history for this message
Heather Lanigan (hmlanigan) wrote :
Changed in juju:
milestone: 3.3.3 → 3.3.2
assignee: Jack Shaw (jack-shaw) → Heather Lanigan (hmlanigan)
status: Triaged → Fix Committed
Revision history for this message
Heather Lanigan (hmlanigan) wrote :

it is also fixed in juju 3.4.0

Ian Booth (wallyworld)
Changed in juju:
milestone: 3.3.2 → 3.3.3
Changed in juju:
status: Fix Committed → Fix Released
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.