Installs Terraform with DuploCloud-specific helper functions for multi-cloud state management
"features": {
"ghcr.io/duplocloud/devcontainers/terraform:1": {}
}| Options Id | Description | Type | Default Value |
|---|
This feature installs DuploCloud Terraform helpers that simplify working with Terraform in DuploCloud environments.
After installation, you can use either:
tf- DuploCloud-enhanced Terraform wrapper with automatic configurationterraform- Standard Terraform CLI
The tf command is a wrapper around Terraform that provides automatic DuploCloud integration:
# Use tf instead of terraform for DuploCloud-aware operations
tf init
tf plan
tf apply
tf destroy
# Switch workspace interactively with fzf
tf ctx
# All standard terraform commands still work
tf validate
tf state listAutomatic Variable File Detection:
- Automatically finds and applies the correct
.tfvarsfile based on workspace - Searches for
config/{workspace}/{module}.tfvarsin the project hierarchy - Supports both
.tfvarsand.tfvars.jsonformats
DuploCloud Token Integration:
- Exports
duplo_tokenandduplo_hostenvironment variables - Integrates with
duploctlfor authentication
Multi-Cloud Backend Configuration:
- Automatically configures Terraform backend for AWS, GCP, or Azure
- Detects cloud provider from DuploCloud portal settings
- Sets up state locking and remote state storage
Interactive Workspace Selection:
- Use
tf ctxto interactively select workspace using fzf - Creates new workspaces on-the-fly if they don't exist
TF_WORKSPACE_DIR- Override the default config directory search pathDUPLO_TF_BUCKET- Override the default Terraform state bucket nameDUPLO_TOKEN- DuploCloud API token (set automatically by duploctl)DUPLO_HOST- DuploCloud portal URL (set automatically by duploctl)
Basic workflow:
# Initialize with DuploCloud backend
tf init
# Select workspace
tf ctx
# Plan with automatic tfvars
tf plan
# Apply changes
tf applyWorking with modules:
# Use with -chdir for module-specific operations
tf -chdir=modules/vpc plan
tf -chdir=modules/vpc applyCustom workspace directory:
export TF_WORKSPACE_DIR=/path/to/config
tf planThe feature installs tf.sh in two locations:
/usr/local/bin/tf- Executable wrapper (use astfcommand)/usr/local/share/duplocloud/tf.sh- Sourceable shell script (for functions)
Both files are sourced in shell rc files (.bashrc, .zshrc, /etc/bash.bashrc) to make the helper functions available in interactive shells.
- Terraform Devcontainer Feature - Official Terraform feature for devcontainers
- Duplocloud Docs for Provider - Describes the DuploCloud Terraform methodology when using our provider.
Note: This file was auto-generated from the devcontainer-feature.json. Add additional notes to a NOTES.md.