This tutorial is part of the Manage Bytebase with Terraform series:
📚 Complete examples: GitHub - Bytebase Terraform Provider
In the previous tutorial, you learned how to manage database instances and environments with Terraform. Now let’s organize those databases into projects for better management.
Building on the previous tutorial, you’ll learn how to:
Before starting, ensure you have completed the Manage Databases with Terraform tutorial and have:
main.tf
file with the Terraform provider configuredProjects in Bytebase help you organize databases logically.
Important: You cannot create databases directly via Terraform because database creation requires an issue workflow in Bytebase. Terraform can only assign existing databases to projects. All database creation must be done through the Bytebase UI or API first.
If you completed the previous tutorial, you should already have:
demo
on your mysql-test
instance within this projectIf you haven’t created the Test
project and demo
database yet, create them via the Bytebase UI:
Test
Test
project you just createdmysql-test
instance and create a database named demo
You should have a database at instances/mysql-test/databases/demo
.
You can add these lines to your main.tf
to see all existing databases:
Run terraform apply
to see your current databases and their projects.
Now let’s add the main feature of this tutorial - creating projects to organize your databases.
Add this new resource to your main.tf
file:
This project resource:
Another project
with ID another-project
demo
database from your test instance to this projectTest
project to this new projectTo add more databases to another-project
:
You can add more projects alongside the existing one:
You can also assign all databases from an instance:
Run terraform apply
to create your project(s):
Verify in Bytebase:
Another project
listeddemo
database is assigned to itYou’ve learned how to manage projects in Bytebase using Terraform. Starting from the existing configuration, you’ve:
demo
databaseIn the next tutorial, you’ll learn how to:
You can also explore:
For more advanced configurations, check the Terraform Provider examples on GitHub.
This tutorial is part of the Manage Bytebase with Terraform series:
📚 Complete examples: GitHub - Bytebase Terraform Provider
In the previous tutorial, you learned how to manage database instances and environments with Terraform. Now let’s organize those databases into projects for better management.
Building on the previous tutorial, you’ll learn how to:
Before starting, ensure you have completed the Manage Databases with Terraform tutorial and have:
main.tf
file with the Terraform provider configuredProjects in Bytebase help you organize databases logically.
Important: You cannot create databases directly via Terraform because database creation requires an issue workflow in Bytebase. Terraform can only assign existing databases to projects. All database creation must be done through the Bytebase UI or API first.
If you completed the previous tutorial, you should already have:
demo
on your mysql-test
instance within this projectIf you haven’t created the Test
project and demo
database yet, create them via the Bytebase UI:
Test
Test
project you just createdmysql-test
instance and create a database named demo
You should have a database at instances/mysql-test/databases/demo
.
You can add these lines to your main.tf
to see all existing databases:
Run terraform apply
to see your current databases and their projects.
Now let’s add the main feature of this tutorial - creating projects to organize your databases.
Add this new resource to your main.tf
file:
This project resource:
Another project
with ID another-project
demo
database from your test instance to this projectTest
project to this new projectTo add more databases to another-project
:
You can add more projects alongside the existing one:
You can also assign all databases from an instance:
Run terraform apply
to create your project(s):
Verify in Bytebase:
Another project
listeddemo
database is assigned to itYou’ve learned how to manage projects in Bytebase using Terraform. Starting from the existing configuration, you’ve:
demo
databaseIn the next tutorial, you’ll learn how to:
You can also explore:
For more advanced configurations, check the Terraform Provider examples on GitHub.