Infrastructure as Code: Composition and Visualization (Terraform)

Published:

  • Duration: July 2022 to December 2022
  • Location: Oracle Labs Zurich

This project includes two main parts: composition and visualization.

Motivation (1)

Given one Terraform template for each application pattern in OCI Modern App Development, we try to design a solution to generate Terraform templates for combinations of patterns. However, certain resources like Database should be shared among different pattern templates of the same application template.

Overview (1)

Designed a solution using naming convention, modularization and code generation. Developed pattern templates into modules and create a module for shared resources. Also built a tool to “inline” Terraform modules for customization.

Related Techniques (1)

  • Terraform: modules
  • Go: Terraform Code Generation

Motivation (2)

We try to improve the Terraform visualization while we found certain limitations at Terraform core runtime.

Overview (2)

Developed a Terraform runtime patch (in Go) to resolve the issue of granular resource relationship tracking at plan phase. Related GitHub Issue.

Developed a lightweight VSCode plugin to show the improved visualization result. Due to the license and VSCode restrictions, this plugin only used SVG.js and I implemented all of the computations.

Related Techniques (2)

  • Terraform Relationship Tracking at Plan Phase:
    • Go (Terraform Source Code)
  • Lightweight VSCode Visualization Plugin:
    • VSCode Plugin
    • JavaScript
    • SVG.js

Status

Done.