Skip to content

feat(vault-token): make supplying a vault token optional #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion registry/coder/modules/vault-token/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module "vault" {
source = "registry.coder.com/coder/vault-token/coder"
version = "1.0.7"
agent_id = coder_agent.example.id
vault_token = var.token
vault_token = var.token # optional
vault_addr = "https://vault.example.com"
}
```
Expand Down
1 change: 0 additions & 1 deletion registry/coder/modules/vault-token/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ describe("vault-token", async () => {
testRequiredVariables(import.meta.dir, {
agent_id: "foo",
vault_addr: "foo",
vault_token: "foo",
});
});
3 changes: 3 additions & 0 deletions registry/coder/modules/vault-token/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ variable "vault_token" {
type = string
description = "The Vault token to use for authentication."
sensitive = true
default = null

}

variable "vault_cli_version" {
Expand Down Expand Up @@ -56,6 +58,7 @@ resource "coder_env" "vault_addr" {
}

resource "coder_env" "vault_token" {
count = var.vault_token != null ? 1 : 0
agent_id = var.agent_id
name = "VAULT_TOKEN"
value = var.vault_token
Expand Down