Skip to content

Commit

Permalink
COD-3854 - Add terraform documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Antal authored and gregito committed Apr 29, 2024
1 parent 5adb48d commit 5c97724
Show file tree
Hide file tree
Showing 4 changed files with 245 additions and 13 deletions.
119 changes: 111 additions & 8 deletions docs/resources/operational_database.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "cdp_operational_database Resource - terraform-provider-cdp"
subcategory: ""
subcategory: "operational"
description: |-
Creates an Operational DataBase.
---
Expand All @@ -11,7 +10,10 @@ description: |-
Creates an Operational DataBase.

## Example Usage
### Required parameters for Operational Database
Operational Database can be created by providing just the `environment_name` and the desired `database_name`.

Below example uses the most simple configuration.
```terraform
// Copyright 2024 Cloudera. All Rights Reserved.
//
Expand Down Expand Up @@ -39,11 +41,114 @@ provider "cdp" {
resource "cdp_operational_database" "opdb" {
environment_name = "<value>"
database_name = "<value>"
}
```

### Optional parameters
Operational Database can also be created with custom configuration.

// scale_type = "MICRO" // valid options are "MICRO","LIGHT","HEAVY"
// storage_type = "HDFS" // valid options are "CLOUD_WITH_EPHEMERAL","CLOUD","HDFS"
Below example uses every parameter available to configure.

```terraform
// Copyright 2024 Cloudera. All Rights Reserved.
//
// This file is licensed under the Apache License Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
//
// This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, either express or implied. Refer to the License for the specific
// permissions and limitations governing your use of the file.
terraform {
required_providers {
cdp = {
source = "cloudera/cdp"
}
}
}
provider "cdp" {
cdp_config_file = "/Users/<value>/.cdp/config"
cdp_shared_credentials_file = "/Users/<value>/.cdp/credentials"
}
resource "cdp_operational_database" "opdb" {
environment_name = "<value>"
database_name = "<value>"
scale_type = "HEAVY" // valid options are "MICRO","LIGHT","HEAVY"
storage_type = "CLOUD_WITH_EPHEMERAL" // valid options are "CLOUD_WITH_EPHEMERAL","CLOUD","HDFS"
java_version = 8
disable_external_db = true
disable_multi_az = true
subnet_id = "<value>"
num_edge_nodes = 1
auto_scaling_parameters = {
targeted_value_for_metric = 249
max_workers_for_database = 50
max_workers_per_batch = 4
min_workers_for_database = 15
evaluation_period = 2400
minimum_block_cache_gb = 1
# beta only
max_cpu_utilization = -1
max_compute_nodes_for_database = -1
min_compute_nodes_for_database = -1
max_hdfs_usage_percentage = 80
max_regions_per_region_server = 200
}
attached_storage_for_workers = {
volume_count = 3 // min 1 max 8
volume_size = 1024
volume_type = "SSD" // valid options are "HDD", "SSD", "LOCAL_SSD"
}
image = {
id = "<value>"
catalog = "<value>"
}
disable_kerberos = true
disable_jwt_auth = true
enable_grafana = true
custom_user_tags = [
{
key = "key1"
value = "value1"
},
{
key = "key2"
value = "value2"
},
{
key = "key3"
value = "value3"
}
]
enable_region_canary = true
recipes = [
{
names = ["<value>"],
instance_group = "<value>"
},
{
names = ["<value>", "<value>"],
instance_group = "<value>"
}
]
storage_location = "s3a://<value>/"
// num_edge_nodes = 1
}
```

Expand Down Expand Up @@ -141,6 +246,4 @@ Optional:
Required:

- `instance_group` (String) The name of the designated instance group.
- `names` (Set of String) The set of recipe names that are going to be applied on the given instance group.


- `names` (Set of String) The set of recipe names that are going to be applied on the given instance group.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,4 @@ provider "cdp" {
resource "cdp_operational_database" "opdb" {
environment_name = "<value>"
database_name = "<value>"

// scale_type = "MICRO" // valid options are "MICRO","LIGHT","HEAVY"
// storage_type = "HDFS" // valid options are "CLOUD_WITH_EPHEMERAL","CLOUD","HDFS"

// num_edge_nodes = 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
// Copyright 2024 Cloudera. All Rights Reserved.
//
// This file is licensed under the Apache License Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
//
// This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, either express or implied. Refer to the License for the specific
// permissions and limitations governing your use of the file.

terraform {
required_providers {
cdp = {
source = "cloudera/cdp"
}
}
}

provider "cdp" {
cdp_config_file = "/Users/<value>/.cdp/config"
cdp_shared_credentials_file = "/Users/<value>/.cdp/credentials"
}

resource "cdp_operational_database" "opdb" {
environment_name = "<value>"
database_name = "<value>"

scale_type = "HEAVY" // valid options are "MICRO","LIGHT","HEAVY"
storage_type = "CLOUD_WITH_EPHEMERAL" // valid options are "CLOUD_WITH_EPHEMERAL","CLOUD","HDFS"

java_version = 8

disable_external_db = true

disable_multi_az = true
subnet_id = "<value>"

num_edge_nodes = 1

auto_scaling_parameters = {
targeted_value_for_metric = 249
max_workers_for_database = 50
max_workers_per_batch = 4
min_workers_for_database = 15
evaluation_period = 2400
minimum_block_cache_gb = 1
# beta only
max_cpu_utilization = -1
max_compute_nodes_for_database = -1
min_compute_nodes_for_database = -1
max_hdfs_usage_percentage = 80
max_regions_per_region_server = 200
}

attached_storage_for_workers = {
volume_count = 3 // min 1 max 8
volume_size = 1024
volume_type = "SSD" // valid options are "HDD", "SSD", "LOCAL_SSD"
}

image = {
id = "<value>"
catalog = "<value>"
}

disable_kerberos = true
disable_jwt_auth = true

enable_grafana = true

custom_user_tags = [
{
key = "key1"
value = "value1"
},
{
key = "key2"
value = "value2"
},
{
key = "key3"
value = "value3"
}
]

enable_region_canary = true

recipes = [
{
names = ["<value>"],
instance_group = "<value>"
},
{
names = ["<value>", "<value>"],
instance_group = "<value>"
}
]
storage_location = "s3a://<value>/"

}
34 changes: 34 additions & 0 deletions templates/resources/operational_database.md.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}"
subcategory: "{{ index (split .Name "_") 1}}"
description: |-
{{ .Description | plainmarkdown | trimspace | prefixlines " " }}
---

# {{.Name}} ({{.Type}})

{{ .Description | trimspace }}

## Example Usage
### Required parameters for Operational Database
Operational Database can be created by providing just the `environment_name` and the desired `database_name`.

Below example uses the most simple configuration.
{{ tffile "examples/resources/cdp_operational_database/simple/resource.tf" }}

### Optional parameters
Operational Database can also be created with custom configuration.

Below example uses every parameter available to configure.

{{ tffile "examples/resources/cdp_operational_database/with_all_parameters/resource.tf" }}

{{ .SchemaMarkdown | trimspace }}

{{- if .HasImport }}
## Import

Import is supported using the following syntax:

{{codefile "shell" .ImportFile }}
{{- end }}

0 comments on commit 5c97724

Please sign in to comment.