Skip to content

Commit

Permalink
Include examples in the generated docs (#181)
Browse files Browse the repository at this point in the history
Previously, examples were not included in the documentation.  This was
because the naming scheme for the example files did not match was was
expected by the tf provider framework.  The files are now renamed to the
correct convention and the docs regenerated.
  • Loading branch information
fantapop authored Mar 11, 2024
1 parent 6b329bb commit 7f94a9d
Show file tree
Hide file tree
Showing 39 changed files with 324 additions and 13 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Renamed example files to the correct name so they are automatically included
in the docs.

## [1.3.1] - 2023-12-01

### Fixed
Expand Down
10 changes: 10 additions & 0 deletions docs/data-sources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@ description: |-

CockroachDB Cloud cluster. Can be Dedicated or Serverless.

## Example Usage

```terraform
variable "cluster_id" {
type = string
}
data "cockroach_cluster" "cockroach" {
id = var.cluster_id
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
10 changes: 10 additions & 0 deletions docs/data-sources/cluster_cert.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,17 @@ TLS certificate for the specified CockroachDB cluster. Certificates for dedicate

Serverless clusters use the root PostgreSQL CA cert. If it isn't already installed, the certificate can be appended to `$HOME/.postgresql/root.crt` on MacOS or Linux, or `$env:appdata\postgresql\root.crt` on Windows.

## Example Usage

```terraform
variable "cluster_id" {
type = string
}
data "cockroach_cluster_cert" "cockroach" {
id = var.cluster_id
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
37 changes: 36 additions & 1 deletion docs/data-sources/connection_string.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,42 @@ description: |-

Generic connection string for a cluster.


## Example Usage

```terraform
variable "cluster_id" {
type = string
}
variable "sql_user_name" {
type = string
nullable = true
}
variable "sql_user_password" {
type = string
sensitive = true
nullable = true
}
variable "database" {
type = string
nullable = true
}
variable "os" {
type = string
nullable = true
}
data "cockroach_connection_string" "cockroach" {
id = var.cluster_id
sql_user = var.sql_user_name
password = var.sql_user_password
database = var.database
os = var.os
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
10 changes: 10 additions & 0 deletions docs/data-sources/person_user.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@ description: |-

Information about an individual user.

## Example Usage

```terraform
variable "email_address" {
type = string
}
data "cockroach_person_user" "cockroach" {
email = var.email_address
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
23 changes: 22 additions & 1 deletion docs/resources/api_oidc_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,28 @@ description: |-

Configuration to allow external OIDC providers to issue tokens for use with CC API.


## Example Usage

```terraform
resource "cockroach_api_oidc_config" "example" {
issuer = "https://accounts.google.com"
audience = "test_audience"
jwks = "{\"keys\":[{\"alg\":\"RS256\",\"e\":\"AQAB\",\"kid\":\"test_kid1\",\"kty\":\"RSA\",\"n\":\"09lq1lCEuteonwDJOhGTDak11ThplZuC9JEWQNdBnBSQwlkJQIE7A7nTBO0xTibcsh2HwYkC-N_Gs1jP4iwN3dRqnu5FwG2ct5mY8KLwJiHzToFC0MKenSFQCy0FviNtOnpiObcUlDvR2NDeNtMl_6SPzcQEt7GUTBBYZgoAxPmOgevki6ZNO6Y86xFqx3y6v8EPwW010AiC60r4AHGCTBhYF4uqmq5JH2UU4dDh9Udc-9LZxlSqPwJvnKDG2GjcnD8TsU3wjfEM_nRmx3dnXsrZUXYfNGtdv5dlHywf5AhkJmTavqcsJkgrNA-PNBghFMcCR816_kCIkCYWLWC5vQ\"}]}"
claim = "sub"
identity_map = [
{
token_identity = "token_identity"
cc_identity = "cc_identity"
is_regex = false
},
{
token_identity = "(.*)"
cc_identity = "\\[email protected]"
is_regex = true
},
]
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
13 changes: 12 additions & 1 deletion docs/resources/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@ description: |-

CockroachDB database.


## Example Usage

```terraform
variable "cluster_id" {
type = string
}
resource "cockroach_database" "cockroach" {
name = "example-database"
cluster_id = var.cluster_id
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
17 changes: 16 additions & 1 deletion docs/resources/finalize_version_upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,22 @@ description: |-

Utility resource that represents the one-time action of finalizing a cluster's pending CockroachDB version upgrade.


## Example Usage

```terraform
variable "cluster_id" {
type = string
}
variable "cockroach_version" {
type = string
}
resource "cockroach_finalize_version_upgrade" "cockroach" {
id = var.cluster_id
cockroach_version = var.cockroach_version
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
9 changes: 8 additions & 1 deletion docs/resources/folder.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ description: |-

CockroachDB Cloud folder.


## Example Usage

```terraform
resource "cockroach_folder" "cockroach" {
name = "example-folder"
parent_id = "root"
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
33 changes: 32 additions & 1 deletion docs/resources/log_export_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,38 @@ description: |-

Log Export configuration for a cluster.


## Example Usage

```terraform
variable "cluster_id" {
type = string
}
variable "auth_principal" {
type = string
}
resource "cockroach_log_export_config" "example" {
id = var.cluster_id
auth_principal = var.auth_principal
log_name = "example"
type = "GCP_CLOUD_LOGGING"
redact = true
groups = [
{
log_name : "sql",
channels : ["SQL_SCHEMA", "SQL_EXEC"],
redact : false
},
{
log_name : "devops",
channels : ["OPS", "HEALTH", "STORAGE"]
min_level : "WARNING"
}
]
omitted_channels = ["SQL_PERF"]
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
26 changes: 25 additions & 1 deletion docs/resources/maintenance_window.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,31 @@ description: |-

Maintenance window configuration for a cluster.


## Example Usage

```terraform
variable "cluster_id" {
type = string
}
variable "offset_duration" {
type = number
# 2 days, i.e. window starts at WED 00:00 UTC.
default = 172800
}
variable "window_duration" {
type = number
# 6 hours.
default = 21600
}
resource "cockroach_maintenance_window" "example" {
id = var.cluster_id
offset_duration = var.offset_duration
window_duration = var.window_duration
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
29 changes: 28 additions & 1 deletion docs/resources/metric_export_cloudwatch_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,34 @@ description: |-

Amazon CloudWatch metric export configuration for a cluster.


## Example Usage

```terraform
variable "cluster_id" {
type = string
nullable = false
}
variable "role_arn" {
type = string
nullable = false
}
variable "log_group_name" {
type = string
}
variable "aws_region" {
type = string
}
resource "cockroach_metric_export_cloudwatch_config" "example" {
id = var.cluster_id
role_arn = var.role_arn
log_group_name = var.log_group_name
target_region = var.aws_region
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
25 changes: 24 additions & 1 deletion docs/resources/metric_export_datadog_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,30 @@ description: |-

DataDog metric export configuration for a cluster.


## Example Usage

```terraform
variable "cluster_id" {
type = string
}
variable "datadog_site" {
type = string
nullable = false
}
variable "datadog_api_key" {
type = string
nullable = false
sensitive = true
}
resource "cockroach_metric_export_datadog_config" "example" {
id = var.cluster_id
site = var.datadog_site
api_key = var.datadog_api_key
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
10 changes: 10 additions & 0 deletions docs/resources/private_endpoint_services.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@ description: |-

PrivateEndpointServices contains services that allow for VPC communication, either via PrivateLink (AWS) or Peering (GCP).

## Example Usage

```terraform
variable "cluster_id" {
type = string
}
resource "cockroach_private_endpoint_services" "cockroach" {
cluster_id = var.cluster_id
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
14 changes: 13 additions & 1 deletion docs/resources/private_endpoint_trusted_owner.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,19 @@ description: |-

Private Endpoint Trusted Owner.


## Example Usage

```terraform
variable "cluster_id" {
type = string
}
resource "cockroach_private_endpoint_trusted_owner" "example" {
cluster_id = var.cluster_id
type = "AWS_ACCOUNT_ID"
external_owner_id = "012345678901"
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
Loading

0 comments on commit 7f94a9d

Please sign in to comment.