Skip to content
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

Output project API keys from supabase_project resource #71

Open
2 tasks done
ahockersten opened this issue Apr 24, 2024 · 4 comments
Open
2 tasks done

Output project API keys from supabase_project resource #71

ahockersten opened this issue Apr 24, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@ahockersten
Copy link

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

Currently there is no way of accessing the project API keys for a Supabase project created via Terraform. This means that you need to go into the Supabase UI in order to access these.

If you are (like me 😄 ) trying to setup your database together with your application in Terraform, there is no way to get all the needed data into the application without this manual step.

To Reproduce

N/A

Expected behavior

Service role key and regular keys can be accessed as outputs on the "supabase_project" resource (service role key should be marked as "sensitive").

Screenshots

N/A

System information

N/A

Additional context

N/A

@ahockersten ahockersten added the bug Something isn't working label Apr 24, 2024
@sweatybridge
Copy link
Collaborator

Hey thanks for the suggestion. We can certainly add service keys to terraform output. My only concern is that it may take up to a few minutes before a new project becomes ready to serve requests. Do you know if there's an idiomatic way in terraform to check for service health before fetching api keys?

@ahockersten
Copy link
Author

I'm unfortunately not familiar enough with terraform to answer that. I know it's possible to wait for a resource to be "ready" because creation of certain resources can take a long time (try creating a Redis instance in AWS for example).

I got a bit curious and did some digging though, it seems like what you need to do is to not return from the call in ProjectResource::Create() until the project is fully completed, reference: https://discuss.hashicorp.com/t/wait-for-certain-status/54526

So assuming Supabase has some API for polling the ready-state you could just poll until the project is ready to serve requests and that should be fine.

Another "solution" would be to not wait at all, this seems to be what the web UI on supabase.com does (it does display an indication that it's not ready though). Terraform is mainly used for setting up infrastructure, but the API key seems to be mostly useful for applications. Most users should be fine with Supabase not being able to serve requests immediately after setup but it does seem a bit ugly.

@sweatybridge
Copy link
Collaborator

Thank you for the input! I will try to implement the no-wait solution next week.

@sweatybridge sweatybridge added enhancement New feature or request and removed bug Something isn't working labels May 30, 2024
@RodPaDev
Copy link

Has there been any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants