Skip to content

Commit 5a52f51

Browse files
committed
docs: add documentation to provider and resources
1 parent e3cf6d1 commit 5a52f51

File tree

9 files changed

+151
-12
lines changed

9 files changed

+151
-12
lines changed

docs/index.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "mssql Provider"
4+
subcategory: ""
5+
description: |-
6+
7+
---
8+
9+
# mssql Provider
10+
11+
12+
13+
## Example Usage
14+
15+
```terraform
16+
provider "mssql" {
17+
host = "localhost"
18+
username = "sa"
19+
password = "password"
20+
}
21+
```
22+
23+
<!-- schema generated by tfplugindocs -->
24+
## Schema
25+
26+
### Required
27+
28+
- `host` (String) The address the mssql server is reachable on.
29+
- `password` (String)
30+
- `username` (String) The username to authenticate against the mssql server with. Requires the dbcreator role to create new databases.
31+
32+
### Optional
33+
34+
- `port` (Number) The port the mssql server is listening on.
35+
36+
Defaults to 1433

docs/resources/database.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "mssql_database Resource - terraform-provider-mssql"
4+
subcategory: ""
5+
description: |-
6+
Manage a Database
7+
Updating the database is currently not implemented and will drop the entire database!
8+
---
9+
10+
# mssql_database (Resource)
11+
12+
Manage a Database
13+
14+
Updating the database is currently not implemented and will drop the entire database!
15+
16+
## Example Usage
17+
18+
```terraform
19+
resource "mssql_database" "db" {
20+
name = "MyDatabase"
21+
}
22+
```
23+
24+
<!-- schema generated by tfplugindocs -->
25+
## Schema
26+
27+
### Required
28+
29+
- `name` (String) The name of the database
30+
31+
### Optional
32+
33+
- `owner` (String) The username of the owner of the database
34+
35+
### Read-Only
36+
37+
- `id` (String) The ID of this resource.
38+
39+

docs/resources/role.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "mssql_role Resource - terraform-provider-mssql"
4+
subcategory: ""
5+
description: |-
6+
Manage a role
7+
Updating a role is currently not supported and will drop the user.
8+
---
9+
10+
# mssql_role (Resource)
11+
12+
Manage a role
13+
14+
Updating a role is currently not supported and will drop the user.
15+
16+
## Example Usage
17+
18+
```terraform
19+
resource "mssql_role" "user" {
20+
name = "MyUser"
21+
password = "MyPassword"
22+
}
23+
```
24+
25+
<!-- schema generated by tfplugindocs -->
26+
## Schema
27+
28+
### Required
29+
30+
- `name` (String) The logon name of the role
31+
- `password` (String) The password used by the role
32+
33+
### Read-Only
34+
35+
- `id` (String) The ID of this resource.
36+
37+

examples/provider/provider.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
provider "mssql" {
2+
host = "localhost"
3+
username = "sa"
4+
password = "password"
5+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
resource "mssql_database" "db" {
2+
name = "MyDatabase"
3+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
resource "mssql_role" "user" {
2+
name = "MyUser"
3+
password = "MyPassword"
4+
}

mssql/provider.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,26 @@ func Provider() *schema.Provider {
1212
return &schema.Provider{
1313
Schema: map[string]*schema.Schema{
1414
"username": {
15-
Type: schema.TypeString,
16-
Required: true,
15+
Type: schema.TypeString,
16+
Required: true,
17+
Description: "The username to authenticate against the mssql server with. Requires the dbcreator role to create new databases.",
1718
},
1819
"password": {
1920
Type: schema.TypeString,
2021
Required: true,
2122
},
2223
"host": {
23-
Type: schema.TypeString,
24-
Required: true,
24+
Type: schema.TypeString,
25+
Required: true,
26+
Description: "The address the mssql server is reachable on.",
2527
},
2628
"port": {
2729
Type: schema.TypeInt,
2830
Default: 1433,
2931
Optional: true,
32+
Description: `The port the mssql server is listening on.
33+
34+
Defaults to 1433`,
3035
},
3136
},
3237
ResourcesMap: map[string]*schema.Resource{

mssql/resource_database.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,19 @@ func resourceDatabase() *schema.Resource {
1212
Read: resourceDatabaseRead,
1313
Update: resourceDatabaseUpdate,
1414
Delete: resourceDatabaseDelete,
15+
Description: `Manage a Database
1516
17+
Updating the database is currently not implemented and will drop the entire database!`,
1618
Schema: map[string]*schema.Schema{
1719
"owner": {
18-
Type: schema.TypeString,
19-
Optional: true,
20+
Type: schema.TypeString,
21+
Optional: true,
22+
Description: "The username of the owner of the database",
2023
},
2124
"name": {
22-
Type: schema.TypeString,
23-
Required: true,
25+
Type: schema.TypeString,
26+
Required: true,
27+
Description: "The name of the database",
2428
},
2529
},
2630
}

mssql/resource_role.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,21 @@ func resourceRole() *schema.Resource {
1212
Read: resourceRoleRead,
1313
Update: resourceRoleUpdate,
1414
Delete: resourceRoleDelete,
15+
Description: `Manage a role
16+
17+
Updating a role is currently not supported and will drop the user.
18+
`,
1519

1620
Schema: map[string]*schema.Schema{
1721
"name": {
18-
Type: schema.TypeString,
19-
Required: true,
22+
Type: schema.TypeString,
23+
Required: true,
24+
Description: "The logon name of the role",
2025
},
2126
"password": {
22-
Type: schema.TypeString,
23-
Required: true,
27+
Type: schema.TypeString,
28+
Required: true,
29+
Description: "The password used by the role",
2430
},
2531
},
2632
}

0 commit comments

Comments
 (0)