Now I want to do the same, deploying with terraform. Following the docs, I do:
data "vercel_prebuilt_project" "frontend_dir" {
path = "../../../"
}
# TODO: How does this interact with the .vercel/project.json stuff?
resource "vercel_deployment" "prod_deployment" {
project_id = vercel_project.frontend_project.id
files = data.vercel_prebuilt_project.frontend_dir.output
path_prefix = data.vercel_prebuilt_project.frontend_dir.path
production = true
}
But this raises an error when running terraform -chdir=src/frontend/terraform apply (after having run pnpm vercel build --prod --token=$VERCEL_TOKEN already):
│ Error: Error reading prebuilt output
│
│ with data.vercel_prebuilt_project.frontend_dir,
│ on main.tf line 61, in data "vercel_prebuilt_project" "frontend_dir":
│ 61: data "vercel_prebuilt_project" "frontend_dir" {
│
│ An unexpected error occurred reading files from the .vercel directory: could not read file
│ ../../../.vercel/output/functions/_not-found.rsc.func: read ../../../.vercel/output/functions/_not-found.rsc.func: is a directory
And that's correct, .vercel/output/functions/_not-found.rsc.func is indeed a directory, not sure why terraform expects it to be a file. The vercel provider version is vercel/vercel v2.3.0, and I am using next 14.2.
I couldn't find anything about this error online. Do you have an idea?
Thanks!
Hi,
I have a monorepo setup:
(Note how the
.vercel
folder is at the root of the monorepo - this is required for vercel build to work correctly).I can build & deploy this manually just fine:
Now I want to do the same, deploying with terraform. Following the docs, I do:
But this raises an error when running
terraform -chdir=src/frontend/terraform apply
(after having runpnpm vercel build --prod --token=$VERCEL_TOKEN
already):And that's correct,
.vercel/output/functions/_not-found.rsc.func
is indeed a directory, not sure why terraform expects it to be a file. The vercel provider version isvercel/vercel v2.3.0
, and I am using next 14.2.I couldn't find anything about this error online. Do you have an idea? Thanks!