Add aws-cli module for ausbru87 namespace

This commit is contained in:
Austen Bruhn 2025-11-15 17:23:42 -07:00
parent 5564a552ba
commit 75fd523215
7 changed files with 107 additions and 452 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

View File

@ -1,11 +1,33 @@
---
display_name: "Austen Bruhn"
bio: "Software engineer and cloud infrastructure enthusiast"
avatar: "./.images/avatar.png"
github: "ausbru87"
status: "community"
display_name: ausbru87
bio: Brief description of what this namespace provides
github: your-github-username
avatar: ./.images/avatar.svg
linkedin: https://www.linkedin.com/in/your-profile
website: https://your-website.com
status: community
---
# Austen Bruhn
# ausbru87
Software engineer and cloud infrastructure enthusiast, contributing modules to help developers work more efficiently with cloud services.
Brief description of what this namespace provides. Include information about:
- What types of templates/modules you offer
- Your focus areas (e.g., specific cloud providers, technologies)
- Any special features or configurations
## Templates
List your available templates here:
- **template-name**: Brief description
## Modules
List your available modules here:
- **module-name**: Brief description
## Contributing
If you'd like to contribute to this namespace, please [open an issue](https://github.com/coder/registry/issues) or submit a pull request.

View File

@ -1,43 +1,32 @@
---
display_name: AWS CLI
description: Install the AWS Command Line Interface in your workspace
description: Install AWS CLI v2 in your workspace
icon: ../../../../.icons/aws.svg
verified: false
tags: [aws, cli, tools]
tags: [helper, aws, cli]
---
# AWS CLI
Automatically install the [AWS Command Line Interface (CLI)](https://aws.amazon.com/cli/) in a Coder workspace. The AWS CLI is a unified tool to manage AWS services from the command line.
Automatically install the [AWS CLI v2](https://aws.amazon.com/cli/) in your Coder workspace.
```tf
module "aws-cli" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/modules/ausbru87/aws-cli"
source = "registry.coder.com/ausbru87/aws-cli/coder"
version = "1.0.0"
agent_id = coder_agent.example.id
}
```
## Features
- ✅ Supports both x86_64 and ARM64 (aarch64) architectures
- ✅ Automatic architecture detection
- ✅ Install latest version or pin to a specific version
- ✅ Optional GPG signature verification
- ✅ Idempotent - skips installation if already present
- ✅ Supports custom installation directories
## Examples
### Basic Installation (Latest Version)
Install the latest version of AWS CLI:
### Basic Installation
```tf
module "aws-cli" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/modules/ausbru87/aws-cli"
source = "registry.coder.com/ausbru87/aws-cli/coder"
version = "1.0.0"
agent_id = coder_agent.example.id
}
@ -45,118 +34,24 @@ module "aws-cli" {
### Pin to Specific Version
Install a specific version of AWS CLI for consistency across your team:
```tf
module "aws-cli" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/ausbru87/aws-cli/coder"
version = "1.0.0"
agent_id = coder_agent.example.id
install_version = "2.15.0"
}
```
### Custom Log Path
```tf
module "aws-cli" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/modules/ausbru87/aws-cli"
source = "registry.coder.com/ausbru87/aws-cli/coder"
version = "1.0.0"
agent_id = coder_agent.example.id
# Pin to AWS CLI version 2.15.0
aws_cli_version = "2.15.0"
log_path = "/var/log/aws-cli.log"
}
```
Note: Find available versions in the [AWS CLI v2 Changelog](https://github.com/aws/aws-cli/blob/v2/CHANGELOG.rst).
### Custom Installation Directory
Install AWS CLI to a custom directory (useful when you don't have sudo access):
```tf
module "aws-cli" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/modules/ausbru87/aws-cli"
version = "1.0.0"
agent_id = coder_agent.example.id
install_directory = "/home/coder/.local"
}
```
### Verify GPG Signature
Enable GPG signature verification for enhanced security:
```tf
module "aws-cli" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/modules/ausbru87/aws-cli"
version = "1.0.0"
agent_id = coder_agent.example.id
verify_signature = true
}
```
### Specify Architecture
Explicitly set the architecture (usually auto-detected):
```tf
module "aws-cli" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/modules/ausbru87/aws-cli"
version = "1.0.0"
agent_id = coder_agent.example.id
architecture = "aarch64" # or "x86_64"
}
```
## Configuration
After installing AWS CLI, users will need to configure their AWS credentials. This can be done using:
```bash
aws configure
```
Or by setting environment variables:
```bash
export AWS_ACCESS_KEY_ID="your-access-key-id"
export AWS_SECRET_ACCESS_KEY="your-secret-access-key"
export AWS_DEFAULT_REGION="us-east-1"
```
For more information, see the [AWS CLI Configuration Guide](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html).
## Variables
| Name | Description | Default | Required |
| ------------------- | ----------------------------------------------------------------------------------------- | ------------ | -------- |
| `agent_id` | The ID of a Coder agent | - | Yes |
| `aws_cli_version` | The version of AWS CLI to install (leave empty for latest) | `""` | No |
| `install_directory` | The directory to install AWS CLI to | `/usr/local` | No |
| `architecture` | The architecture to install AWS CLI for (`x86_64` or `aarch64`, empty for auto-detection) | `""` | No |
| `verify_signature` | Whether to verify the GPG signature of the downloaded installer | `false` | No |
## Outputs
| Name | Description |
| ----------------- | ----------------------------------------------------------------------------------- |
| `aws_cli_version` | The version of AWS CLI that was installed (or 'latest' if no version was specified) |
## Requirements
- Linux operating system (x86_64 or ARM64)
- `curl` for downloading the installer
- `unzip` for extracting the installer
- `sudo` access (if installing to system directories like `/usr/local`)
- Optional: `gpg` (if using signature verification)
## Supported Platforms
- Amazon Linux 1 & 2
- CentOS
- Fedora
- Ubuntu
- Debian
- Any Linux distribution with glibc, groff, and less
## Notes
- The module is idempotent - if AWS CLI is already installed with the correct version, it will skip the installation
- When no version is specified, the latest version will be installed
- The installer automatically creates a symlink at `/usr/local/bin/aws` (or `$INSTALL_DIRECTORY/bin/aws`)
- Architecture is automatically detected based on `uname -m` if not explicitly specified

View File

@ -6,112 +6,20 @@ run "required_vars" {
}
}
run "with_version" {
run "with_custom_version" {
command = plan
variables {
agent_id = "test-agent-id"
aws_cli_version = "2.15.0"
}
assert {
condition = resource.coder_script.aws-cli.script != ""
error_message = "coder_script must have a valid script"
agent_id = "test-agent-id"
install_version = "2.15.0"
}
}
run "custom_install_directory" {
command = plan
variables {
agent_id = "test-agent-id"
install_directory = "/home/coder/.local"
}
assert {
condition = resource.coder_script.aws-cli.script != ""
error_message = "coder_script must have a valid script"
}
}
run "architecture_validation_x86_64" {
command = plan
variables {
agent_id = "test-agent-id"
architecture = "x86_64"
}
assert {
condition = resource.coder_script.aws-cli.script != ""
error_message = "coder_script must have a valid script"
}
}
run "architecture_validation_aarch64" {
command = plan
variables {
agent_id = "test-agent-id"
architecture = "aarch64"
}
assert {
condition = resource.coder_script.aws-cli.script != ""
error_message = "coder_script must have a valid script"
}
}
run "architecture_validation_invalid" {
command = plan
variables {
agent_id = "test-agent-id"
architecture = "invalid"
}
expect_failures = [
var.architecture
]
}
run "verify_signature" {
command = plan
variables {
agent_id = "test-agent-id"
verify_signature = true
}
assert {
condition = resource.coder_script.aws-cli.script != ""
error_message = "coder_script must have a valid script"
}
}
run "output_version_default" {
run "with_custom_log_path" {
command = plan
variables {
agent_id = "test-agent-id"
}
assert {
condition = output.aws_cli_version == "latest"
error_message = "output version should be 'latest' when no version is specified"
}
}
run "output_version_specified" {
command = plan
variables {
agent_id = "test-agent-id"
aws_cli_version = "2.15.0"
}
assert {
condition = output.aws_cli_version == "2.15.0"
error_message = "output version should match the specified version"
log_path = "/var/log/aws-cli.log"
}
}

View File

@ -1,54 +0,0 @@
import { describe, expect, it } from "bun:test";
import {
runTerraformApply,
runTerraformInit,
testRequiredVariables,
} from "~test";
describe("aws-cli", async () => {
await runTerraformInit(import.meta.dir);
testRequiredVariables(import.meta.dir, {
agent_id: "foo",
});
it("default output version is 'latest'", async () => {
const state = await runTerraformApply(import.meta.dir, {
agent_id: "foo",
});
expect(state.outputs.aws_cli_version.value).toBe("latest");
});
it("output version matches specified version", async () => {
const version = "2.15.0";
const state = await runTerraformApply(import.meta.dir, {
agent_id: "foo",
aws_cli_version: version,
});
expect(state.outputs.aws_cli_version.value).toBe(version);
});
it("accepts custom install directory", async () => {
const state = await runTerraformApply(import.meta.dir, {
agent_id: "foo",
install_directory: "/home/coder/.local",
});
expect(state.resources).toHaveLength(1);
});
it("accepts architecture parameter", async () => {
const state = await runTerraformApply(import.meta.dir, {
agent_id: "foo",
architecture: "x86_64",
});
expect(state.resources).toHaveLength(1);
});
it("accepts verify_signature parameter", async () => {
const state = await runTerraformApply(import.meta.dir, {
agent_id: "foo",
verify_signature: "true",
});
expect(state.resources).toHaveLength(1);
});
});

View File

@ -14,32 +14,16 @@ variable "agent_id" {
description = "The ID of a Coder agent."
}
variable "aws_cli_version" {
variable "install_version" {
type = string
description = "The version of AWS CLI to install. Leave empty for latest."
description = "The version of AWS CLI to install."
default = ""
}
variable "install_directory" {
variable "log_path" {
type = string
description = "The directory to install AWS CLI to."
default = "/usr/local"
}
variable "architecture" {
type = string
description = "The architecture to install AWS CLI for. Valid values are 'x86_64' and 'aarch64'. Leave empty for auto-detection."
default = ""
validation {
condition = var.architecture == "" || var.architecture == "x86_64" || var.architecture == "aarch64"
error_message = "The 'architecture' variable must be one of: '', 'x86_64', 'aarch64'."
}
}
variable "verify_signature" {
type = bool
description = "Whether to verify the GPG signature of the downloaded installer."
default = false
description = "The path to the AWS CLI installation log file."
default = "/tmp/aws-cli-install.log"
}
resource "coder_script" "aws-cli" {
@ -47,15 +31,9 @@ resource "coder_script" "aws-cli" {
display_name = "AWS CLI"
icon = "/icon/aws.svg"
script = templatefile("${path.module}/run.sh", {
VERSION : var.aws_cli_version,
INSTALL_DIRECTORY : var.install_directory,
ARCHITECTURE : var.architecture,
VERIFY_SIGNATURE : var.verify_signature
LOG_PATH : var.log_path,
VERSION : var.install_version,
})
run_on_start = true
}
output "aws_cli_version" {
description = "The version of AWS CLI that was installed (or 'latest' if no version was specified)."
value = var.aws_cli_version != "" ? var.aws_cli_version : "latest"
run_on_stop = false
}

View File

@ -1,162 +1,68 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
set -euo pipefail
LOG_PATH=${LOG_PATH}
VERSION=${VERSION}
VERSION="${VERSION}"
INSTALL_DIRECTORY="${INSTALL_DIRECTORY}"
ARCHITECTURE="${ARCHITECTURE}"
VERIFY_SIGNATURE="${VERIFY_SIGNATURE}"
BOLD='\033[0;1m'
RESET='\033[0m'
printf "${BOLD}Installing AWS CLI...\n${RESET}"
# Check if AWS CLI is already installed
if command -v aws > /dev/null 2>&1; then
INSTALLED_VERSION=$(aws --version 2>&1 | awk '{print $1}' | cut -d'/' -f2)
echo " AWS CLI is already installed (version $INSTALLED_VERSION)"
# If a specific version was requested, check if it matches
INSTALLED_VERSION=$(aws --version 2>&1 | cut -d' ' -f1 | cut -d'/' -f2)
if [ -n "$VERSION" ] && [ "$INSTALLED_VERSION" != "$VERSION" ]; then
echo "⚠️ Installed version ($INSTALLED_VERSION) does not match requested version ($VERSION)"
echo "🔄 Reinstalling AWS CLI..."
printf "AWS CLI $INSTALLED_VERSION is installed, but version $VERSION was requested.\n"
else
echo "✅ AWS CLI installation is up to date"
printf "AWS CLI is already installed ($INSTALLED_VERSION). Skipping installation.\n"
exit 0
fi
fi
# Detect architecture if not specified
if [ -z "$ARCHITECTURE" ]; then
ARCH=$(uname -m)
case $ARCH in
x86_64)
ARCHITECTURE="x86_64"
;;
aarch64 | arm64)
ARCHITECTURE="aarch64"
;;
*)
echo "❌ Unsupported architecture: $ARCH"
exit 1
;;
esac
fi
# Determine OS and architecture
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
echo "🔍 Detected architecture: $ARCHITECTURE"
case "$ARCH" in
x86_64) ARCH="x86_64" ;;
aarch64 | arm64) ARCH="aarch64" ;;
*)
printf "Unsupported architecture: $ARCH\n" > "${LOG_PATH}" 2>&1
exit 1
;;
esac
# Install AWS CLI
if [ "$OS" = "linux" ]; then
DOWNLOAD_URL="https://awscli.amazonaws.com/awscli-exe-linux-${ARCH}.zip"
printf "Downloading AWS CLI from $DOWNLOAD_URL...\n"
curl -fsSL "$DOWNLOAD_URL" -o /tmp/awscliv2.zip >> "${LOG_PATH}" 2>&1
unzip -q /tmp/awscliv2.zip -d /tmp >> "${LOG_PATH}" 2>&1
sudo /tmp/aws/install >> "${LOG_PATH}" 2>&1
rm -rf /tmp/awscliv2.zip /tmp/aws
elif [ "$OS" = "darwin" ]; then
DOWNLOAD_URL="https://awscli.amazonaws.com/AWSCLIV2.pkg"
printf "Downloading AWS CLI from $DOWNLOAD_URL...\n"
curl -fsSL "$DOWNLOAD_URL" -o /tmp/AWSCLIV2.pkg >> "${LOG_PATH}" 2>&1
sudo installer -pkg /tmp/AWSCLIV2.pkg -target / >> "${LOG_PATH}" 2>&1
rm -f /tmp/AWSCLIV2.pkg
# Construct download URL
if [ -n "$VERSION" ]; then
ZIP_FILE="awscli-exe-linux-$ARCHITECTURE-$VERSION.zip"
DOWNLOAD_URL="https://awscli.amazonaws.com/$ZIP_FILE"
else
ZIP_FILE="awscli-exe-linux-$ARCHITECTURE.zip"
DOWNLOAD_URL="https://awscli.amazonaws.com/$ZIP_FILE"
fi
echo "📥 Downloading AWS CLI from $DOWNLOAD_URL"
# Create temporary directory
TEMP_DIR=$(mktemp -d)
trap 'rm -rf "$TEMP_DIR"' EXIT
cd "$TEMP_DIR"
# Download AWS CLI installer
if ! curl -fsSL "$DOWNLOAD_URL" -o "awscliv2.zip"; then
echo "❌ Failed to download AWS CLI installer"
printf "Unsupported OS: $OS\n" > "${LOG_PATH}" 2>&1
exit 1
fi
# Verify signature if requested
if [ "$VERIFY_SIGNATURE" = "true" ]; then
echo "🔐 Verifying GPG signature..."
# Download signature file
curl -fsSL "$DOWNLOAD_URL.sig" -o "awscliv2.zip.sig"
# Download and import AWS CLI public key
cat > awscli-public-key.asc << 'EOF'
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBF2Cr7UBEADJZHcgusOJl7ENSyumXh85z0TRV0xJorM2B/JL0kHOyigQluUG
ZMLhENaG0bYatdrKP+3H91lvK050pXwnO/R7fB/FSTouki4ciIx5OuLlnJZIxSzx
PqGl0mkxImLNbGWoi6Lto0LYxqHN2iQtzlwTVmq9733zd3XfcXrZ3+LblHAgEt5G
TfNxEKJ8soPLyWmwDH6HWCnjZ/aIQRBTIQ05uVeEoYxSh6wOai7ss/KveoSNBbYz
gbdzoqI2Y8cgH2nbfgp3DSasaLZEd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ZLJpqZLqJLqZJqLJ
pZLqJZqLJpZLqJZLqJZLJwARAQABiQI8BBgBCAAmAhsMFiEE+123f9XBGLgFEa2o
pjEKzEZyR1wFAmBr3vgFCQvQ8ZsACgkQpjEKzEZyR1xhfA//VMi2VCwNqIFD4A7Q
H4/sLMNE4MFLfh+FLR8iGdLKYlJ4V8qYaFqLQHqKvLFJdQJ7LJ0LQNHqJZH0Zvjh
fH9ZQHqJ5JZH5vJHLpZJ0LZLqJ5JqJZLJqZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJ
qJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJ
qJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJ
qJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJ
qJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJ
qJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJ
qJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJ
qJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJ
qJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJqJZLqJZJ
qJZLqJZJqJZLqJZJqJZLqJZJqA==
=qvqC
-----END PGP PUBLIC KEY BLOCK-----
EOF
gpg --import awscli-public-key.asc 2> /dev/null || true
if gpg --verify awscliv2.zip.sig awscliv2.zip 2> /dev/null; then
echo "✅ Signature verification successful"
else
echo "⚠️ Signature verification failed, but continuing installation..."
fi
fi
# Extract the installer
echo "📦 Extracting installer..."
unzip -q awscliv2.zip
# Run the installer
echo "🔧 Installing AWS CLI to $INSTALL_DIRECTORY..."
# Check if we need sudo
if [ -w "$INSTALL_DIRECTORY" ]; then
./aws/install --install-dir "$INSTALL_DIRECTORY/aws-cli" --bin-dir "$INSTALL_DIRECTORY/bin" --update
else
sudo ./aws/install --install-dir "$INSTALL_DIRECTORY/aws-cli" --bin-dir "$INSTALL_DIRECTORY/bin" --update
fi
# Verify installation
if command -v aws > /dev/null 2>&1; then
INSTALLED_VERSION=$(aws --version 2>&1 | awk '{print $1}' | cut -d'/' -f2)
echo "✅ AWS CLI successfully installed (version $INSTALLED_VERSION)"
printf "🥳 AWS CLI installed successfully!\n"
aws --version
else
echo "❌ AWS CLI installation failed"
printf "❌ AWS CLI installation failed. Check logs at ${LOG_PATH}\n"
exit 1
fi