feat(vault-github): use `coder_env` to set `VAULT_ADDR` in workspace (#112)

pull/119/head
Muhammad Atif Ali 2 years ago committed by GitHub
parent 1e3bd2b04b
commit f8faea1855
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,16 +17,6 @@ module "vault" {
agent_id = coder_agent.example.id
vault_addr = "https://vault.example.com"
}
# A workaround until we have https://github.com/coder/terraform-provider-coder/issues/170
resource "coder_agent" "example" {
...
env = {
VAULT_ADDR = "https://vault.example.com"
}
...
}
```
Then you can use the Vault CLI in your workspaces to fetch secrets from Vault:

@ -4,7 +4,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = ">= 0.12"
version = ">= 0.12.4"
}
}
}
@ -43,6 +43,7 @@ variable "vault_cli_version" {
}
data "coder_workspace" "me" {}
resource "coder_script" "vault" {
agent_id = var.agent_id
display_name = "Vault (GitHub)"
@ -57,6 +58,12 @@ resource "coder_script" "vault" {
start_blocks_login = true
}
resource "coder_env" "vault_addr" {
agent_id = var.agent_id
name = "VAULT_ADDR"
value = var.vault_addr
}
data "coder_external_auth" "github" {
id = var.coder_github_auth_id
}

Loading…
Cancel
Save