Hi Idelix, glad to hear you managed to solve your issue.
I think this is something we can improve on as this is something we have stumbled across while using terraform internally as well. I have created an issue here which you can use to track the progress.
Please let us know if there is anything else we can help with!