Skip to content

Conversation

@JEETDESAI25
Copy link
Collaborator

@JEETDESAI25 JEETDESAI25 commented Jan 15, 2026

Summary

Implements supabase_edge_function resource for deploying Edge Functions via Terraform.

  • Multipart file upload with entrypoint, import_map, and static_files (glob patterns) support
  • Two checksums tracked: local_checksum (source files) + checksum (remote bundle)
  • Import support via terraform import supabase_edge_function.name project_ref/slug
  • Slug changes trigger destroy+create

Deferred for now

  • Secrets management
  • Race conditions with bulk deploy
  • enabled field, API does not support it (status is read-only)

Test Plan

  • TestAccEdgeFunctionResource - Create + Read
  • TestAccEdgeFunctionResource_Update - Update flow
  • TestAccEdgeFunctionResource_Import - Import state

TF_ACC=1 go test ./internal/provider/... -v -run EdgeFunction

Implements edge function deployment via Terraform. Uses multipart file
upload instead of eszip bundling. Includes two-checksum approach for
change detection, slug changes trigger destroy/create,import support via
project_ref/slug format, and 404 drift detection.
@JEETDESAI25 JEETDESAI25 requested a review from a team as a code owner January 15, 2026 18:20
Copy link
Collaborator

@savme savme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just one small question

MarkdownDescription: "Edge Function resource",

Attributes: map[string]schema.Attribute{
"project_ref": schema.StringAttribute{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I'm missing something, without RequiresReplace a project_ref change would deploy to a new project while orphaning the original function.

That seems a bit unexpected, so we should consider marking this as a replace. What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this could lead to orphaned functions. Fixed! Appreciate the thorough review 🙏 @savme

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

Successfully merging this pull request may close these issues.

2 participants