A full data centre in Oracle Cloud, from one Terraform run
When the cloud role became vacant I took it, learned Terraform, and wrote the automation that builds a complete data centre in OCI. Change the region variable and the whole environment deploys in one go: network, security, compute and the IPSec link home.
- Cloud
- Oracle Cloud Infrastructure
- Scope
- Network, security, compute, site-to-site VPN
- Regions
- Regions: withheld under NDA
- Data volumes migrated
- Data volumes migrated: withheld under NDA
- Client environments
- Client environments: withheld under NDA
Employer work under NDA. Architecture and reasoning are described; client names, volumes and internals are withheld.
Context
The company was moving data-centre workloads into OCI, and the person leading cloud infrastructure left. The work needed an owner, and I took it.
The problem
Without automation, each new environment means building the same network, security and VPN by hand, and every manual build is a chance for one security rule to come out slightly different from the last.
What made it hard
- Every environment needs the same network and security layout, with only the region and addressing changing.
- Every environment needed a working site-to-site IPSec tunnel back to an existing on-premise network.
- I was learning Terraform while writing it.
Options considered
Keep building environments by hand from a runbook
Rejected. A runbook describes what someone meant to do, not what exists.
One Terraform configuration per environment
Rejected. Copies drift apart within a month and fixes have to be made several times.
ChosenShared modules, with the region as an input
A new environment is the same code with a different value, so they cannot quietly diverge.
The decision
Modules for network, security, compute and connectivity, composed per environment, with the region as a variable. Terraform state is the record of what exists. The console is for looking, not for changing things.
My part
I own the Terraform: the module design, the code and the rollout. The wider migrations were team efforts, and I supported the data moves themselves over WAN with Raysync inside cutover windows.
Stack
- Terraform
- OCI
- VCN
- DRG
- IPSec VPN
- NSGs
- Security Lists
- Raysync
Result
- A complete environment stands up from one apply with a different region value.
- Security rules are identical across environments by construction, because they come from the same code.
- Not recorded: build time before and after. The manual builds were never timed, so no speed-up figure is claimed.
What I would change
If I started again I would agree the module boundaries with the people who will run them before writing any code. Modules are easy to design and hard to reshape once environments depend on them.