Deployment of network resources and compute in the OCI in a 100% automated way using Github, Terraform Cloud and Terraform IaC.
Infrastructure as Code + pipeline
Not so long ago, I had a project for a luxury furniture shop company that wanted a website hosted on a web server. Naturally, most such companies rushed to GoDaddy for their solutions, but I found a more professional alternative as they approached me.
Free?
The joke with Oracle Cloud is that certain services, such as smaller virtual servers, can be operated for free. And there’s nothing better than free things. Of course, one must select the region based on the intended market where one wishes to make the website accessible.
For my part, I just built the concept plan in the us-phoenix-1 region (where Oracle Cloud has the most available services — I’d note here that after AWS, Oracle’s regional philosophy and the need for separate subscriptions/tenancy for everything is a bit odd, but you can get used to it).
In my case, AD-3 is always free-eligible (see the section of the code following us-phoenix-1:
).
variable "ad_region_mapping" {
type = map(string)
default = {
us-phoenix-1 = 3
}
}
Let it be IaC or Infrastructure as a Code if we’re building something. Let’s not go into the Terraform story now, but I still need to convince myself to switch to OpenTofu. Anyway, the corporate world will stick with Terraform.
Infrastructure as Code + pipeline
You can write Terraform code for Oracle Cloud, too, and while we’re at it, why not put the whole thing on GitHub and trigger it so that, thanks to Terraform Cloud, it also sets up the entire system on Oracle Cloud? This is the actual pipeline!
I manually copied over the website, of course, because the goal here wasn’t full automation. That will get a pipeline later, but I didn’t deal with the website code since I was focusing on the infrastructure.
In this deployment, I used the main tools:
- Github: code repository
- Terraform Cloud: to run the Terraform code and keep the infrastructure state.
- Terraform IaC: to manage the Terraform code.
- Visual Studio Code
As we’re on the topic of freebies, before you decide which AD to deploy your virtual instance in, it’s good to check which Availability Domain is “Always Free-eligible” in the console. The same goes for the Shape. Of course, the freeness is a joke, as the virtual machine configuration is only suitable for demos, but it’s excellent for that purpose.
I’m glad I’m starting to feel at home in Oracle Cloud. As famous as Oracle is, I believe this knowledge will be rare in the Western market (everyone focuses on AWS, Azure, and Google Cloud) and that this expertise of mine will be valued somewhere.