Terraform
Progress checklist
All infrastructure in this walkthrough - VPC, subnets, CAPACITY-PROVIDER
Lambda Capacity Provider — an EC2-backed compute resource pool (subnets, security groups, operator role) that Lambda Managed Instances functions run on instead of shared Lambda infrastructure. , LAMBDA
AWS Lambda — a serverless compute service that runs code in response to events without provisioning servers. functions, IAM
Identity and Access Management — the AWS service that controls permissions and roles for all resources. roles - is created and destroyed with Terraform
Terraform — the infrastructure-as-code tool used to create and manage all AWS resources in this walkthrough. . Nothing is created manually in the console (except one-off checks). Using Terraform means:
- Every change is reviewed before it is applied
- The full environment can be torn down with one command (
terraform destroy) - State tracks what has been created so incremental updates are safe
This site expects the HashiCorp AWS provider ~> 6.0 so resources such as aws_lambda_capacity_provider and capacity_provider_config on aws_lambda_function are available. The Terraform code lives in a separate repository (terraform-aws-lambda-managed-instance). You will clone it in the Git step.
-
Install Terraform. Required
Use Terraform 1.5 or later. The walkthrough uses features from 1.5+.
Install via Homebrew (HashiCorp tap) brew tap hashicorp/tapbrew install hashicorp/tap/terraformTo upgrade later:
Terminal window brew upgrade hashicorp/tap/terraformAdd the HashiCorp APT repository and install. If needed, install dependencies first:
curl,gnupg,software-properties-common.Add HashiCorp repo (Debian/Ubuntu) sudo apt updatesudo apt install -y curl gnupg software-properties-commoncurl -fsSL https://apt.releases.hashicorp.com/gpg \| sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpgecho "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \https://apt.releases.hashicorp.com $(lsb_release -cs) main" \| sudo tee /etc/apt/sources.list.d/hashicorp.listsudo apt updatesudo apt install -y terraformAdd the HashiCorp repository and install. If needed, install
curlandgnupg2first (for examplesudo dnf install -y curl gnupg2).Add HashiCorp repo (RHEL/Fedora) sudo dnf config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.reposudo dnf install -y terraform -
Verify the installation.
Terminal window terraform versionExpected output:
Terraform v1.x.xon linux_amd64The version must be 1.5 or higher. If you have an older version installed via a different method, uninstall it first.
-
Create a workspace directory.
Create a dedicated directory where you will clone and run Terraform. This keeps the walkthrough files separate from other projects.
Terminal window mkdir -p ~/workspacecd ~/workspaceYou will clone the Terraform repo into this directory in the Git step.
-
Understand the state setup.
Next step
Section titled “Next step”Continue to Git to install Git, set your identity, and clone the Terraform repo.