Skip to content

Commit

Permalink
Support docs for terraform cloud provider (#14)
Browse files Browse the repository at this point in the history
* Generate docs for cloud provider
* Update pool, poolnamespace and location desc
  • Loading branch information
tuteng authored Jan 11, 2024
1 parent 13b2198 commit a36c0b4
Show file tree
Hide file tree
Showing 12 changed files with 289 additions and 53 deletions.
13 changes: 1 addition & 12 deletions cloud/data_source_pulsar_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,43 +84,36 @@ func dataSourcePulsarCluster() *schema.Resource {
},
"config": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MinItems: 0,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"websocket_enabled": {
Type: schema.TypeBool,
Optional: true,
Computed: true,
},
"function_enabled": {
Type: schema.TypeBool,
Optional: true,
Computed: true,
Description: descriptions["function_enabled"],
},
"transaction_enabled": {
Type: schema.TypeBool,
Optional: true,
Computed: true,
Description: descriptions["transaction_enabled"],
},
"protocols": {
Type: schema.TypeList,
Optional: true,
Computed: true,
Description: descriptions["protocols"],
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"kafka": {
Type: schema.TypeMap,
Optional: true,
Computed: true,
Description: descriptions["kafka"],
},
"mqtt": {
Type: schema.TypeMap,
Optional: true,
Computed: true,
Description: descriptions["mqtt"],
},
Expand All @@ -129,16 +122,13 @@ func dataSourcePulsarCluster() *schema.Resource {
},
"audit_log": {
Type: schema.TypeList,
Optional: true,
Computed: true,
Description: descriptions["audit_log"],
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"categories": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MinItems: 1,
Description: descriptions["categories"],
Elem: &schema.Schema{
Type: schema.TypeString,
Expand All @@ -150,7 +140,6 @@ func dataSourcePulsarCluster() *schema.Resource {
},
"custom": {
Type: schema.TypeMap,
Optional: true,
Computed: true,
Description: descriptions["custom"],
},
Expand Down
2 changes: 0 additions & 2 deletions cloud/data_source_service_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,11 @@ func dataSourceServiceAccount() *schema.Resource {
},
"admin": {
Type: schema.TypeBool,
Optional: true,
Description: descriptions["admin"],
Computed: true,
},
"private_key_data": {
Type: schema.TypeString,
Optional: true,
Description: descriptions["private_key_data"],
Computed: true,
},
Expand Down
21 changes: 11 additions & 10 deletions cloud/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,17 @@ var descriptions map[string]string

func init() {
descriptions = map[string]string{
"key_file_path": "The path of the private key file",
"organization": "The organization name",
"name": "The service account name",
"admin": "Whether the service account is admin",
"private_key_data": "The private key data",
"availability-mode": "The availability mode, supporting 'zonal' and 'regional'",
"pool_name": "The infrastructure pool name to use.",
"pool_namespace": "The infrastructure pool namespace to use",
"instance_name": "The pulsar instance name",
"location": "The location of the pulsar cluster",
"key_file_path": "The path of the private key file",
"organization": "The organization name",
"name": "The service account name",
"admin": "Whether the service account is admin",
"private_key_data": "The private key data",
"availability-mode": "The availability mode, supporting 'zonal' and 'regional'",
"pool_name": "The infrastructure pool name to use, supported pool 'shared-aws', 'shared-gcp'",
"pool_namespace": "The infrastructure pool namespace to use, supported 'streamnative'",
"instance_name": "The pulsar instance name",
"location": "The location of the pulsar cluster, " +
"supported location https://docs.streamnative.io/docs/cluster#cluster-location",
"bookie_replicas": "The number of bookie replicas",
"broker_replicas": "The number of broker replicas",
"compute_unit": "compute unit, 1 compute unit is 2 cpu and 8gb memory",
Expand Down
1 change: 0 additions & 1 deletion cloud/resource_service_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ func resourceServiceAccount() *schema.Resource {
},
"private_key_data": {
Type: schema.TypeString,
Optional: true,
Description: descriptions["private_key_data"],
Computed: true,
},
Expand Down
70 changes: 70 additions & 0 deletions docs/data-sources/pulsar_cluster.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "streamnative_pulsar_cluster Data Source - terraform-provider-streamnative"
subcategory: ""
description: |-
---

# streamnative_pulsar_cluster (Data Source)





<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) The service account name
- `organization` (String) The organization name

### Read-Only

- `bookie_replicas` (Number) The number of bookie replicas
- `bookkeeper_version` (String) The version of the bookkeeper cluster
- `broker_replicas` (Number) The number of broker replicas
- `compute_unit` (Number) compute unit, 1 compute unit is 2 cpu and 8gb memory
- `config` (List of Object) (see [below for nested schema](#nestedatt--config))
- `http_tls_service_url` (String) The service url of the pulsar cluster, use it to management the pulsar cluster
- `id` (String) The ID of this resource.
- `instance_name` (String) The pulsar instance name
- `kafka_service_url` (String) If you want to connect to the pulsar cluster using the kafka protocol, use this kafka service url
- `location` (String) The location of the pulsar cluster, supported location https://docs.streamnative.io/docs/cluster#cluster-location
- `mqtt_service_url` (String) If you want to connect to the pulsar cluster using the mqtt protocol, use this mqtt service url
- `pulsar_tls_service_url` (String) The service url of the pulsar cluster, use it to produce and consume message
- `pulsar_version` (String) The version of the pulsar cluster
- `ready` (String) Pulsar cluster is ready, it will be set to 'True' after the cluster is ready
- `storage_unit` (Number) storage unit, 1 storage unit is 2 cpu and 8gb memory
- `websocket_service_url` (String) If you want to connect to the pulsar cluster using the websocket protocol, use this websocket service url

<a id="nestedatt--config"></a>
### Nested Schema for `config`

Read-Only:

- `audit_log` (List of Object) (see [below for nested schema](#nestedobjatt--config--audit_log))
- `custom` (Map of String)
- `function_enabled` (Boolean)
- `protocols` (List of Object) (see [below for nested schema](#nestedobjatt--config--protocols))
- `transaction_enabled` (Boolean)
- `websocket_enabled` (Boolean)

<a id="nestedobjatt--config--audit_log"></a>
### Nested Schema for `config.audit_log`

Read-Only:

- `categories` (List of String)


<a id="nestedobjatt--config--protocols"></a>
### Nested Schema for `config.protocols`

Read-Only:

- `kafka` (Map of String)
- `mqtt` (Map of String)


31 changes: 31 additions & 0 deletions docs/data-sources/pulsar_instance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "streamnative_pulsar_instance Data Source - terraform-provider-streamnative"
subcategory: ""
description: |-
---

# streamnative_pulsar_instance (Data Source)





<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) The service account name
- `organization` (String) The organization name

### Read-Only

- `availability_mode` (String) The availability mode, supporting 'zonal' and 'regional'
- `id` (String) The ID of this resource.
- `pool_name` (String) The infrastructure pool name to use, supported pool 'shared-aws', 'shared-gcp'
- `pool_namespace` (String) The infrastructure pool namespace to use, supported 'streamnative'
- `ready` (String) Pulsar instance is ready, it will be set to 'True' after the instance is ready


32 changes: 32 additions & 0 deletions docs/data-sources/service_account.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "streamnative_service_account Data Source - terraform-provider-streamnative"
subcategory: ""
description: |-
---

# streamnative_service_account (Data Source)





<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `organization` (String) The organization name

### Optional

- `name` (String) The service account name

### Read-Only

- `admin` (Boolean) Whether the service account is admin
- `id` (String) The ID of this resource.
- `private_key_data` (String) The private key data


34 changes: 8 additions & 26 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,20 @@
---
page_title: "Provider: StreamNative"
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "streamnative Provider"
subcategory: ""
description: |-
---

# StreamNative Provider
# streamnative Provider

Simplify Apache Pulsar Terraform deployment with the StreamNative Terraform Provider. Manage Pulsar Instances, Pulsar Clusters, Service Accounts, and more in StreamNative.

Use the StreamNative provider to deploy and manage [StreamNative Cloud](https://console.streamnative.cloud) infrastructure. You must provide appropriate credentials to use the provider. The navigation menu provides details about the resources that you can interact with (_Resources_), and a guide (_Guides_) for how you can get started.

## Example Usage

```hcl
terraform {
required_providers {
pulsar = {
version = "0.1.0"
source = "registry.terraform.io/streamnative/streamnative"
}
}
}
```

[Add example]
<!-- schema generated by tfplugindocs -->
## Schema

## Enable StreamNative Cloud Access
### Required

[Document how to enable StreamNative Cloud Access]

## Provider Authentication

StreamNative Terraform provider allows authentication by using ...

## Helpful Links/Information

* [Report Bugs](https://github.com/streamnative/terraform-provider-streamnative/issues)
- `key_file_path` (String) The path of the private key file
73 changes: 73 additions & 0 deletions docs/resources/pulsar_cluster.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "streamnative_pulsar_cluster Resource - terraform-provider-streamnative"
subcategory: ""
description: |-
---

# streamnative_pulsar_cluster (Resource)





<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `instance_name` (String) The pulsar instance name
- `location` (String) The location of the pulsar cluster, supported location https://docs.streamnative.io/docs/cluster#cluster-location
- `name` (String) The service account name
- `organization` (String) The organization name

### Optional

- `bookie_replicas` (Number) The number of bookie replicas
- `broker_replicas` (Number) The number of broker replicas
- `compute_unit` (Number) compute unit, 1 compute unit is 2 cpu and 8gb memory
- `config` (Block List) (see [below for nested schema](#nestedblock--config))
- `storage_unit` (Number) storage unit, 1 storage unit is 2 cpu and 8gb memory

### Read-Only

- `bookkeeper_version` (String) The version of the bookkeeper cluster
- `http_tls_service_url` (String) The service url of the pulsar cluster, use it to management the pulsar cluster
- `id` (String) The ID of this resource.
- `kafka_service_url` (String) If you want to connect to the pulsar cluster using the kafka protocol, use this kafka service url
- `mqtt_service_url` (String) If you want to connect to the pulsar cluster using the mqtt protocol, use this mqtt service url
- `pulsar_tls_service_url` (String) The service url of the pulsar cluster, use it to produce and consume message
- `pulsar_version` (String) The version of the pulsar cluster
- `ready` (String) Pulsar cluster is ready, it will be set to 'True' after the cluster is ready
- `websocket_service_url` (String) If you want to connect to the pulsar cluster using the websocket protocol, use this websocket service url

<a id="nestedblock--config"></a>
### Nested Schema for `config`

Optional:

- `audit_log` (Block List) (see [below for nested schema](#nestedblock--config--audit_log))
- `custom` (Map of String) Controls the custom config of pulsar cluster
- `function_enabled` (Boolean) Whether the function is enabled
- `protocols` (Block List) (see [below for nested schema](#nestedblock--config--protocols))
- `transaction_enabled` (Boolean) Whether the transaction is enabled
- `websocket_enabled` (Boolean)

<a id="nestedblock--config--audit_log"></a>
### Nested Schema for `config.audit_log`

Optional:

- `categories` (List of String) Controls the audit log categories config of pulsar cluster, supported categories: "Management", "Describe", "Produce", "Consume"


<a id="nestedblock--config--protocols"></a>
### Nested Schema for `config.protocols`

Optional:

- `kafka` (Map of String) Controls the kafka protocol config of pulsar cluster
- `mqtt` (Map of String) Controls the mqtt protocol config of pulsar cluster


Loading

0 comments on commit a36c0b4

Please sign in to comment.