Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 407738b

Browse files
authored
feat(hcp-vault-secrets): add project_id variable to HCP provider (#173)
1 parent 08adb4a commit 407738b

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

hcp-vault-secrets/README.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ This module lets you fetch all or selective secrets from a [HCP Vault Secrets](h
1414

1515
```tf
1616
module "vault" {
17-
source = "registry.coder.com/modules/hcp-vault-secrets/coder"
18-
version = "1.0.3"
19-
agent_id = coder_agent.example.id
20-
app_name = "demo-app"
17+
source = "registry.coder.com/modules/hcp-vault-secrets/coder"
18+
version = "1.0.3"
19+
agent_id = coder_agent.example.id
20+
app_name = "demo-app"
21+
project_id = "aaa-bbb-ccc"
2122
}
2223
```
2324

@@ -29,6 +30,7 @@ To configure the HCP Vault Secrets module, follow these steps,
2930
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.
3031
![HCP vault secrets credentials](../.images/hcp-vault-secrets-credentials.png)
3132
3. Set `HCP_CLIENT_ID` and `HCP_CLIENT_SECRET` variables on the coder provisioner (recommended) or supply them as input to the module.
33+
4. Set the `project_id`. This is the ID of the project where the HCP Vault Secrets app is running.
3234

3335
> See the [HCP Vault Secrets documentation](https://developer.hashicorp.com/hcp/docs/vault-secrets) for more information.
3436
@@ -38,10 +40,11 @@ To fetch all secrets from the HCP Vault Secrets app, skip the `secrets` input.
3840

3941
```tf
4042
module "vault" {
41-
source = "registry.coder.com/modules/hcp-vault-secrets/coder"
42-
version = "1.0.3"
43-
agent_id = coder_agent.example.id
44-
app_name = "demo-app"
43+
source = "registry.coder.com/modules/hcp-vault-secrets/coder"
44+
version = "1.0.3"
45+
agent_id = coder_agent.example.id
46+
app_name = "demo-app"
47+
project_id = "aaa-bbb-ccc"
4548
}
4649
```
4750

@@ -51,11 +54,12 @@ To fetch selective secrets from the HCP Vault Secrets app, set the `secrets` inp
5154

5255
```tf
5356
module "vault" {
54-
source = "registry.coder.com/modules/hcp-vault-secrets/coder"
55-
version = "1.0.3"
56-
agent_id = coder_agent.example.id
57-
app_name = "demo-app"
58-
secrets = ["MY_SECRET_1", "MY_SECRET_2"]
57+
source = "registry.coder.com/modules/hcp-vault-secrets/coder"
58+
version = "1.0.3"
59+
agent_id = coder_agent.example.id
60+
app_name = "demo-app"
61+
project_id = "aaa-bbb-ccc"
62+
secrets = ["MY_SECRET_1", "MY_SECRET_2"]
5963
}
6064
```
6165

@@ -69,6 +73,7 @@ module "vault" {
6973
version = "1.0.3"
7074
agent_id = coder_agent.example.id
7175
app_name = "demo-app"
76+
project_id = "aaa-bbb-ccc"
7277
client_id = "HCP_CLIENT_ID"
7378
client_secret = "HCP_CLIENT_SECRET"
7479
}

hcp-vault-secrets/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ terraform {
1616
provider "hcp" {
1717
client_id = var.client_id
1818
client_secret = var.client_secret
19+
project_id = var.project_id
1920
}
2021

2122
provider "coder" {}
@@ -25,6 +26,11 @@ variable "agent_id" {
2526
description = "The ID of a Coder agent."
2627
}
2728

29+
variable "project_id" {
30+
type = string
31+
description = "The ID of the HCP project."
32+
}
33+
2834
variable "client_id" {
2935
type = string
3036
description = <<-EOF

0 commit comments

Comments
 (0)