mirror of
https://github.com/coder/registry.git
synced 2026-06-03 04:58:15 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a7a4ae4cdf | |||
| be4dc937b5 | |||
| 7a70127f35 | |||
| 2039c3908b | |||
| eef8697f52 | |||
| 3393a04272 | |||
| 75fd523215 | |||
| 5564a552ba | |||
| fca4fdf2ef | |||
| c22fb8bcdc | |||
| fdaaba7378 |
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
|
"configVersion": 0,
|
||||||
"workspaces": {
|
"workspaces": {
|
||||||
"": {
|
"": {
|
||||||
"name": "registry",
|
"name": "registry",
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 58 KiB |
@@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
display_name: Austen Bruhn
|
||||||
|
bio: Solution Engineer at Coder, OSS enthusiast
|
||||||
|
github: ausbru87
|
||||||
|
avatar: ./.images/avatar.png
|
||||||
|
linkedin: https://www.linkedin.com/in/austen-bruhn-b0a646a1/
|
||||||
|
status: community
|
||||||
|
---
|
||||||
|
|
||||||
|
# ausbru87
|
||||||
|
|
||||||
|
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.
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
---
|
||||||
|
display_name: AWS CLI
|
||||||
|
description: Install AWS CLI v2 in your workspace
|
||||||
|
icon: ../../../../.icons/aws.svg
|
||||||
|
verified: false
|
||||||
|
tags: [helper, aws, cli]
|
||||||
|
---
|
||||||
|
|
||||||
|
# AWS CLI
|
||||||
|
|
||||||
|
Automatically install the [AWS CLI v2](https://aws.amazon.com/cli/) in your Coder workspace with command autocomplete support for bash, zsh, and fish shells.
|
||||||
|
|
||||||
|
```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
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Installs AWS CLI v2 for Linux and macOS
|
||||||
|
- Supports x86_64 and ARM64 architectures
|
||||||
|
- Optional version pinning
|
||||||
|
- **Auto-configures command autocomplete** for bash, zsh, and fish shells
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Basic Installation
|
||||||
|
|
||||||
|
```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
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Pin to Specific Version
|
||||||
|
|
||||||
|
```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/ausbru87/aws-cli/coder"
|
||||||
|
version = "1.0.0"
|
||||||
|
agent_id = coder_agent.example.id
|
||||||
|
log_path = "/var/log/aws-cli.log"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Airgapped Environment
|
||||||
|
|
||||||
|
Use a custom download URL for environments without internet access to AWS:
|
||||||
|
|
||||||
|
```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
|
||||||
|
download_url = "https://internal-mirror.company.com/awscli-exe-linux-x86_64.zip"
|
||||||
|
}
|
||||||
|
```
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
run "required_vars" {
|
||||||
|
command = plan
|
||||||
|
|
||||||
|
variables {
|
||||||
|
agent_id = "test-agent-id"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
run "with_custom_version" {
|
||||||
|
command = plan
|
||||||
|
|
||||||
|
variables {
|
||||||
|
agent_id = "test-agent-id"
|
||||||
|
install_version = "2.15.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
run "with_custom_log_path" {
|
||||||
|
command = plan
|
||||||
|
|
||||||
|
variables {
|
||||||
|
agent_id = "test-agent-id"
|
||||||
|
log_path = "/var/log/aws-cli.log"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
run "with_custom_download_url" {
|
||||||
|
command = plan
|
||||||
|
|
||||||
|
variables {
|
||||||
|
agent_id = "test-agent-id"
|
||||||
|
download_url = "https://internal-mirror.company.com/awscli-exe-linux-x86_64.zip"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
terraform {
|
||||||
|
required_version = ">= 1.0"
|
||||||
|
|
||||||
|
required_providers {
|
||||||
|
coder = {
|
||||||
|
source = "coder/coder"
|
||||||
|
version = ">= 2.5"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "agent_id" {
|
||||||
|
type = string
|
||||||
|
description = "The ID of a Coder agent."
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "install_version" {
|
||||||
|
type = string
|
||||||
|
description = "The version of AWS CLI to install."
|
||||||
|
default = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "download_url" {
|
||||||
|
type = string
|
||||||
|
description = "Custom download URL for AWS CLI. Useful for airgapped environments. If not set, uses the official AWS download URL."
|
||||||
|
default = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "log_path" {
|
||||||
|
type = string
|
||||||
|
description = "The path to the AWS CLI installation log file."
|
||||||
|
default = "/tmp/aws-cli-install.log"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "coder_script" "aws-cli" {
|
||||||
|
agent_id = var.agent_id
|
||||||
|
display_name = "AWS CLI"
|
||||||
|
icon = "/icon/aws.svg"
|
||||||
|
script = templatefile("${path.module}/run.sh", {
|
||||||
|
LOG_PATH : var.log_path,
|
||||||
|
VERSION : var.install_version,
|
||||||
|
DOWNLOAD_URL : var.download_url,
|
||||||
|
})
|
||||||
|
run_on_start = true
|
||||||
|
run_on_stop = false
|
||||||
|
}
|
||||||
Executable
+129
@@ -0,0 +1,129 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
LOG_PATH=${LOG_PATH}
|
||||||
|
VERSION=${VERSION}
|
||||||
|
DOWNLOAD_URL=${DOWNLOAD_URL}
|
||||||
|
|
||||||
|
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 | cut -d' ' -f1 | cut -d'/' -f2)
|
||||||
|
if [ -n "$VERSION" ] && [ "$INSTALLED_VERSION" != "$VERSION" ]; then
|
||||||
|
printf "❌ AWS CLI $INSTALLED_VERSION is installed, but version $VERSION was requested.\\n"
|
||||||
|
printf "Note: AWS CLI installer does not support version-specific installation.\\n"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
printf "AWS CLI is already installed ($INSTALLED_VERSION). Skipping installation.\\n"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Determine OS and architecture
|
||||||
|
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||||
|
ARCH=$(uname -m)
|
||||||
|
|
||||||
|
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
|
||||||
|
# Use custom download URL if provided, otherwise use default AWS URL
|
||||||
|
if [ -z "$DOWNLOAD_URL" ]; then
|
||||||
|
DOWNLOAD_URL="https://awscli.amazonaws.com/awscli-exe-linux-${ARCH}.zip"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "Downloading AWS CLI from $DOWNLOAD_URL...\\n"
|
||||||
|
curl -fsSL "$DOWNLOAD_URL" -o /tmp/awscliv2.zip >> "${LOG_PATH}" 2>&1 || exit 1
|
||||||
|
|
||||||
|
unzip -q /tmp/awscliv2.zip -d /tmp >> "${LOG_PATH}" 2>&1 || exit 1
|
||||||
|
sudo /tmp/aws/install >> "${LOG_PATH}" 2>&1 || exit 1
|
||||||
|
|
||||||
|
rm -rf /tmp/awscliv2.zip /tmp/aws
|
||||||
|
|
||||||
|
elif [ "$OS" = "darwin" ]; then
|
||||||
|
# Use custom download URL if provided, otherwise use architecture-specific AWS URL
|
||||||
|
if [ -z "$DOWNLOAD_URL" ]; then
|
||||||
|
case "$ARCH" in
|
||||||
|
x86_64)
|
||||||
|
DOWNLOAD_URL="https://awscli.amazonaws.com/AWSCLIV2-x86_64.pkg"
|
||||||
|
;;
|
||||||
|
aarch64)
|
||||||
|
DOWNLOAD_URL="https://awscli.amazonaws.com/AWSCLIV2-arm64.pkg"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
DOWNLOAD_URL="https://awscli.amazonaws.com/AWSCLIV2.pkg"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "Downloading AWS CLI from $DOWNLOAD_URL...\\n"
|
||||||
|
curl -fsSL "$DOWNLOAD_URL" -o /tmp/AWSCLIV2.pkg >> "${LOG_PATH}" 2>&1 || exit 1
|
||||||
|
|
||||||
|
sudo installer -pkg /tmp/AWSCLIV2.pkg -target / >> "${LOG_PATH}" 2>&1 || exit 1
|
||||||
|
|
||||||
|
rm -f /tmp/AWSCLIV2.pkg
|
||||||
|
|
||||||
|
else
|
||||||
|
printf "Unsupported OS: $OS\\n" >> "${LOG_PATH}" 2>&1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Verify installation was successful
|
||||||
|
if command -v aws > /dev/null 2>&1; then
|
||||||
|
printf "🥳 AWS CLI installed successfully!\\n"
|
||||||
|
aws --version
|
||||||
|
|
||||||
|
# Configure autocomplete for common shells
|
||||||
|
if command -v aws_completer > /dev/null 2>&1; then
|
||||||
|
AWS_COMPLETER_PATH=$(which aws_completer)
|
||||||
|
|
||||||
|
# Bash autocomplete
|
||||||
|
if [ -f ~/.bashrc ]; then
|
||||||
|
if ! grep -q "aws_completer.*aws" ~/.bashrc; then
|
||||||
|
echo "complete -C '$AWS_COMPLETER_PATH' aws" >> ~/.bashrc
|
||||||
|
printf "✓ Configured AWS CLI autocomplete for bash\\n"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Zsh autocomplete
|
||||||
|
if [ -f ~/.zshrc ] || [ -d ~/.oh-my-zsh ]; then
|
||||||
|
if ! grep -q "aws_completer.*aws" ~/.zshrc 2> /dev/null; then
|
||||||
|
cat >> ~/.zshrc << ZSHEOF
|
||||||
|
|
||||||
|
# AWS CLI autocomplete
|
||||||
|
autoload bashcompinit && bashcompinit
|
||||||
|
autoload -Uz compinit && compinit
|
||||||
|
complete -C '$AWS_COMPLETER_PATH' aws
|
||||||
|
ZSHEOF
|
||||||
|
printf "✓ Configured AWS CLI autocomplete for zsh\\n"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Fish autocomplete
|
||||||
|
if [ -d ~/.config/fish ] || command -v fish > /dev/null 2>&1; then
|
||||||
|
mkdir -p ~/.config/fish/completions
|
||||||
|
FISH_COMPLETION=~/.config/fish/completions/aws.fish
|
||||||
|
if [ ! -f "$FISH_COMPLETION" ]; then
|
||||||
|
cat > "$FISH_COMPLETION" << 'FISHEOF'
|
||||||
|
complete --command aws --no-files --arguments '(begin; set --local --export COMP_SHELL fish; set --local --export COMP_LINE (commandline); aws_completer | sed '"'"'s/ $//'"'"'; end)'
|
||||||
|
FISHEOF
|
||||||
|
printf "✓ Configured AWS CLI autocomplete for fish\\n"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
printf "❌ AWS CLI installation failed. Check logs at ${LOG_PATH}\\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user