Skip to content

Conversation

gabornyergesX
Copy link
Contributor

What kind of change does this PR introduce?

This PR introduces a new data source supabase_project_apikeys that allows retrieving API keys for a Supabase project. This is a read-only data source that provides access to both the anonymous and service role API keys.

What is the current behavior?

Currently, there is no way to programmatically retrieve Supabase project API keys using Terraform. Users need to manually copy these values from the Supabase dashboard or store them separately.

What is the new behavior?

The new data source allows users to:

  • Retrieve both anon and service role API keys for a specified project
  • Reference these keys securely in other Terraform resources
  • Automatically handle sensitive values with proper marking in Terraform state

Example usage:

data "supabase_project_apikeys" "example" {
  project_id = "abcdef123456"
}

# Use the keys in other resources
resource "some_resource" "example" {
  api_key = data.supabase_project_apikeys.example.anon_key
}

… Go coding conventions and improve readability
…test functions for better organization and reusability
…ng data source

♻️ (docs/tutorial.md): refactor code to use Terraform data sources instead of hardcoded values
@sweatybridge sweatybridge changed the title datasource supabase_project_apikeys feat: datasource for supabase_project_apikeys Jan 8, 2025
@sweatybridge
Copy link
Collaborator

Thank you for contributing this change! closes #71

@gabornyergesX
Copy link
Contributor Author

i fixed the tests.

@sweatybridge sweatybridge merged commit 4f4f315 into supabase:main Jan 8, 2025
5 checks passed
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