terraform-provider-vercel
terraform-provider-vercel copied to clipboard
vercel_deployment does not deploy preview if production = false
Hi, I am trying to make a preview deployment in terraform, but every time it makes a production deployment
resource "vercel_project" "projname" {
name = "projname"
framework = "remix"
team_id = "team_id"
git_repository = {
type = "github"
repo = "${github_repository.projname.full_name}"
}
}
resource "vercel_deployment" "projname_preview" {
project_id = vercel_project.projname.id
team_id = "team_id"
ref = "preview"
production = false
delete_on_destroy = true
environment = {
for tuple in regexall("(.*?)=(.*)", file("./.env.prod")) : tuple[0] => tuple[1]
}
}
I would expect when I apply this that the preview branch is deployed to a preview deployment, but my production deployment gets updated. Do I have something wrong in the syntax?
Hi, the first deployment of any project is always a production deployment. Could it be that? Or are you seeing the same issue on subsequent deployments too?
This could be exacerbated with delete_on_destroy = true
too.
Closing this as it looks stale! :)
@dglsparsons yes, this can be closed. The issue was as you described, the first deployment pushes to production and preview, which was a behavior I was not expecting. Thank you for the insight!