I created an HCP Vault as follows.
resource "hcp_vault_cluster" "cluster" {
cluster_id = "${var.app_name}-${var.environment}"
hvn_id = hcp_hvn.aws_hvn.hvn_id
tier = local.tier
public_endpoint = true
lifecycle {
prevent_destroy = true
}
}
resource "hcp_vault_cluster_admin_token" "token" {
cluster_id = hcp_vault_cluster.cluster.cluster_id
}
I want to authenticate the Vault Provider in another Workspace in Terraform Cloud via hcp_vault_cluster_admin_token
.
So I tried the following:
data "tfe_outputs" "hcp_vault" {
workspace = "hcp_vault"
}
provider "vault" {
address = tfe_outputs.hcp_vault.public_endpoint
token = tfe_outputs.hcp_vault.token
}
But i got error
Should the vault Provider’s token be injected only as an environment variable?
If I use TFE Provider’s variable resource and inject it into the workspace as an environment variable, is the token rolling automatically done in the variable?
Thank you