l-with / terraform-provider-mailcow

Terraform Provider for Mailcow
18 stars 2 forks source link

Mailbox attributes #76

Open guyguy333 opened 6 months ago

guyguy333 commented 6 months ago

Hi,

Thanks for your provider, it looks great. Do you think it would be possible to add missing Mailbox attributes like "Tags" and what is equivalent to Allow to send as in Mailbox UI edit form.

End plan is to be able to build an SMTP only Mailbox with your provider limited to send from its own email and an alias. I guess it also need #75

Thanks

l-with commented 6 months ago

Thank you for the suggestion. Unfortunately, the implementation of the mailcow API does not meet the requirements of a terraform provider in some places (create (and get an id), read (by id the same attributes), update (by id), delete (by id)). By now I know that tags will not work, s. https://registry.terraform.io/providers/l-with/mailcow/latest/docs#to-change . For the you other suggestions detailed investigation of the api is needed. This will take some time.

guyguy333 commented 6 months ago

Thanks @l-with for considering it and I understand the issue with tags. Indeed, API behaviour is odd.

For "Allow to send as" feature, field name is sender_acl : https://github.com/mailcow/mailcow-dockerized/blob/deb6f0babc5017a2d140d971a8dbab289e5f3072/data/web/api/openapi.yaml#L3377 and can be set with add / edit / get mailbox API

l-with commented 6 months ago

Thank for the analysis. Sorry, I cannot find the possibility to set sender_acl by the add mailbox api, only for edit. I also like to mention that the open api "specification" of mailcow sometimes does not match the real api. (I started implementing the go API through the go generator for open api and unfortunately had to cancel that.) Please have a look at https://github.com/mailcow/mailcow-dockerized/blob/deb6f0babc5017a2d140d971a8dbab289e5f3072/data/web/inc/functions.mailbox.inc.php#L1001 That is the php code implementing the API. I am sorry, but the API of mailcow is limiting the possibilities for the terraform provider.

l-with commented 6 months ago

If you like to set the tags and sender_acl with terraform there is a workaround: you can use the terraform provider http and embed your needs into a terraform module.

guyguy333 commented 6 months ago

Thanks for investigation, I reported all API issues to mailcow project (linked issue).

l-with commented 6 months ago

@guyguy333 fyi, https://github.com/mailcow/mailcow-dockerized/pull/4693