Skip to content

Commit 3d92da0

Browse files
doc: Adds documentation for new encryption_at_rest_private_endpoint resource and data sources (#2547)
* adding documentation for encryption_at_rest_private_endpoint resource and data sources * align generated docs * minor typo fix * Adjust description of project_id to make it more concise * align note stating feature is available by request as defined in general docs
1 parent 8d3324a commit 3d92da0

15 files changed

+261
-14
lines changed

.github/workflows/code-health.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,13 @@ jobs:
7070
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
7171
- run: make tools # all resources with auto-generated doc must be specified below here
7272
- name: Doc for control_plane_ip_addresses
73-
run: export resource_name=control_plane_ip_addresses && make generate-doc
73+
run: make generate-doc resource_name=control_plane_ip_addresses
7474
- name: Doc for push_based_log_export
75-
run: export resource_name=push_based_log_export && make generate-doc
75+
run: make generate-doc resource_name=push_based_log_export
7676
- name: Doc for search_deployment
77-
run: export resource_name=search_deployment && make generate-doc
77+
run: make generate-doc resource_name=search_deployment
78+
- name: Doc for encryption_at_rest_private_endpoint
79+
run: make generate-doc resource_name=encryption_at_rest_private_endpoint
7880
- name: Find mutations
7981
id: self_mutation
8082
run: |-

GNUmakefile

+4-2
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,10 @@ scaffold-schemas:
123123

124124

125125
.PHONY: generate-doc
126-
generate-doc: ## Generate the resource documentation via tfplugindocs
127-
./scripts/generate-doc.sh ${resource_name}
126+
# e.g. run: make generate-doc resource_name=search_deployment
127+
# generate the resource documentation via tfplugindocs
128+
generate-doc:
129+
@scripts/generate-doc.sh ${resource_name}
128130

129131
.PHONY: update-tf-compatibility-matrix
130132
update-tf-compatibility-matrix: ## Update Terraform Compatibility Matrix documentation

contributing/documentation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ We autogenerate the documentation of our provider resources and data sources via
1212
- Add the resource/data source templates to the [templates](https://github.com/mongodb/terraform-provider-mongodbatlas/blob/master/templates) folder. See [README.md](https://github.com/mongodb/terraform-provider-mongodbatlas/blob/master/templates/README.md) for more info.
1313
- Run the Makefile command `generate-doc`
1414
```bash
15-
export resource_name=search_deployment && make generate-doc
15+
make generate-doc resource_name=search_deployment
1616
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Data Source: mongodbatlas_encryption_at_rest_private_endpoint
2+
3+
`mongodbatlas_encryption_at_rest_private_endpoint` describes a private endpoint used for encryption at rest using customer-managed keys.
4+
5+
## Example Usages
6+
7+
```terraform
8+
data "mongodbatlas_encryption_at_rest_private_endpoint" "single" {
9+
project_id = var.atlas_project_id
10+
cloud_provider = "AZURE"
11+
id = mongodbatlas_encryption_at_rest_private_endpoint.endpoint.id
12+
}
13+
14+
output "endpoint_connection_name" {
15+
value = data.mongodbatlas_encryption_at_rest_private_endpoint.single.private_endpoint_connection_name
16+
}
17+
```
18+
19+
<!-- schema generated by tfplugindocs -->
20+
## Schema
21+
22+
### Required
23+
24+
- `cloud_provider` (String) Label that identifies the cloud provider of the private endpoint.
25+
- `id` (String) Unique 24-hexadecimal digit string that identifies the Private Endpoint Service.
26+
- `project_id` (String) Unique 24-hexadecimal digit string that identifies your project.
27+
28+
### Read-Only
29+
30+
- `error_message` (String) Error message for failures associated with the Encryption At Rest private endpoint.
31+
- `private_endpoint_connection_name` (String) Connection name of the Azure Private Endpoint.
32+
- `region_name` (String) Cloud provider region in which the Encryption At Rest private endpoint is located.
33+
- `status` (String) State of the Encryption At Rest private endpoint.
34+
35+
For more information see:
36+
- [MongoDB Atlas API - Private Endpoint for Encryption at Rest Using Customer Key Management](https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Encryption-at-Rest-using-Customer-Key-Management/operation/getEncryptionAtRestPrivateEndpoint) Documentation.
37+
- [Manage Customer Keys with Azure Key Vault Over Private Endpoints](https://www.mongodb.com/docs/atlas/security/azure-kms-over-private-endpoint/).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Data Source: mongodbatlas_encryption_at_rest_private_endpoints
2+
3+
`mongodbatlas_encryption_at_rest_private_endpoints` describes private endpoints of a particular cloud provider used for encryption at rest using customer-managed keys.
4+
5+
## Example Usages
6+
7+
```terraform
8+
data "mongodbatlas_encryption_at_rest_private_endpoints" "plural" {
9+
project_id = var.atlas_project_id
10+
cloud_provider = "AZURE"
11+
}
12+
13+
output "number_of_endpoints" {
14+
value = length(data.mongodbatlas_encryption_at_rest_private_endpoints.plural.results)
15+
}
16+
```
17+
18+
<!-- schema generated by tfplugindocs -->
19+
## Schema
20+
21+
### Required
22+
23+
- `cloud_provider` (String) Human-readable label that identifies the cloud provider for the private endpoints to return.
24+
- `project_id` (String) Unique 24-hexadecimal digit string that identifies your project.
25+
26+
### Read-Only
27+
28+
- `results` (Attributes List) List of returned documents that MongoDB Cloud providers when completing this request. (see [below for nested schema](#nestedatt--results))
29+
30+
<a id="nestedatt--results"></a>
31+
### Nested Schema for `results`
32+
33+
Read-Only:
34+
35+
- `cloud_provider` (String) Label that identifies the cloud provider of the private endpoint.
36+
- `error_message` (String) Error message for failures associated with the Encryption At Rest private endpoint.
37+
- `id` (String) Unique 24-hexadecimal digit string that identifies the Private Endpoint Service.
38+
- `private_endpoint_connection_name` (String) Connection name of the Azure Private Endpoint.
39+
- `project_id` (String) Unique 24-hexadecimal digit string that identifies your project.
40+
- `region_name` (String) Cloud provider region in which the Encryption At Rest private endpoint is located.
41+
- `status` (String) State of the Encryption At Rest private endpoint.
42+
43+
For more information see:
44+
- [MongoDB Atlas API - Private Endpoint for Encryption at Rest Using Customer Key Management](https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Encryption-at-Rest-using-Customer-Key-Management/operation/getEncryptionAtRestPrivateEndpointsForCloudProvider) Documentation.
45+
- [Manage Customer Keys with Azure Key Vault Over Private Endpoints](https://www.mongodb.com/docs/atlas/security/azure-kms-over-private-endpoint/).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Resource: mongodbatlas_encryption_at_rest_private_endpoint
2+
3+
`mongodbatlas_encryption_at_rest_private_endpoint` provides a resource for managing a private endpoint used for encryption at rest with customer-managed keys. This ensures all traffic between Atlas and customer key management systems take place over private network interfaces.
4+
5+
~> **IMPORTANT** The Encryption at Rest using Azure Key Vault over Private Endpoints feature is available by request. To request this functionality for you Atlas deployments, contact your Account Manager.
6+
Additionally, you'll need to set the environment variable `MONGODB_ATLAS_ENABLE_PREVIEW=true` to use this resource. To learn more about existing limitations, see the [Manage Customer Keys with Azure Key Vault Over Private Endpoints](https://www.mongodb.com/docs/atlas/security/azure-kms-over-private-endpoint/#manage-customer-keys-with-azure-key-vault-over-private-endpoints).
7+
8+
-> **NOTE:** Only Azure Key Vault with Azure Private Link is supported at this time.
9+
10+
## Example Usages
11+
12+
### Configuring Atlas Encryption at Rest using Azure Key Vault with Azure Private Link
13+
14+
```terraform
15+
resource "mongodbatlas_encryption_at_rest" "ear" {
16+
project_id = var.atlas_project_id
17+
18+
azure_key_vault_config {
19+
require_private_networking = true
20+
21+
enabled = true
22+
azure_environment = "AZURE"
23+
24+
tenant_id = var.azure_tenant_id
25+
subscription_id = var.azure_subscription_id
26+
client_id = var.azure_client_id
27+
secret = var.azure_client_secret
28+
29+
resource_group_name = var.azure_resource_group_name
30+
key_vault_name = var.azure_key_vault_name
31+
key_identifier = var.azure_key_identifier
32+
}
33+
}
34+
35+
# Creates private endpoint
36+
resource "mongodbatlas_encryption_at_rest_private_endpoint" "endpoint" {
37+
project_id = mongodbatlas_encryption_at_rest.ear.project_id
38+
cloud_provider = "AZURE"
39+
region_name = var.azure_region_name
40+
}
41+
42+
locals {
43+
key_vault_resource_id = "/subscriptions/${var.azure_subscription_id}/resourceGroups/${var.azure_resource_group_name}/providers/Microsoft.KeyVault/vaults/${var.azure_key_vault_name}"
44+
}
45+
46+
# Approves private endpoint connection from Azure Key Vault
47+
resource "azapi_update_resource" "approval" {
48+
type = "Microsoft.KeyVault/Vaults/PrivateEndpointConnections@2023-07-01"
49+
name = mongodbatlas_encryption_at_rest_private_endpoint.endpoint.private_endpoint_connection_name
50+
parent_id = local.key_vault_resource_id
51+
52+
body = jsonencode({
53+
properties = {
54+
privateLinkServiceConnectionState = {
55+
description = "Approved via Terraform"
56+
status = "Approved"
57+
}
58+
}
59+
})
60+
}
61+
```
62+
63+
<!-- schema generated by tfplugindocs -->
64+
## Schema
65+
66+
### Required
67+
68+
- `cloud_provider` (String) Label that identifies the cloud provider for the Encryption At Rest private endpoint.
69+
- `project_id` (String) Unique 24-hexadecimal digit string that identifies your project.
70+
- `region_name` (String) Cloud provider region in which the Encryption At Rest private endpoint is located.
71+
72+
### Read-Only
73+
74+
- `error_message` (String) Error message for failures associated with the Encryption At Rest private endpoint.
75+
- `id` (String) Unique 24-hexadecimal digit string that identifies the Private Endpoint Service.
76+
- `private_endpoint_connection_name` (String) Connection name of the Azure Private Endpoint.
77+
- `status` (String) State of the Encryption At Rest private endpoint.
78+
79+
# Import
80+
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.
81+
82+
```
83+
$ terraform import mongodbatlas_encryption_at_rest_private_endpoint.test 650972848269185c55f40ca1-AZURE-650972848269185c55f40ca2
84+
```
85+
86+
For more information see:
87+
- [MongoDB Atlas API - Private Endpoint for Encryption at Rest Using Customer Key Management](https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Encryption-at-Rest-using-Customer-Key-Management/operation/getEncryptionAtRestPrivateEndpoint) Documentation.
88+
- [Manage Customer Keys with Azure Key Vault Over Private Endpoints](https://www.mongodb.com/docs/atlas/security/azure-kms-over-private-endpoint/).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
data "mongodbatlas_encryption_at_rest_private_endpoints" "plural" {
2+
project_id = var.atlas_project_id
3+
cloud_provider = "AZURE"
4+
}
5+
6+
output "number_of_endpoints" {
7+
value = length(data.mongodbatlas_encryption_at_rest_private_endpoints.plural.results)
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
data "mongodbatlas_encryption_at_rest_private_endpoint" "single" {
2+
project_id = var.atlas_project_id
3+
cloud_provider = "AZURE"
4+
id = mongodbatlas_encryption_at_rest_private_endpoint.endpoint.id
5+
}
6+
7+
output "endpoint_connection_name" {
8+
value = data.mongodbatlas_encryption_at_rest_private_endpoint.single.private_endpoint_connection_name
9+
}

internal/service/encryptionatrestprivateendpoint/data_source_schema.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ func DSAttributes(withArguments bool) map[string]schema.Attribute {
2828
"project_id": schema.StringAttribute{
2929
Required: withArguments,
3030
Computed: !withArguments,
31-
Description: "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access.\n\n**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.",
32-
MarkdownDescription: "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access.\n\n**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.",
31+
Description: "Unique 24-hexadecimal digit string that identifies your project.",
32+
MarkdownDescription: "Unique 24-hexadecimal digit string that identifies your project.",
3333
},
3434
"id": schema.StringAttribute{
3535
Required: withArguments,

internal/service/encryptionatrestprivateendpoint/pural_data_source_schema.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ func PluralDataSourceSchema(ctx context.Context) schema.Schema {
1212
Attributes: map[string]schema.Attribute{
1313
"cloud_provider": schema.StringAttribute{
1414
Required: true,
15-
Description: "Human-readable label that identifies the cloud provider for the private endpoints to return.",
15+
Description: "Label that identifies the cloud provider for the private endpoints to return.",
1616
MarkdownDescription: "Human-readable label that identifies the cloud provider for the private endpoints to return.",
1717
},
1818
"project_id": schema.StringAttribute{
1919
Required: true,
20-
Description: "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access.\n\n**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.",
21-
MarkdownDescription: "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access.\n\n**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.",
20+
Description: "Unique 24-hexadecimal digit string that identifies your project.",
21+
MarkdownDescription: "Unique 24-hexadecimal digit string that identifies your project.",
2222
},
2323
"results": schema.ListNestedAttribute{
2424
NestedObject: schema.NestedAttributeObject{
25-
Attributes: DSAttributes(true),
25+
Attributes: DSAttributes(false),
2626
},
2727
Computed: true,
2828
Description: "List of returned documents that MongoDB Cloud providers when completing this request.",

internal/service/encryptionatrestprivateendpoint/resource_schema.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ func ResourceSchema(ctx context.Context) schema.Schema {
2222
},
2323
"project_id": schema.StringAttribute{
2424
Required: true,
25-
Description: "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access.\n\n**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.",
26-
MarkdownDescription: "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access.\n\n**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.",
25+
Description: "Unique 24-hexadecimal digit string that identifies your project.",
26+
MarkdownDescription: "Unique 24-hexadecimal digit string that identifies your project.",
2727
},
2828
"id": schema.StringAttribute{
2929
Computed: true,

scripts/generate-doc.sh

+3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ if [ ! -f "${TEMPLATE_FOLDER_PATH}/data-sources/${resource_name}s.md.tmpl" ]; th
6767
printf "Skipping this check: We assume that the resource does not have a plural data source.\n\n"
6868
fi
6969

70+
# ensure preview resource and data sources are also included during generation
71+
export MONGODB_ATLAS_ENABLE_PREVIEW="true"
72+
7073
tfplugindocs generate --tf-version "${TF_VERSION}" --website-source-dir "${TEMPLATE_FOLDER_PATH}" --rendered-website-dir "docs-out"
7174

7275
if [ ! -f "docs-out/resources/${resource_name}.md" ]; then
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# {{.Type}}: {{.Name}}
2+
3+
`{{.Name}}` describes a private endpoint used for encryption at rest using customer-managed keys.
4+
5+
## Example Usages
6+
7+
{{ tffile (printf "examples/%s/azure/singular-data-source.tf" .Name )}}
8+
9+
{{ .SchemaMarkdown | trimspace }}
10+
11+
For more information see:
12+
- [MongoDB Atlas API - Private Endpoint for Encryption at Rest Using Customer Key Management](https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Encryption-at-Rest-using-Customer-Key-Management/operation/getEncryptionAtRestPrivateEndpoint) Documentation.
13+
- [Manage Customer Keys with Azure Key Vault Over Private Endpoints](https://www.mongodb.com/docs/atlas/security/azure-kms-over-private-endpoint/).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# {{.Type}}: {{.Name}}
2+
3+
`{{.Name}}` describes private endpoints of a particular cloud provider used for encryption at rest using customer-managed keys.
4+
5+
## Example Usages
6+
7+
{{ tffile ("examples/mongodbatlas_encryption_at_rest_private_endpoint/azure/plural-data-source.tf") }}
8+
9+
{{ .SchemaMarkdown | trimspace }}
10+
11+
For more information see:
12+
- [MongoDB Atlas API - Private Endpoint for Encryption at Rest Using Customer Key Management](https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Encryption-at-Rest-using-Customer-Key-Management/operation/getEncryptionAtRestPrivateEndpointsForCloudProvider) Documentation.
13+
- [Manage Customer Keys with Azure Key Vault Over Private Endpoints](https://www.mongodb.com/docs/atlas/security/azure-kms-over-private-endpoint/).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# {{.Type}}: {{.Name}}
2+
3+
`{{.Name}}` provides a resource for managing a private endpoint used for encryption at rest with customer-managed keys. This ensures all traffic between Atlas and customer key management systems take place over private network interfaces.
4+
5+
~> **IMPORTANT** The Encryption at Rest using Azure Key Vault over Private Endpoints feature is available by request. To request this functionality for you Atlas deployments, contact your Account Manager.
6+
Additionally, you'll need to set the environment variable `MONGODB_ATLAS_ENABLE_PREVIEW=true` to use this resource. To learn more about existing limitations, see the [Manage Customer Keys with Azure Key Vault Over Private Endpoints](https://www.mongodb.com/docs/atlas/security/azure-kms-over-private-endpoint/#manage-customer-keys-with-azure-key-vault-over-private-endpoints).
7+
8+
-> **NOTE:** Only Azure Key Vault with Azure Private Link is supported at this time.
9+
10+
## Example Usages
11+
12+
### Configuring Atlas Encryption at Rest using Azure Key Vault with Azure Private Link
13+
14+
{{ tffile (printf "examples/%s/azure/main.tf" .Name )}}
15+
16+
{{ .SchemaMarkdown | trimspace }}
17+
18+
# Import
19+
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.
20+
21+
```
22+
$ terraform import mongodbatlas_encryption_at_rest_private_endpoint.test 650972848269185c55f40ca1-AZURE-650972848269185c55f40ca2
23+
```
24+
25+
For more information see:
26+
- [MongoDB Atlas API - Private Endpoint for Encryption at Rest Using Customer Key Management](https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Encryption-at-Rest-using-Customer-Key-Management/operation/getEncryptionAtRestPrivateEndpoint) Documentation.
27+
- [Manage Customer Keys with Azure Key Vault Over Private Endpoints](https://www.mongodb.com/docs/atlas/security/azure-kms-over-private-endpoint/).

0 commit comments

Comments
 (0)