Effective first, then efficient and then elegant …Peter Laurie – mate and mentor.
I’ve been doing some collaboration with @stantanev around a project and part of the contribution that I was doing was getting some stuff setup / configured and deployed into Oracle Cloud Infrastructure. This wasn’t a standard copy-and-paste scenario. I was building it up as we went. And then I was done … But it felt unfinished because I didn’t want to just leave it there. I wanted to share what I have without me getting sucked into other work standing up new environments (noting in the last article – I am lazy). And in the first instance, I only had dev (where I was working) and I needed to create a new one so people can start experiencing what we delivered (quickly).
What I invested in was using Oracle Resource Manager “ORM” to help me take what I built in Oracle Cloud Infrastructure and turn that into something that I could hand-over. Let’s have a look.
Before, I get started on ORM, lets have a look at the OCI resources that I want to include. Here’s a quick snapshot from the Tenancy Explorer where I can have a look at what is provisioned. At the moment, I’ve got these four resources that make up the project (an autonomous database, a compute node, a virtual cloud network for the compute and then an object storage bucket).
From there, I head to ORM under “Solutions and Platforms” in the menu to create a Stack (which is the same as a Terraform root module).
By creating a stack, there are different options here in terms of the source of the stack however in this scenario, I’m selecting the option of “Existing Compartment” so I can introspect that compartment to create a stack. There’s a couple of additional options as to the region and compartment and maybe a set or subset of OCI resources to include in the stack. For what I did, I just said all.
Once that kicks off, a work request starts the magic and works behind the scenes. There is no need to shut stuff down – it just happens.
Eventually, the stack is created and formed. From here, there’s a few things to inspect.
I’ve downloaded the Terraform configuration which comes in a zip file. This is a collection of the modules in HCL format with different files for the different resources. There’s also a file for variables.
We are on the way to get this fully automated. As I said … on our way … there’s a few things that still needed to be done to have it fully automated. Here’s a couple of things that I experienced.
- The resources are for infrastructure and doesn’t include any of the application configuration. For example the database schemas, the APIs, the docker configuration and the static content were not included. Also, sensitive data like passwords are excluded. These need to be added back in.
- The resources are well-defined. What I mean by that is typically when we are doing configurations (from scratch) we tend to only include configuration that is required and not define the defaults. Because this is introspected, then defaults and optionally configurations are included.
- The resources are specific. Some of the variables are specific to your compartment and region. ie. the source-image-id for the VM is unique for the version of the image as well as the region that it was deployed hence keep an eye out for these as well.
After a little bit of work to shape it, I was able to create a well-formed ORM Terraform project that I can know fully automate with the infrastructure, application and enough flexibility with the different variables that its easy enough to share with others.
You can check out the end result in a few different places. If you are interested in the final outcome of what I did either:
- check out the github repository that I’ve published it to https://github.com/jlowe000/oci-arcade-tf
- check out the previous blog around using Oracle Resource Manager – https://redthunder.blog/2021/02/12/automating-with-oci-oracle-resource-manager
Maybe this might give you a glimpse of what the project is all about.
If you need an Always Free Tier environment to try this out – head to the following link and sign-up. https://www.oracle.com/au/cloud/free/
To find more information about Oracle Resource Manager, have a look at the documentation – https://docs.oracle.com/en-us/iaas/Content/ResourceManager/Concepts/landing.htm
Have fun learning.
One thought on “Turning a Compartment into a ORM Stack”