Skip to content
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

Support for user-defined project_id in data/hcp_vault_secrets_app and data/hcp_vault_secrets_secret #1219

Open
martinlau opened this issue Feb 18, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@martinlau
Copy link

martinlau commented Feb 18, 2025

Description

Currently the project_id is only returned from the data sources, the value used to query Vault is based on the provider's defined project_id.

This means that vault apps and secrets which can be created via the relevant resources, and are accessible via the UI are inaccessible through other code paths which then rely on the data sources.

Currently it's possible to do a dance with terraform provider aliases and hard coding project_ids, but that's not really scalable or sustainable beyond one or two cases.

New or Affected Resource(s)

  • data/hcp_vault_secrets_app
  • data/hcp_vault_secrets_secret

Potential Terraform Configuration

Existing code continues as is:

data "hcp_vault_secrets_app" "secrets_app" {
  app_name = var.secrets_app_name
}

and

data "hcp_vault_secrets_secret" "initial_passwords" {
  app_name     = var.secrets_app_name
  secret_name  = "..."
  secret_value = "..."
}

Updated version allows the project_id to be defined in the data source:

data "hcp_vault_secrets_app" "secrets_app" {
  # Attribute is accessible in the data source
  project_id = data.hcp_project.project.resource_id
  app_name   = var.secrets_app_name
}

and

data "hcp_vault_secrets_secret" "initial_passwords" {
  # Attribute is accessible in the data source
  project_id   = data.hcp_project.project.resource_id
  app_name     = var.secrets_app_name
  secret_name  = "..."
  secret_value = "..."
}

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@martinlau martinlau added the enhancement New feature or request label Feb 18, 2025
martinlau pushed a commit to martinlau/terraform-provider-hcp that referenced this issue Feb 18, 2025
@martinlau martinlau changed the title Support for user-defined project_id in data/hcp_vault_secrets_app Support for user-defined project_id in data/hcp_vault_secrets_app and data/hcp_vault_secrets_secret Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant