juju / terraform-provider-juju

A Terraform provider for Juju
Apache License 2.0
19 stars 37 forks source link

Add ability to manage Juju storages #198

Open marcoppenheimer opened 1 year ago

marcoppenheimer commented 1 year ago

Please close if dupe, or if it's possible and I missed it.

Issue

I wasn't able to find a way of specifying Juju storage constraints - Juju Storage constraint (directive)

Request

I would like to be able to define application level storages from within the juju_application resource, requirements of meeting the functionality outlined in the above linked OLM documentation

juanmanuel-tirado commented 1 year ago

To make this feature complete we need to add a storage_resource entity to manage the storage on the juju side. I add this to the wishlist. Thanks :)

gtato commented 11 months ago

Hi @juanmanuel-tirado, any idea when this feature could be implemented? We are trying to convert some of our bundles into terraform, but this is quite a blocking issue.

juanmanuel-tirado commented 11 months ago

Hi @gtato. I'm no longer working on this project so I cannot say. @cderici may have more details.

hmlanigan commented 11 months ago

@gtato The need for this feature is on our radar, but unlikely to be implemented in the next six months due to lack of availability on the team. I can work with you if you wish to provide a PR to implement it.

gtato commented 11 months ago

I will discuss it with my manager, but I would say we are more or less in the same situation :smiling_face_with_tear:

dparv commented 6 months ago

+1 for this, it's getting urgent as COS needs proper storage configuration when deploying on k8s, otherwise it will remain with the default of 1G which is unusable

hemanthnakkina commented 5 months ago

+1 this is requirement for sunbeam too to manage storage configuration

Thanhphan1147 commented 4 months ago

+1, I noticed that we're building the deploy args here: https://github.com/juju/terraform-provider-juju/blob/4ba9b576aa37d30ec6273a66dddcb88873186db1/internal/juju/applications.go#L499-L509

And after a quick look at the struct that juju used to deploy the application, there is actually a storage field https://github.com/juju/juju/blob/aeec03cb1ccd35066742a573f3a227969e4a5836/api/client/application/client.go#L84-L85

Could we simply add an attribute in the resource_juju_application to specify a storage size and during destroy we can set the destroyStorage option to also destroy the storage?

https://github.com/juju/juju/blob/aeec03cb1ccd35066742a573f3a227969e4a5836/api/client/application/client.go#L472-L474

Are there complications that prevent this to work for both machine and k8s charms?

AmberCharitos commented 4 months ago

+1 also in the same situation, needed for Superset.

Thanhphan1147 commented 4 months ago

After looking into the code I've created a working POC adding a storage attribute to resource_juju_application in my fork here: https://github.com/Thanhphan1147/terraform-provider-juju/commit/9e8e8fddb23dbc2210836e8da5469f39e6ff7f16,

A bit more work will need to be done though to add logic during refresh and update, as well as decide on whether the attribute will be a map of strings, which then need to be parsed (similar to constraints) or a map of nested attributes, etc...

@cderici / @hmlanigan If it's ok for you let's discuss on this to see if I can help out in anyway!