Compare commits

...

4 Commits

Author SHA1 Message Date
github-actions[bot]
b90f6f9de8 chore: bump version to 1.0.7 in README.md files (#174)
Co-authored-by: matifali <matifali@users.noreply.github.com>
2024-02-26 20:53:27 +05:00
Muhammad Atif Ali
948280600a fix(vault): fix version fetching logic (#172) 2024-02-26 20:51:45 +05:00
Muhammad Atif Ali
407738b2be feat(hcp-vault-secrets): add project_id variable to HCP provider (#173) 2024-02-26 20:50:42 +05:00
github-actions[bot]
08adb4a839 chore: bump version to 1.0.6 in README.md files (#171) 2024-02-23 23:52:36 +05:00
11 changed files with 61 additions and 30 deletions

BIN
bun.lockb

Binary file not shown.

View File

@@ -15,9 +15,10 @@ This module lets you fetch all or selective secrets from a [HCP Vault Secrets](h
```tf ```tf
module "vault" { module "vault" {
source = "registry.coder.com/modules/hcp-vault-secrets/coder" source = "registry.coder.com/modules/hcp-vault-secrets/coder"
version = "1.0.3" version = "1.0.7"
agent_id = coder_agent.example.id agent_id = coder_agent.example.id
app_name = "demo-app" app_name = "demo-app"
project_id = "aaa-bbb-ccc"
} }
``` ```
@@ -29,6 +30,7 @@ To configure the HCP Vault Secrets module, follow these steps,
2. Create an HCP Service Principal from the HCP Vault Secrets app in the HCP console. This will give you the `HCP_CLIENT_ID` and `HCP_CLIENT_SECRET` that you need to authenticate with HCP Vault Secrets. 2. Create an HCP Service Principal from the HCP Vault Secrets app in the HCP console. This will give you the `HCP_CLIENT_ID` and `HCP_CLIENT_SECRET` that you need to authenticate with HCP Vault Secrets.
![HCP vault secrets credentials](../.images/hcp-vault-secrets-credentials.png) ![HCP vault secrets credentials](../.images/hcp-vault-secrets-credentials.png)
3. Set `HCP_CLIENT_ID` and `HCP_CLIENT_SECRET` variables on the coder provisioner (recommended) or supply them as input to the module. 3. Set `HCP_CLIENT_ID` and `HCP_CLIENT_SECRET` variables on the coder provisioner (recommended) or supply them as input to the module.
4. Set the `project_id`. This is the ID of the project where the HCP Vault Secrets app is running.
> See the [HCP Vault Secrets documentation](https://developer.hashicorp.com/hcp/docs/vault-secrets) for more information. > See the [HCP Vault Secrets documentation](https://developer.hashicorp.com/hcp/docs/vault-secrets) for more information.
@@ -39,9 +41,10 @@ To fetch all secrets from the HCP Vault Secrets app, skip the `secrets` input.
```tf ```tf
module "vault" { module "vault" {
source = "registry.coder.com/modules/hcp-vault-secrets/coder" source = "registry.coder.com/modules/hcp-vault-secrets/coder"
version = "1.0.3" version = "1.0.7"
agent_id = coder_agent.example.id agent_id = coder_agent.example.id
app_name = "demo-app" app_name = "demo-app"
project_id = "aaa-bbb-ccc"
} }
``` ```
@@ -52,9 +55,10 @@ To fetch selective secrets from the HCP Vault Secrets app, set the `secrets` inp
```tf ```tf
module "vault" { module "vault" {
source = "registry.coder.com/modules/hcp-vault-secrets/coder" source = "registry.coder.com/modules/hcp-vault-secrets/coder"
version = "1.0.3" version = "1.0.7"
agent_id = coder_agent.example.id agent_id = coder_agent.example.id
app_name = "demo-app" app_name = "demo-app"
project_id = "aaa-bbb-ccc"
secrets = ["MY_SECRET_1", "MY_SECRET_2"] secrets = ["MY_SECRET_1", "MY_SECRET_2"]
} }
``` ```
@@ -66,9 +70,10 @@ Set `client_id` and `client_secret` as module inputs.
```tf ```tf
module "vault" { module "vault" {
source = "registry.coder.com/modules/hcp-vault-secrets/coder" source = "registry.coder.com/modules/hcp-vault-secrets/coder"
version = "1.0.3" version = "1.0.7"
agent_id = coder_agent.example.id agent_id = coder_agent.example.id
app_name = "demo-app" app_name = "demo-app"
project_id = "aaa-bbb-ccc"
client_id = "HCP_CLIENT_ID" client_id = "HCP_CLIENT_ID"
client_secret = "HCP_CLIENT_SECRET" client_secret = "HCP_CLIENT_SECRET"
} }

View File

@@ -16,6 +16,7 @@ terraform {
provider "hcp" { provider "hcp" {
client_id = var.client_id client_id = var.client_id
client_secret = var.client_secret client_secret = var.client_secret
project_id = var.project_id
} }
provider "coder" {} provider "coder" {}
@@ -25,6 +26,11 @@ variable "agent_id" {
description = "The ID of a Coder agent." description = "The ID of a Coder agent."
} }
variable "project_id" {
type = string
description = "The ID of the HCP project."
}
variable "client_id" { variable "client_id" {
type = string type = string
description = <<-EOF description = <<-EOF

View File

@@ -14,7 +14,7 @@ This module adds a JetBrains Gateway Button to open any workspace with a single
```tf ```tf
module "jetbrains_gateway" { module "jetbrains_gateway" {
source = "registry.coder.com/modules/jetbrains-gateway/coder" source = "registry.coder.com/modules/jetbrains-gateway/coder"
version = "1.0.3" version = "1.0.6"
agent_id = coder_agent.example.id agent_id = coder_agent.example.id
agent_name = "example" agent_name = "example"
folder = "/home/coder/example" folder = "/home/coder/example"
@@ -32,7 +32,7 @@ module "jetbrains_gateway" {
```tf ```tf
module "jetbrains_gateway" { module "jetbrains_gateway" {
source = "registry.coder.com/modules/jetbrains-gateway/coder" source = "registry.coder.com/modules/jetbrains-gateway/coder"
version = "1.0.3" version = "1.0.6"
agent_id = coder_agent.example.id agent_id = coder_agent.example.id
agent_name = "example" agent_name = "example"
folder = "/home/coder/example" folder = "/home/coder/example"

View File

@@ -10,7 +10,7 @@
"devDependencies": { "devDependencies": {
"bun-types": "^1.0.18", "bun-types": "^1.0.18",
"gray-matter": "^4.0.3", "gray-matter": "^4.0.3",
"marked": "^11.1.0", "marked": "^12.0.0",
"prettier-plugin-sh": "^0.13.1", "prettier-plugin-sh": "^0.13.1",
"prettier-plugin-terraform-formatter": "^1.2.1" "prettier-plugin-terraform-formatter": "^1.2.1"
}, },

View File

@@ -15,7 +15,7 @@ This module lets you authenticate with [Hashicorp Vault](https://www.vaultprojec
```tf ```tf
module "vault" { module "vault" {
source = "registry.coder.com/modules/vault-github/coder" source = "registry.coder.com/modules/vault-github/coder"
version = "1.0.4" version = "1.0.7"
agent_id = coder_agent.example.id agent_id = coder_agent.example.id
vault_addr = "https://vault.example.com" vault_addr = "https://vault.example.com"
} }
@@ -46,7 +46,7 @@ To configure the Vault module, you must set up a Vault GitHub auth method. See t
```tf ```tf
module "vault" { module "vault" {
source = "registry.coder.com/modules/vault-github/coder" source = "registry.coder.com/modules/vault-github/coder"
version = "1.0.4" version = "1.0.7"
agent_id = coder_agent.example.id agent_id = coder_agent.example.id
vault_addr = "https://vault.example.com" vault_addr = "https://vault.example.com"
coder_github_auth_id = "my-github-auth-id" coder_github_auth_id = "my-github-auth-id"
@@ -58,7 +58,7 @@ module "vault" {
```tf ```tf
module "vault" { module "vault" {
source = "registry.coder.com/modules/vault-github/coder" source = "registry.coder.com/modules/vault-github/coder"
version = "1.0.4" version = "1.0.7"
agent_id = coder_agent.example.id agent_id = coder_agent.example.id
vault_addr = "https://vault.example.com" vault_addr = "https://vault.example.com"
coder_github_auth_id = "my-github-auth-id" coder_github_auth_id = "my-github-auth-id"
@@ -71,7 +71,7 @@ module "vault" {
```tf ```tf
module "vault" { module "vault" {
source = "registry.coder.com/modules/vault-github/coder" source = "registry.coder.com/modules/vault-github/coder"
version = "1.0.4" version = "1.0.7"
agent_id = coder_agent.example.id agent_id = coder_agent.example.id
vault_addr = "https://vault.example.com" vault_addr = "https://vault.example.com"
vault_cli_version = "1.15.0" vault_cli_version = "1.15.0"

View File

@@ -1,7 +1,7 @@
import { describe } from "bun:test"; import { describe } from "bun:test";
import { runTerraformInit, testRequiredVariables } from "../test"; import { runTerraformInit, testRequiredVariables } from "../test";
describe("vault-token", async () => { describe("vault-github", async () => {
await runTerraformInit(import.meta.dir); await runTerraformInit(import.meta.dir);
testRequiredVariables(import.meta.dir, { testRequiredVariables(import.meta.dir, {

View File

@@ -32,9 +32,19 @@ unzip_safe() {
} }
install() { install() {
# Get the architecture of the system
ARCH=$(uname -m)
if [ "$${ARCH}" = "x86_64" ]; then
ARCH="amd64"
elif [ "$${ARCH}" = "aarch64" ]; then
ARCH="arm64"
else
printf "Unsupported architecture: $${ARCH}\n"
return 1
fi
# Fetch the latest version of Vault if INSTALL_VERSION is 'latest' # Fetch the latest version of Vault if INSTALL_VERSION is 'latest'
if [ "$${INSTALL_VERSION}" = "latest" ]; then if [ "$${INSTALL_VERSION}" = "latest" ]; then
LATEST_VERSION=$(curl -s https://releases.hashicorp.com/vault/ | grep -v '-rc' | grep -oP 'vault/\K[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1) LATEST_VERSION=$(curl -s https://releases.hashicorp.com/vault/ | grep -v 'rc' | grep -oE 'vault/[0-9]+\.[0-9]+\.[0-9]+' | sed 's/vault\///' | sort -V | tail -n 1)
printf "Latest version of Vault is %s.\n\n" "$${LATEST_VERSION}" printf "Latest version of Vault is %s.\n\n" "$${LATEST_VERSION}"
if [ -z "$${LATEST_VERSION}" ]; then if [ -z "$${LATEST_VERSION}" ]; then
printf "Failed to determine the latest Vault version.\n" printf "Failed to determine the latest Vault version.\n"
@@ -60,7 +70,7 @@ install() {
else else
printf "Upgrading Vault CLI from version %s to %s ...\n\n" "$${CURRENT_VERSION}" "${INSTALL_VERSION}" printf "Upgrading Vault CLI from version %s to %s ...\n\n" "$${CURRENT_VERSION}" "${INSTALL_VERSION}"
fi fi
fetch vault.zip "https://releases.hashicorp.com/vault/$${INSTALL_VERSION}/vault_$${INSTALL_VERSION}_linux_amd64.zip" fetch vault.zip "https://releases.hashicorp.com/vault/$${INSTALL_VERSION}/vault_$${INSTALL_VERSION}_linux_$${ARCH}.zip"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
printf "Failed to download Vault.\n" printf "Failed to download Vault.\n"
return 1 return 1

View File

@@ -21,7 +21,7 @@ variable "vault_token" {
module "vault" { module "vault" {
source = "registry.coder.com/modules/vault-token/coder" source = "registry.coder.com/modules/vault-token/coder"
version = "1.0.4" version = "1.0.7"
agent_id = coder_agent.example.id agent_id = coder_agent.example.id
vault_token = var.token vault_token = var.token
vault_addr = "https://vault.example.com" vault_addr = "https://vault.example.com"
@@ -74,7 +74,7 @@ variable "vault_token" {
module "vault" { module "vault" {
source = "registry.coder.com/modules/vault-token/coder" source = "registry.coder.com/modules/vault-token/coder"
version = "1.0.4" version = "1.0.7"
agent_id = coder_agent.example.id agent_id = coder_agent.example.id
vault_addr = "https://vault.example.com" vault_addr = "https://vault.example.com"
vault_token = var.token vault_token = var.token

View File

@@ -30,9 +30,19 @@ unzip_safe() {
} }
install() { install() {
# Get the architecture of the system
ARCH=$(uname -m)
if [ "$${ARCH}" = "x86_64" ]; then
ARCH="amd64"
elif [ "$${ARCH}" = "aarch64" ]; then
ARCH="arm64"
else
printf "Unsupported architecture: $${ARCH}\n"
return 1
fi
# Fetch the latest version of Vault if INSTALL_VERSION is 'latest' # Fetch the latest version of Vault if INSTALL_VERSION is 'latest'
if [ "$${INSTALL_VERSION}" = "latest" ]; then if [ "$${INSTALL_VERSION}" = "latest" ]; then
LATEST_VERSION=$(curl -s https://releases.hashicorp.com/vault/ | grep -v '-rc' | grep -oP 'vault/\K[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1) LATEST_VERSION=$(curl -s https://releases.hashicorp.com/vault/ | grep -v 'rc' | grep -oE 'vault/[0-9]+\.[0-9]+\.[0-9]+' | sed 's/vault\///' | sort -V | tail -n 1)
printf "Latest version of Vault is %s.\n\n" "$${LATEST_VERSION}" printf "Latest version of Vault is %s.\n\n" "$${LATEST_VERSION}"
if [ -z "$${LATEST_VERSION}" ]; then if [ -z "$${LATEST_VERSION}" ]; then
printf "Failed to determine the latest Vault version.\n" printf "Failed to determine the latest Vault version.\n"

View File

@@ -14,7 +14,7 @@ Automatically install [Visual Studio Code Server](https://code.visualstudio.com/
```tf ```tf
module "vscode-web" { module "vscode-web" {
source = "registry.coder.com/modules/vscode-web/coder" source = "registry.coder.com/modules/vscode-web/coder"
version = "1.0.3" version = "1.0.6"
agent_id = coder_agent.example.id agent_id = coder_agent.example.id
accept_license = true accept_license = true
} }
@@ -29,7 +29,7 @@ module "vscode-web" {
```tf ```tf
module "vscode-web" { module "vscode-web" {
source = "registry.coder.com/modules/vscode-web/coder" source = "registry.coder.com/modules/vscode-web/coder"
version = "1.0.3" version = "1.0.6"
agent_id = coder_agent.example.id agent_id = coder_agent.example.id
install_prefix = "/home/coder/.vscode-web" install_prefix = "/home/coder/.vscode-web"
folder = "/home/coder" folder = "/home/coder"
@@ -42,7 +42,7 @@ module "vscode-web" {
```tf ```tf
module "vscode-web" { module "vscode-web" {
source = "registry.coder.com/modules/vscode-web/coder" source = "registry.coder.com/modules/vscode-web/coder"
version = "1.0.2" version = "1.0.6"
agent_id = coder_agent.example.id agent_id = coder_agent.example.id
extensions = ["github.copilot", "ms-python.python", "ms-toolsai.jupyter"] extensions = ["github.copilot", "ms-python.python", "ms-toolsai.jupyter"]
accept_license = true accept_license = true