Skip to content

Commit fc64fc2

Browse files
authored
Merge pull request #6 from bytebase/feat/api
chore: generate docs
2 parents 0211052 + 915cc70 commit fc64fc2

File tree

14 files changed

+343
-39
lines changed

14 files changed

+343
-39
lines changed

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,58 @@
11
# Terraform Provider Bytebase
22

33
This repository is the Terraform provider for Bytebase.
4+
5+
## Development
6+
7+
### Prerequisites
8+
9+
- [Go](https://golang.org/doc/install) (1.19 or later)
10+
- [Air](https://github.com/cosmtrek/air#installation) (must use forked repo 87187cc). This is for backend live reload.
11+
- [Terraform](https://developer.hashicorp.com/terraform/downloads?product_intent=terraform) (1.3.5 or later)
12+
13+
### Prepare
14+
15+
```bash
16+
# clone Bytebase to get the OpenAPI server
17+
git clone [email protected]:bytebase/bytebase.git
18+
19+
git clone [email protected]:bytebase/terraform-provider-bytebase.git
20+
```
21+
22+
```bash
23+
# start Bytebase OpenAPI server
24+
cd bytebase
25+
# check https://github.com/bytebase/bytebase for more information.
26+
air -c scripts/.air.toml
27+
```
28+
29+
### Build and test
30+
31+
```bash
32+
# install the provider in your local machine
33+
cd terraform-provider-bytebase && make install
34+
35+
# initial the terraform for your example
36+
# you may need to change the username and password
37+
cd examples && terraform init
38+
39+
# check the changes
40+
terraform plan
41+
42+
# apply the changes
43+
terraform apply
44+
45+
# print outputs
46+
terraform output
47+
48+
# delete test resources
49+
terraform destory
50+
```
51+
52+
### Generate docs
53+
54+
This will generate the doc template in the `docs` folder
55+
56+
```bash
57+
go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs --provider-name=terraform-provider-bytebase
58+
```

docs/data-sources/environments.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "bytebase_environments Data Source - terraform-provider-bytebase"
4+
subcategory: ""
5+
description: |-
6+
The environment data source.
7+
---
8+
9+
# bytebase_environments (Data Source)
10+
11+
The environment data source.
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Read-Only
19+
20+
- `environments` (List of Object) (see [below for nested schema](#nestedatt--environments))
21+
- `id` (String) The ID of this resource.
22+
23+
<a id="nestedatt--environments"></a>
24+
### Nested Schema for `environments`
25+
26+
Read-Only:
27+
28+
- `id` (Number)
29+
- `name` (String)
30+
- `order` (Number)
31+
32+

docs/data-sources/instances.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "bytebase_instances Data Source - terraform-provider-bytebase"
4+
subcategory: ""
5+
description: |-
6+
The instance data source.
7+
---
8+
9+
# bytebase_instances (Data Source)
10+
11+
The instance data source.
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Read-Only
19+
20+
- `id` (String) The ID of this resource.
21+
- `instances` (List of Object) (see [below for nested schema](#nestedatt--instances))
22+
23+
<a id="nestedatt--instances"></a>
24+
### Nested Schema for `instances`
25+
26+
Read-Only:
27+
28+
- `engine` (String)
29+
- `engine_version` (String)
30+
- `environment` (String)
31+
- `external_link` (String)
32+
- `host` (String)
33+
- `id` (Number)
34+
- `name` (String)
35+
- `port` (String)
36+
- `username` (String)
37+
38+

docs/index.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "bytebase Provider"
4+
subcategory: ""
5+
description: |-
6+
7+
---
8+
9+
# bytebase Provider
10+
11+
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Optional
19+
20+
- `bytebase_url` (String) The OpenAPI URL for your Bytebase server.
21+
- `email` (String) The Bytebase user account email.
22+
- `password` (String, Sensitive) The Bytebase user account password.

docs/resources/environment.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "bytebase_environment Resource - terraform-provider-bytebase"
4+
subcategory: ""
5+
description: |-
6+
The environment resource.
7+
---
8+
9+
# bytebase_environment (Resource)
10+
11+
The environment resource.
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Required
19+
20+
- `name` (String) The environment unique name.
21+
22+
### Optional
23+
24+
- `order` (Number) The environment sorting order.
25+
26+
### Read-Only
27+
28+
- `id` (String) The ID of this resource.
29+
30+

docs/resources/instance.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "bytebase_instance Resource - terraform-provider-bytebase"
4+
subcategory: ""
5+
description: |-
6+
The instance resource.
7+
---
8+
9+
# bytebase_instance (Resource)
10+
11+
The instance resource.
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Required
19+
20+
- `engine` (String) The instance engine. Support MYSQL, POSTGRES, TIDB, SNOWFLAKE, CLICKHOUSE.
21+
- `environment` (String) The environment name for your instance.
22+
- `host` (String) Host or socker for your instance, or the account name if the instance type is Snowflake.
23+
- `name` (String) The instance name.
24+
25+
### Optional
26+
27+
- `external_link` (String)
28+
- `password` (String, Sensitive) The connection user password used by Bytebase to perform DDL and DML operations.
29+
- `port` (String) The port for your instance.
30+
- `ssl_ca` (String)
31+
- `ssl_cert` (String)
32+
- `ssl_key` (String)
33+
- `username` (String) The connection user name used by Bytebase to perform DDL and DML operations.
34+
35+
### Read-Only
36+
37+
- `engine_version` (String) The version for instance engine.
38+
- `id` (String) The ID of this resource.
39+
40+

go.mod

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,24 @@ module github.com/bytebase/terraform-provider-bytebase
33
go 1.19
44

55
require (
6+
github.com/hashicorp/terraform-plugin-docs v0.13.0
67
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0
78
github.com/pkg/errors v0.9.1
89
)
910

1011
require (
12+
github.com/Masterminds/goutils v1.1.1 // indirect
13+
github.com/Masterminds/semver/v3 v3.1.1 // indirect
14+
github.com/Masterminds/sprig/v3 v3.2.2 // indirect
1115
github.com/agext/levenshtein v1.2.2 // indirect
1216
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
17+
github.com/armon/go-radix v1.0.0 // indirect
18+
github.com/bgentry/speakeasy v0.1.0 // indirect
1319
github.com/davecgh/go-spew v1.1.1 // indirect
1420
github.com/fatih/color v1.13.0 // indirect
1521
github.com/golang/protobuf v1.5.2 // indirect
1622
github.com/google/go-cmp v0.5.9 // indirect
23+
github.com/google/uuid v1.3.0 // indirect
1724
github.com/hashicorp/errwrap v1.1.0 // indirect
1825
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
1926
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
@@ -33,20 +40,26 @@ require (
3340
github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c // indirect
3441
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect
3542
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
36-
github.com/kr/pretty v0.3.0 // indirect
43+
github.com/huandu/xstrings v1.3.2 // indirect
44+
github.com/imdario/mergo v0.3.13 // indirect
3745
github.com/mattn/go-colorable v0.1.12 // indirect
3846
github.com/mattn/go-isatty v0.0.14 // indirect
47+
github.com/mitchellh/cli v1.1.4 // indirect
3948
github.com/mitchellh/copystructure v1.2.0 // indirect
4049
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
4150
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
4251
github.com/mitchellh/mapstructure v1.5.0 // indirect
4352
github.com/mitchellh/reflectwalk v1.0.2 // indirect
4453
github.com/oklog/run v1.0.0 // indirect
54+
github.com/posener/complete v1.2.3 // indirect
55+
github.com/russross/blackfriday v1.6.0 // indirect
56+
github.com/shopspring/decimal v1.3.1 // indirect
57+
github.com/spf13/cast v1.5.0 // indirect
4558
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
4659
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect
4760
github.com/vmihailenco/tagparser v0.1.1 // indirect
4861
github.com/zclconf/go-cty v1.11.0 // indirect
49-
golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167 // indirect
62+
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
5063
golang.org/x/net v0.2.0 // indirect
5164
golang.org/x/sys v0.2.0 // indirect
5265
golang.org/x/text v0.4.0 // indirect

0 commit comments

Comments
 (0)