Open GiamPy5 opened 4 years ago
I am seeing a similar problem with authenticating via approle.
provider "vault" {
address = "https://redacted"
skip_child_token = true
auth_login {
path = "auth/approle/login"
parameters = {
role_id: "redacted"
secret_id: "redacted"
}
}
}
data "vault_generic_secret" "secret" {
path = "kv-v1/application/nonprod/ID123/test"
}
When trying to retrieve the secret via some_key = data.vault_generic_secret.secret.data["some_key"]
, I am getting the following error.
ails:
---[ REQUEST ]---------------------------------------
GET /v1/sys/internal/ui/mounts/kv-v1/application/nonprod/ID123/test HTTP/1.1
Host: vault.ssnc-corp.cloud
User-Agent: Go-http-client/1.1
X-Vault-Request: true
X-Vault-Token: hmac-sha256:redacted
Accept-Encoding: gzip
-----------------------------------------------------: timestamp=2023-06-21T11:42:19.636-0700
2023-06-21T11:42:19.729-0700 [INFO] provider.terraform-provider-vault_v3.16.0_x5: 2023/06/21 11:42:19 [DEBUG] Vault API Response Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 403 Forbidden
Content-Length: 33
Cache-Control: no-store
Content-Type: application/json
Date: Wed, 21 Jun 2023 18:42:19 GMT
Strict-Transport-Security: max-age=16070400
-----------------------------------------------------: timestamp=2023-06-21T11:42:19.728-0700
2023-06-21T11:42:19.729-0700 [INFO] provider.terraform-provider-vault_v3.16.0_x5: 2023/06/21 11:42:19 [DEBUG] Vault API Request Details:
---[ REQUEST ]---------------------------------------
GET /v1/kv-v1/application/nonprod/ID123/test HTTP/1.1
Host: vault.ssnc-corp.cloud
User-Agent: Go-http-client/1.1
X-Vault-Request: true
X-Vault-Token: hmac-sha256:redacted
Accept-Encoding: gzip
-----------------------------------------------------: timestamp=2023-06-21T11:42:19.729-0700
2023-06-21T11:42:19.819-0700 [INFO] provider.terraform-provider-vault_v3.16.0_x5: 2023/06/21 11:42:19 [DEBUG] Vault API Response Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 403 Forbidden
Content-Length: 33
Cache-Control: no-store
Content-Type: application/json
Date: Wed, 21 Jun 2023 18:42:19 GMT
Strict-Transport-Security: max-age=16070400
Please note that terraform is able to authenticate and gain a token via approle creds; however, it cannot get the data from the key path. I've also tried with namespace in both the auth_login
block and in provider at the same time but it did not help. Writing a quick java app to validate the api call to /v1/kv-v1/application/nonprod/ID123/test
after approle authentication and token succeeds.
When I try the same path with non approle authentication, everything works as expected
provider "vault" {
address = "https://redacted"
skip_child_token = true
auth_login {
path = "auth/ldap/login/${var.VAULT_USER }"
parameters = { password: var.VAULT_PASSWORD }
}
}
data "vault_generic_secret" "ssccloud_api_key" {
path = "kv-v1/application/nonprod/ID123/test"
}
provider "ssccloud" {
api_key = data.vault_generic_secret.ssccloud_api_key.data["api_key"]
}
---[ REQUEST ]---------------------------------------
GET /v1/sys/internal/ui/mounts/kv-v1/application/nonprod/ID123/testHTTP/1.1
Host: vault.ssnc-corp.cloud
User-Agent: Go-http-client/1.1
X-Vault-Request: true
X-Vault-Token: hmac-sha256:redacted
Accept-Encoding: gzip
-----------------------------------------------------: timestamp=2023-06-21T16:52:33.280-0700
2023-06-21T16:52:33.393-0700 [INFO] provider.terraform-provider-vault_v3.16.0_x5: 2023/06/21 16:52:33 [DEBUG] Vault API Response Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Content-Length: 454
Cache-Control: no-store
Content-Type: application/json
Date: Wed, 21 Jun 2023 23:52:33 GMT
Strict-Transport-Security: max-age=16070400
-----------------------------------------------------: timestamp=2023-06-21T16:52:33.392-0700
2023-06-21T16:52:33.394-0700 [INFO] provider.terraform-provider-vault_v3.16.0_x5: 2023/06/21 16:52:33 [DEBUG] Vault API Request Details:
---[ REQUEST ]---------------------------------------
GET /v1/kv-v1/application/nonprod/ID123/testHTTP/1.1
Host: vault.ssnc-corp.cloud
User-Agent: Go-http-client/1.1
X-Vault-Request: true
X-Vault-Token: hmac-sha256:redacted
Accept-Encoding: gzip
-----------------------------------------------------: timestamp=2023-06-21T16:52:33.393-0700
2023-06-21T16:52:33.504-0700 [INFO] provider.terraform-provider-vault_v3.16.0_x5: 2023/06/21 16:52:33 [DEBUG] Vault API Response Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Content-Length: 513
Cache-Control: no-store
Content-Type: application/json
Date: Wed, 21 Jun 2023 23:52:33 GMT
Strict-Transport-Security: max-age=16070400
Terraform Version
v0.12.10
Affected Resource(s)
Please list the resources as a list, for example:
If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.
Terraform Configuration Files
Debug Output
Panic Output
No panic output.
Expected Behavior
No permission denied should be given as Terraform response.
Actual Behavior
No secrets found was returned from Terraform.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
database/creds/:role
.vault_generic_secret
.terraform apply
Important Factoids
None.
References
None.