Skip to content

Latest commit

 

History

History
106 lines (70 loc) · 4.11 KB

set-up-infrastructure-tools.md

File metadata and controls

106 lines (70 loc) · 4.11 KB

Set up infrastructure developer tools

If you are contributing to infrastructure, you will need to complete these setup steps.

Prerequisites

Install Terraform

Terraform is an infrastructure as code (IaC) tool that allows you to build, change, and version infrastructure safely and efficiently. This includes both low-level components like compute instances, storage, and networking, as well as high-level components like DNS entries and SaaS features.

You may need different versions of Terraform since different projects may require different versions of Terraform. The best way to manage Terraform versions is with Terraform Version Manager.

To install via Homebrew

brew install tfenv

Then install the version of Terraform you need.

tfenv install 1.8.0

You may need to set the Terraform version.

tfenv use 1.8.0

Install AWS CLI

The AWS Command Line Interface (AWS CLI) is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts. Install the AWS command line tool by following the instructions found here:

Install Go

The Go programming language is required to run Terratest, the unit test framework for Terraform.

Install GitHub CLI

The GitHub CLI is useful for automating certain operations for GitHub such as with GitHub actions. This is needed to run check-github-actions-auth

brew install gh

Install linters

We have several optional utilities for running infrastructure linters locally. These are run as part of the CI pipeline, therefore, it is often simpler to test them locally first.

brew install shellcheck
brew install actionlint
make infra-lint

AWS Authentication

In order for Terraform to authenticate with your accounts you will need to configure your AWS credentials using the AWS CLI or manually create your config and credentials file. If you need to manage multiple credentials or create named profiles for use with different environments you can add the --profile option.

There are multiple ways to authenticate, but we recommend creating a separate profile for your project in your AWS credentials file and setting your local environment variable AWS_PROFILE to the profile name. We recommend using direnv to manage local environment variables. Credentials should be located in ~/.aws/credentials (Linux & Mac) or %USERPROFILE%.aws\credentials (Windows)

Examples

$ aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-east-2
Default output format [None]: json

Using the above command will create a [default] profile.

$ aws configure --profile dev
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-east-2
Default output format [None]: json

Using the above command will create a [dev] profile.

Once you're done, verify access by running the following command to print out information about the AWS IAM user you authenticated as.

aws sts get-caller-identity

References