Skip to content

Commit

Permalink
doc: Adjust documentation of search_deployment resource and data sour…
Browse files Browse the repository at this point in the history
…ce (#1833)
  • Loading branch information
andreaangiolillo committed Jan 15, 2024
1 parent b3c5402 commit 8a5ba5f
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 45 deletions.
11 changes: 10 additions & 1 deletion examples/mongodbatlas_search_deployment/main.tf
Expand Up @@ -30,4 +30,13 @@ resource "mongodbatlas_search_deployment" "example" {
node_count = 2
}
]
}
}

data "mongodbatlas_search_deployment" "example" {
project_id = mongodbatlas_search_deployment.example.project_id
cluster_name = mongodbatlas_search_deployment.example.cluster_name
}

output "mongodbatlas_search_deployment_id" {
value = data.mongodbatlas_search_deployment.example.id
}
Expand Up @@ -3,7 +3,7 @@ layout: "mongodbatlas"
page_title: "MongoDB Atlas: {{.Name}}"
subcategory: "docs_{{ .Name }}_{{.Type | lower}}"
description: |-
{{ .Description | trimspace | prefixlines " " }}
"Provides a Search Deployment data source."
---

# {{.Type}}: {{.Name}}
Expand Down
2 changes: 1 addition & 1 deletion templates/resources/search_deployment.html.markdown.tmpl
Expand Up @@ -3,7 +3,7 @@ layout: "mongodbatlas"
page_title: "MongoDB Atlas: {{.Name}}"
subcategory: "docs_{{ .Name }}_{{.Type | lower}}"
description: |-
{{ .Description | trimspace | prefixlines " " }}
"Provides a Search Deployment resource."
---

# {{.Type}}: {{.Name}}
Expand Down
78 changes: 61 additions & 17 deletions website/docs/d/search_deployment.html.markdown
@@ -1,37 +1,81 @@
---
layout: "mongodbatlas"
page_title: "MongoDB Atlas: search deployment"
sidebar_current: "docs-mongodbatlas-datasource-search-deployment"
page_title: "MongoDB Atlas: mongodbatlas_search_deployment"
subcategory: "docs_mongodbatlas_search_deployment_data source"
description: |-
Describes a Search Deployment.
"Provides a Search Deployment data source."
---

# Data Source: mongodbatlas_search_deployment

`mongodbatlas_search_deployment` describes a search node deployment.

## Example Usage

## Example Usages
```terraform
data "mongodbatlas_search_deployment" "test" {
project_id = "<PROJECT_ID>"
cluster_name = "<CLUSTER_NAME>"
resource "mongodbatlas_project" "example" {
name = "project-name"
org_id = var.org_id
}
resource "mongodbatlas_advanced_cluster" "example" {
project_id = mongodbatlas_project.example.id
name = "ClusterExample"
cluster_type = "REPLICASET"
replication_specs {
region_configs {
electable_specs {
instance_size = "M10"
node_count = 3
}
provider_name = "AWS"
priority = 7
region_name = "US_EAST_1"
}
}
}
resource "mongodbatlas_search_deployment" "example" {
project_id = mongodbatlas_project.example.id
cluster_name = mongodbatlas_advanced_cluster.example.name
specs = [
{
instance_size = "S20_HIGHCPU_NVME"
node_count = 2
}
]
}
data "mongodbatlas_search_deployment" "example" {
project_id = mongodbatlas_search_deployment.example.project_id
cluster_name = mongodbatlas_search_deployment.example.cluster_name
}
output "mongodbatlas_search_deployment_id" {
value = data.mongodbatlas_search_deployment.example.id
}
```

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

### Required

- `cluster_name` (String) Label that identifies the cluster to return the search nodes for.
- `project_id` (String) Unique 24-hexadecimal digit string that identifies your project.

* `project_id` - (Required) The unique identifier for the [project](https://docs.atlas.mongodb.com/organizations-projects/#std-label-projects) that contains the specified cluster.
* `cluster_name` - (Required) The name of the cluster containing a search node deployment.
### Read-Only

## Attributes Reference
- `id` (String) Unique 24-hexadecimal digit string that identifies the search deployment.
- `specs` (Attributes List) List of settings that configure the search nodes for your cluster. (see [below for nested schema](#nestedatt--specs))
- `state_name` (String) Human-readable label that indicates the current operating condition of this search deployment.

* `specs` - List of settings that configure the search nodes for your cluster. See [specs](#specs).
* `state_name` - Human-readable label that indicates the current operating condition of this search node deployment.
<a id="nestedatt--specs"></a>
### Nested Schema for `specs`

### Specs
* `instance_size` - (Required) Hardware specification for the search node instance sizes. The [MongoDB Atlas API](https://www.mongodb.com/docs/atlas/reference/api-resources-spec/#tag/Atlas-Search/operation/createAtlasSearchDeployment) describes the valid values. More details can also be found in the [Search Node Documentation](https://www.mongodb.com/docs/atlas/cluster-config/multi-cloud-distribution/#search-tier).
* `node_count` - (Required) Number of search nodes in the cluster.
Read-Only:

- `instance_size` (String) Hardware specification for the search node instance sizes.
- `node_count` (Number) Number of search nodes in the cluster.

For more information see: [MongoDB Atlas API - Search Node](https://www.mongodb.com/docs/atlas/reference/api-resources-spec/#tag/Atlas-Search/operation/createAtlasSearchDeployment) Documentation.
92 changes: 67 additions & 25 deletions website/docs/r/search_deployment.html.markdown
@@ -1,57 +1,99 @@
---
layout: "mongodbatlas"
page_title: "MongoDB Atlas: search deployment"
sidebar_current: "docs-mongodbatlas-resource-search-deployment"
page_title: "MongoDB Atlas: mongodbatlas_search_deployment"
subcategory: "docs_mongodbatlas_search_deployment_resource"
description: |-
Provides a Search Deployment resource.
"Provides a Search Deployment resource."
---

# Resource: mongodbatlas_search_deployment

`mongodbatlas_search_deployment` provides a Search Deployment resource. The resource lets you create, edit and delete dedicated search nodes in a cluster.

-> **NOTE:** For details on supported cloud providers and existing limitations you can visit the [Search Node Documentation](https://www.mongodb.com/docs/atlas/cluster-config/multi-cloud-distribution/#search-nodes-for-workload-isolation).

-> **NOTE:** Only a single search deployment resource can be defined for each cluster.
## Example Usages

```terraform
resource "mongodbatlas_project" "example" {
name = "project-name"
org_id = var.org_id
}
## Example Usage
resource "mongodbatlas_advanced_cluster" "example" {
project_id = mongodbatlas_project.example.id
name = "ClusterExample"
cluster_type = "REPLICASET"
replication_specs {
region_configs {
electable_specs {
instance_size = "M10"
node_count = 3
}
provider_name = "AWS"
priority = 7
region_name = "US_EAST_1"
}
}
}
```terraform
resource "mongodbatlas_search_deployment" "test" {
project_id = "PROJECT ID"
cluster_name = "NAME OF CLUSTER"
resource "mongodbatlas_search_deployment" "example" {
project_id = mongodbatlas_project.example.id
cluster_name = mongodbatlas_advanced_cluster.example.name
specs = [
{
instance_size = "S20_HIGHCPU_NVME"
node_count = 2
node_count = 2
}
]
}
data "mongodbatlas_search_deployment" "example" {
project_id = mongodbatlas_search_deployment.example.project_id
cluster_name = mongodbatlas_search_deployment.example.cluster_name
}
output "mongodbatlas_search_deployment_id" {
value = data.mongodbatlas_search_deployment.example.id
}
```

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

### Required

- `cluster_name` (String) Label that identifies the cluster to return the search nodes for.
- `project_id` (String) Unique 24-hexadecimal character string that identifies the project.
- `specs` (Attributes List) List of settings that configure the search nodes for your cluster. (see [below for nested schema](#nestedatt--specs))

### Optional

- `timeouts` (Attributes) (see [below for nested schema](#nestedatt--timeouts))

### Read-Only

* `project_id` - (Required) Unique 24-hexadecimal digit string that identifies your project.
* `cluster_name` - (Required) Label that identifies the cluster to create search nodes for.
* `specs` - (Required) List of settings that configure the search nodes for your cluster. This list is currently limited to defining a single element. See [specs](#specs).
* `timeouts`- (Optional) The time to wait for search nodes to be created, updated, or deleted. The timeout value is defined by a signed sequence of decimal numbers with a time unit suffix such as: `1h45m`, `300s`, `10m`, .... The valid time units are: `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`. The attribute must be defined with [nested attributes](https://developer.hashicorp.com/terraform/plugin/framework/resources/timeouts#attribute). The default timeout for create, update, and delete is `3h`. Learn more about timeouts [here](https://developer.hashicorp.com/terraform/plugin/framework/resources/timeouts).
- `id` (String) Unique 24-hexadecimal digit string that identifies the search deployment.
- `state_name` (String) Human-readable label that indicates the current operating condition of this search deployment.

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

Specs list is defined as a ["list nested attribute"](https://developer.hashicorp.com/terraform/plugin/framework/handling-data/attributes/list-nested) containing a single element.
Required:

* `instance_size` - (Required) Hardware specification for the search node instance sizes. The [MongoDB Atlas API](https://www.mongodb.com/docs/atlas/reference/api-resources-spec/#tag/Atlas-Search/operation/createAtlasSearchDeployment) describes the valid values. More details can also be found in the [Search Node Documentation](https://www.mongodb.com/docs/atlas/cluster-config/multi-cloud-distribution/#search-tier).
* `node_count` - (Required) Number of search nodes in the cluster.
- `instance_size` (String) Hardware specification for the search node instance sizes.
- `node_count` (Number) Number of search nodes in the cluster.

## Attributes Reference

In addition to all arguments above, the following attributes are exported:
<a id="nestedatt--timeouts"></a>
### Nested Schema for `timeouts`

* `state_name` - Human-readable label that indicates the current operating condition of this search node deployment.
Optional:

## Import
- `create` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
- `delete` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
- `update` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).

# Import
Search node resource can be imported using the project ID and cluster name, in the format `PROJECT_ID-CLUSTER_NAME`, e.g.

```
Expand Down

0 comments on commit 8a5ba5f

Please sign in to comment.