-
Notifications
You must be signed in to change notification settings - Fork 32
Support per-branch environment variables #20
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
Conversation
22ea3f2
to
53ceaf8
Compare
@@ -93,6 +93,7 @@ resource "vercel_project" "example" { | |||
|
|||
Optional: | |||
|
|||
- **git_branch** (String) The git branch of the environment variable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% familiar with this API, but can you only specify git_branch
for preview
target
s, or does it work across all different target possibilities?
e.g. what happens if I specified
target = ["production", "preview"]
git_branch = "staging"
key = "foo"
value = "bar"
I'm wondering if it's worth adding some additional validation around that.
Granted the provider is currently pretty light on up-front validation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API is very strict; the branch has to actually exist, can't be your production branch etc. Lots of things we cannot validate here. You get good error messages if you try to do something impossible.
"git_branch": { | ||
Description: "The git branch of the environment variable.", | ||
Type: types.StringType, | ||
Optional: true, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're also missing a test that includes the git_branch
being used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think at the moment the git tests only actually work for you. I get
Could not create project, unexpected error: bad_request - To link a GitHub
repository, you need to install the GitHub integration first.
Which I think is because I can only use my own repositories. However I have added some reasonable tests that will hopefully work. (You will need to crate a staging
branch in your test repository).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh yeah, makes sense. We should probably read an environment variable for the non-team git repository or something. I don't think we can keep it pointing at my git repos forever 🤣. One for later though!
Fixes vercel#13 Straightforward change to expose the API field.
53ceaf8
to
1928717
Compare
The Project struct is used by both the data_source and the resource. However, git_branch for environment_variables were only added to the resource.
Fixes #13
Straightforward change to expose the API field.