Skip to content

Commit c13ae3b

Browse files
authored
doc: Adds import block syntax and use L2 heading to show in sidebar (#2930)
* chore: Supports running from a directory that doesn't use the conventional naming * chore: Updates docs template import statement to have correct indentation and use `import` block syntax * chore: fix import heading level
1 parent 4344609 commit c13ae3b

18 files changed

+36
-19
lines changed

docs/resources/encryption_at_rest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ Read-Only:
212212

213213
- `valid` (Boolean) Flag that indicates whether the Google Cloud Key Management Service (KMS) encryption key can encrypt and decrypt data.
214214

215-
# Import
215+
## Import
216216
Encryption at Rest Settings can be imported using project ID, in the format `project_id`, e.g.
217217

218218
```

docs/resources/encryption_at_rest_private_endpoint.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ resource "azapi_update_resource" "approval" {
8282
- `private_endpoint_connection_name` (String) Connection name of the Azure Private Endpoint.
8383
- `status` (String) State of the Encryption At Rest private endpoint.
8484

85-
# Import
85+
## Import
8686
Encryption At Rest Private Endpoint resource can be imported using the project ID, cloud provider, and private endpoint ID. The format must be `{project_id}-{cloud_provider}-{private_endpoint_id}` e.g.
8787

8888
```

docs/resources/flex_cluster.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Read-Only:
9090
- `standard` (String) Public connection string that you can use to connect to this cluster. This connection string uses the mongodb:// protocol.
9191
- `standard_srv` (String) Public connection string that you can use to connect to this flex cluster. This connection string uses the `mongodb+srv://` protocol.
9292

93-
# Import
93+
## Import
9494
You can import the Flex Cluster resource by using the Project ID and Flex Cluster name, in the format `PROJECT_ID-FLEX_CLUSTER_NAME`. For example:
9595
```
9696
$ terraform import mongodbatlas_flex_cluster.test 6117ac2fe2a3d04ed27a987v-yourFlexClusterName

docs/resources/mongodb_employee_access_grant.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ output "expiration_time" {
3838

3939
**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.
4040

41-
# Import
41+
## Import
4242
The resource can be imported using project ID and cluster name, in the format `PROJECTID-CLUSTERNAME`, e.g.
4343

4444
```

docs/resources/push_based_log_export.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Optional:
7676
- `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.
7777
- `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).
7878

79-
# Import
79+
## Import
8080
Push-based log export resource can be imported using the project ID, e.g.
8181

8282
```

docs/resources/resource_policy.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,11 @@ Read-Only:
137137
- `id` (String) Unique 24-hexadecimal character string that identifies a user.
138138
- `name` (String) Human-readable label that describes a user.
139139

140-
# Import
140+
## Import
141141
Resource Policy resource can be imported using the org ID and policy ID, in the format `{ORG_ID}-{POLICY_ID}`, e.g.
142142

143143
```
144144
terraform import mongodbatlas_resource_policy.cloud_region 65def6ce0f722a1507105aa5-66f1c018dba9c04e7dcfaf36
145145
```
146+
147+
For more information see: [MongoDB Atlas API - Resource Policies](https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Resource-Policies) Documentation.

docs/resources/search_deployment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Optional:
8989
- `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.
9090
- `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).
9191

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

9595
```

docs/resources/stream_processor.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ Required:
166166
- `connection_name` (String) Name of the connection to write DLQ messages to. Must be an Atlas connection.
167167
- `db` (String) Name of the database to use for the DLQ.
168168

169-
# Import
169+
## Import
170170
Stream Processor resource can be imported using the Project ID, Stream Instance name and Stream Processor name, in the format `INSTANCE_NAME-PROJECT_ID-PROCESSOR_NAME`, e.g.
171171
```
172172
$ terraform import mongodbatlas_stream_processor.test yourInstanceName-6117ac2fe2a3d04ed27a987v-yourProcessorName

scripts/generate-docs-all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export MONGODB_ATLAS_ENABLE_PREVIEW="true"
3434

3535
trap 'rm -R docs-out/' EXIT # temp dir cleanup when script exits
3636

37-
tfplugindocs generate --tf-version "${TF_VERSION}" --website-source-dir "${TEMPLATE_FOLDER_PATH}" --rendered-website-dir "docs-out"
37+
tfplugindocs generate --tf-version "${TF_VERSION}" --website-source-dir "${TEMPLATE_FOLDER_PATH}" --rendered-website-dir "docs-out" --provider-name "mongodbatlas"
3838

3939
printf "\nStarting file move\n\n"
4040

templates/resources.md.tmpl

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,20 @@
6262

6363
{{ if .SchemaMarkdown }}{{ .SchemaMarkdown | trimspace }}{{ end }}
6464

65-
# Import
66-
## Add the import
65+
## Import
66+
67+
{{.Name}} can be imported using the {PLACEHOLDER1} and {PLACEHOLDER2}, in the format `{PLACEHOLDER1}/{PLACEHOLDER2}`, e.g.
68+
69+
**Using `terraform` CLI**
70+
`terraform import mongodbatlas_{{.Name}}.this {PLACEHOLDER1_EXAMPLE}-{PLACEHOLDER2_EXAMPLE}`
71+
72+
or **Using the `import` block syntax:** (Terraform v1.5.0 and later)
73+
74+
```terraform
75+
import {
76+
id = "{PLACEHOLDER1_EXAMPLE}-{PLACEHOLDER2_EXAMPLE}"
77+
to = mongodbatlas_{{.Name}}.this
78+
}
79+
```
6780

6881
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.

0 commit comments

Comments
 (0)