-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmain.tf
More file actions
55 lines (47 loc) · 1.36 KB
/
main.tf
File metadata and controls
55 lines (47 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Examples for query the instance
terraform {
required_providers {
bytebase = {
version = "3.13.0"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
}
}
provider "bytebase" {
# You need to replace the account and key with your Bytebase service account.
service_account = "terraform@service.bytebase.com"
service_key = "bbs_BxVIp7uQsARl8nR92ZZV"
# The Bytebase service URL. You can use the external URL in production.
# Check the docs about external URL: https://www.bytebase.com/docs/get-started/install/external-url
url = "https://bytebase.example.com"
}
locals {
instance_id_test = "test-sample-instance"
instance_id_prod = "prod-sample-instance"
}
# List all instances in all environments
data "bytebase_instance_list" "all" {
environment = "environments/test"
engines = [
"MYSQL"
]
}
output "all_instances" {
value = data.bytebase_instance_list.all
}
# Find a specific instance by name
data "bytebase_instance" "test" {
resource_id = local.instance_id_test
list_all_databases = true
}
output "test_instance" {
value = data.bytebase_instance.test
}
data "bytebase_instance" "prod" {
resource_id = local.instance_id_prod
list_all_databases = false
}
output "prod_instance" {
value = data.bytebase_instance.prod
}