Environment:A5c ai Babysitter Terraform CLI
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Deployment |
| Last Updated | 2026-10-23 00:00 GMT |
Overview
Terraform CLI environment for provisioning cloud infrastructure as part of the Kradle deployment pipeline.
Description
This environment provides the Terraform CLI required by the Kradle installer to provision cloud infrastructure resources. The installer renders Terraform configuration files from the deployment plan and executes `terraform init` followed by `terraform apply -auto-approve` to create the infrastructure. The Terraform configuration is generated programmatically and written to a working directory before execution.
Usage
Use this environment for the environment installation workflow that provisions cloud infrastructure. It is the mandatory prerequisite for the `install_environment` implementation when `autoApplyTerraform` is not disabled.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux / macOS | CI runners |
| Hardware | 1 CPU core, 2GB RAM | Sufficient for apply operations |
| Disk | 5GB SSD | For Terraform state and provider plugins |
| Network | Cloud provider API access | Required for resource provisioning |
Dependencies
System Packages
- `terraform` >= 1.0.0
- Cloud provider credentials (AWS/GCP/Azure)
Terraform Providers
- Provider plugins downloaded automatically during `terraform init`
Credentials
The following credentials are required depending on the target cloud:
- `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY`: For AWS provisioning
- `GOOGLE_APPLICATION_CREDENTIALS`: For GCP provisioning
- `ARM_CLIENT_ID` / `ARM_CLIENT_SECRET` / `ARM_SUBSCRIPTION_ID` / `ARM_TENANT_ID`: For Azure provisioning
Quick Install
# Install Terraform (using tfenv or direct download)
tfenv install latest
tfenv use latest
# Verify installation
terraform --version
# The installer will run terraform init + apply automatically
node packages/kradle/installer/dist/cli.js install --env staging
Code Evidence
Terraform existence check and execution from `packages/kradle/installer/src/sdk/deploy.ts:77-83`:
async function applyTerraform(plan: DeploymentPlan, terraformDirectory: string): Promise<readonly CommandExecution[]> {
if (!(await commandExists("terraform"))) {
throw new Error("terraform is not installed or not available on PATH.");
}
const executions: CommandExecution[] = [];
executions.push(await execCommand("terraform", ["init", "-input=false"], { cwd: terraformDirectory }));
executions.push(await execCommand("terraform", ["apply", "-auto-approve", "-input=false"], { cwd: terraformDirectory }));
return executions;
}
Terraform rendering from `packages/kradle/installer/src/sdk/deploy.ts:164-165`:
const terraform = renderTerraform(plan);
// ...
await writeFiles(terraformDirectory, terraform.files);
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `terraform is not installed or not available on PATH` | Terraform CLI not installed | Install Terraform and ensure it's on PATH |
| `Error: Failed to select provider` | Provider plugin download failed | Run `terraform init` manually to diagnose; check network access |
| `Error: Provider configuration not present` | Cloud credentials missing or invalid | Set appropriate cloud provider environment variables |
Compatibility Notes
- Terraform < 1.0: Not supported; the installer assumes modern Terraform CLI behavior.
- OpenTofu: May work as a drop-in replacement but is not officially tested.
- Terragrunt: Not used; the installer generates raw Terraform configuration.