sst / ion

❍ — a new engine for SST
https://ion.sst.dev
MIT License
1.09k stars 126 forks source link

Feat: Vercel Projects #544

Open versecafe opened 2 weeks ago

versecafe commented 2 weeks ago

Add support for Projects through the Vercel TF provider, either as sst.vercel.Project or on a per supported framework basis with some simple codegen to grab all supported frameworks as sst.vercel.Nextjs, sst.vercel.Astro, etc

The configuration per framework is identical just changing the framework string in the vercel_project

resource "vercel_project" "example" {
  name      = "terraform-test-project"
  framework = "nextjs"
  project_id = vercel_project.example.id
  domain     = "myproject-domain.vercel.app"
  git_repository = {
    type = "github"
    repo = "<username>/nextjs-terraform-demo"
  }
}

data "vercel_project_directory" "example" {
  path = "../nextjs-terraform-demo"
}

resource "vercel_deployment" "example" {
  project_id  = vercel_project.example.id
  files       = data.vercel_project_directory.example.files
  path_prefix = "../nextjs-terraform-demo"
  production  = true
}

I know SST started as a way to move off Vercel to AWS but there are plenty of cases where you'd want some of your infrastructure on Vercel for some of the more beta features like PPR in Next on some of your infra but you'd want other sections such as DB and a Lambda backend sitting on AWS or CF.

Pulumi Docs: https://www.pulumi.com/registry/packages/vercel/api-docs/project/

jayair commented 6 days ago

Not sure if you've seen this example: https://github.com/sst/ion/blob/dev/examples/bad-decision/sst.config.ts

Do you need something more than that?

versecafe commented 6 days ago

It would be nice to integrate them properly with resource linking to be able to link together something like an edge config or VerceL KV store to a project, same way you can link a s3 bucket to a OpenNext site, I've been working on the upstream Vercel TF provider to support it, but also their is an issue where using @pulimiverse/vercel is locked to the. version used for the DNS so that does need to be continually updated to have access to more of the advanced configuration and other resources.