This repository is the Terraform provider for Bytebase. A typical setup involves teams using Cloud vendors' Terraform provider to provision database instances, followed by using Terraform Bytebase Provider to prepare those instances ready for application use.
https://github.com/bytebase/terraform-example and https://tf.bytebase.com.
You can download this provider at registry.terraform.io.
Please follow Manage Bytebase with Terraform to use the provider.
If you have problems running
terraform
in MacOS with Apple Silicon, you can following https://stackoverflow.com/questions/66281882/how-can-i-get-terraform-init-to-run-on-my-apple-silicon-macbook-pro-for-the-go and use thetfenv
.
# clone Bytebase to get the OpenAPI server
git clone git@github.com:bytebase/bytebase.git
git clone git@github.com:bytebase/terraform-provider-bytebase.git
# start Bytebase OpenAPI server
cd bytebase
# check https://github.com/bytebase/bytebase for starting the Bytebase server.
air -c scripts/.air.toml
# install the provider in your local machine
cd terraform-provider-bytebase && make install
# test
# Any BYTEBASE_SERVICE_ACCOUNT/BYTEBASE_SERVICE_KEY/BYTEBASE_URL value should work since the service is mocked
TF_ACC=1 BYTEBASE_SERVICE_ACCOUNT=test@service.bytebase.com BYTEBASE_SERVICE_KEY=test_secret BYTEBASE_URL=https://bytebase.example.com go test -v ./...
# initialize the terraform for your example
# you need to set the service_account and service_key to your own
cd examples/setup && terraform init
# check the changes
terraform plan
# apply the changes
terraform apply
# print outputs
terraform output
# delete test resources
terraform destory
This will generate the doc template in the
docs
folderCheck https://github.com/hashicorp/terraform-plugin-docs for details.
go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs --provider-name=terraform-provider-bytebase
Follow this doc to publish the provider.
Note: We need to publish a new tag for a new version, the tag must be a valid Semantic Version preceded with a v (for example, v1.2.3). There must not be a branch name with the same name as the tag.
- Develop and merge the feature code.
- Create a new PR to update the version in
./VERSION
- After the version is updated, the action
./.github/workflows/release.yml
will use the newest versionx.y.z
to create a new tagvx.y.z
, then use the tag to create the release.