My idea on writing this guide was to provide overview what components you need when you create a database in Oracle Cloud Infrastructure. Even thought there are several components once you do it few times you get an understanding what you need and it comes a breeze to create these.

Most issues I have seen are with security lists. Usually you are just missing port which would be allowed and this is blocking your access. Since cloud gives you possibilities to modify yourself it also brings responsibilities! Don’t go opening everything to outside world but learn to restrict access on only what is required. This way you create a habit which follows you on new projects.

The components we created were:

Creating the resources with OCI Resource Manager

I’ve pasted on each post the code block which was required to give understanding what you should do but to create complete stack there are few options now available. Either setup Terraform on your local machine and run the scripts or use the new OCI Resource Manager which was released last week.

I decided to publish the scripts as a stack to Resource Manager with instructions what you need to modify if you want to run them outside it. With Resource Manager you create a “Stack” which has all the components what the terraform scripts create. You will need to upload these files under a single zip file to the Resource Manager.

Creating a new stack

Once you have uploaded the zipfile and created the stack you need to set following environment variables from the left side menu “Resources” click Variables and Edit Variables :

  • region (the name of region you are operating for example eu-frankfurt-1)
  • tenancy_ocid (your tenancy’s OCID – from left side menu Administration -> Tenancy Details)
  • ssh_public_key (ssh key to be used – you can find create instructions from here)

If you use this stack for other than demo purposes I would also think on some key management and not paste key as a variable which can be seen in the variables section. Or at least make sure nobody else can access this stack in the Console.

After this you can run Terrafrom Plan, Apply and Destroy when you access the stack and click Terraform Actions.

Overview of stack and what you see when creating or deleting resources. Type defines the Terraform action.

At the moment you won’t see what resources the stack created apart from going inside the Job and then reviewing the log. Would be great addition if you could see them straight from the console. Or you can of course browse to specific resource in the console and view it from there as well.

Files

I’ve added the files and instructions on my github page. Everything can be downloaded from here:

https://github.com/svilmune/tf-database-demo-resource-mgr

Remember that OCI Resource Manager expects that the files are uploaded inside .zip so easiest way is to download files via zip and upload them when creating the stack.

This concludes this series, I really hope that even though I only went through basics it gives you understanding how easy it is to use Terraform in OCI to create resources or stack.

One thought on “Series – Get your database running with Terraform part 10: Summary”

Leave a Reply

Your email address will not be published.