This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Infrastructure as Code

Packer, Cloud Init, Terraform and Ansible.

There are various configurations and applications required to build, deploy, and manage infrastructure. Carbon leverages reliable and trusted leaders in this space. We didn’t want to re-invent the wheel or force you to learn something only applicable to the offensive security domain. This makes customizing Carbon as simple as reading the documentation of the application being used.

1 - Projects

Where project infrastructure begins

projects go here.

2 - Ansible

Playbooks and roles.

Ansible is not used by default. There are plans to leverage this in the future.

3 - Carbon

Simple scripts to glue things together

While other applications are doing the heavy lifting. These scripts make the installation process a little simpler.

4 - Cloud Init

Automate image configurations

WIP

5 - Packer Image Building

Using packer to generate images

Packer is used to build images for use in Terraform.

Installation

MacOS

We can install packer using Hashicorp’s Brew Tap.

brew tap hashicorp/tap
brew install hashicorp/tap/packer

5.1 - Ubuntu 24.04 Packer Config

Default build image

Ubuntu 24.04 is the default build for Carbon. It is based on a minimal server installation. This means you only install what you need to operate. Image customization will be facilitated through Cloud Init. This should make building and testing new configurations easy.

5.1.1 -

Usage

VirtualBox

Building with VirtualBox

packer build  .

Testing with VirtualBox

A simple script has been provided to create a new VirtualBox machine with the newly created disk image.

scripts/test-carbon-ubuntu.sh

6 - Terraform

Using Terraform

Terraform is used to deploy our infrastructure

Prerequisites

In order to properly use Terraform, you’ll need access to our AWS account.

Installation

MacOS

We can install terraform using Hashicorp’s Brew Tap.

brew tap hashicorp/tap
brew install hashicorp/tap/terraform

6.1 - Modules

Using Terraform

Terraform modules are used to make easily reusable infrastructure

6.1.1 - Remote State Module

A simple module to provision an s3 bucket for remote state.

This module should be used to bootstrap an AWS environment. It contains minimal configurations to enable the rest of Terraform to use an S3 bucket as its backend.