How to use OCI Marketplace image with Terraform?

Recently Mattia has presented the blog post about using OCI CLI to retrieve OCI Marketplace image. It has inspired me to explore this topic, but with Terraform usage. The goal was very simple Рdeploy RocketChat image (from OCI Marketplace) as a single VM in the extremely simplified cloud infrastructure, very similar to my first lesson of OCI + Terraform tutorial. I have invested 3 hours and here is the outcome of this work. I hope you will find it tasty, despite the fact it is a really tricky setup, with many dependent resources and data sources.

Bon Appetit,

Martin, The Cook.