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

Add support for linking existing vercel_shared_environment_variable to a vercel_project #182

Open
joaquingatica opened this issue May 8, 2024 · 3 comments

Comments

@joaquingatica
Copy link

joaquingatica commented May 8, 2024

As a follow up request of #152, a way of linking a pre-existing Shared Environment Variable to a project would be great. The following configuration would result in duplicating the value of the vercel_shared_environment_variable in the vercel_project as a new variable, instead of linking the existing shared variable to the project.

data "vercel_shared_environment_variable" "my_shared_var" {
  key    = "MY_SHARED_VAR"
  target = ["production", "preview"]
}

resource "vercel_project" "my_project" {
  name      = "my-project"
  // ...other project props
}

resource "vercel_project_environment_variable" "my_project_my_shared_var" {
  project_id = vercel_project.my_project.id
  key        = data.vercel_shared_environment_variable.my_shared_var.key
  value      = data.vercel_shared_environment_variable.my_shared_var.value
  target     = data.vercel_shared_environment_variable.my_shared_var.target
  sensitive  = data.vercel_shared_environment_variable.my_shared_var.sensitive
}

@dglsparsons
Copy link
Collaborator

Hey @joaquingatica, this is a really good idea. I'll look to getting something added 🙏

@dglsparsons
Copy link
Collaborator

Hi @joaquingatica, I haven't looked into adding support for this yet, as I haven't figured out how to make an API that works nicely with what already exists.

As a thought, is there any reason that importing the existing shared environment variable wouldn't work?

@joaquingatica
Copy link
Author

Hi @dglsparsons! Importing the shared variable would work as an alternative I believe, but I opted to manually link it through the Vercel Dashboard instead, to leverage the native feature intead of working around it.

Also, I'd have to reconfirm, but I seem to recall that if the environment variable was sensitive, importing the existing shared variable didn't work as expected. This isn't confirmed though. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants