Skip to content

Commit 2fc6af3

Browse files
lantolioarbusi
andauthored
feat: Supports configuring BYOK encryption on search nodes (#3142)
* use SDK preview in encryption_at_rest * changelog * Revert "use SDK preview in encryption_at_rest" This reverts commit 609c9dc. * trigger change in EAR * Revert "trigger change in EAR" This reverts commit 15794dd. * Reapply "use SDK preview in encryption_at_rest" This reverts commit 1c2db30. * TEMPORARY: send enabled_for_search_nodes = true * finish resource implementation and tests * data source implementation and test * doc update * default and refactor test * remove old migration test * default value in resource * unit test --------- Co-authored-by: Oriol Arbusi <[email protected]>
1 parent cfe9d9d commit 2fc6af3

File tree

12 files changed

+165
-124
lines changed

12 files changed

+165
-124
lines changed

.changelog/3142.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
```release-note:enhancement
2+
resource/mongodbatlas_encryption_at_rest: Adds `enabled_for_search_nodes` attribute
3+
```
4+
5+
```release-note:enhancement
6+
data-source/mongodbatlas_encryption_at_rest: Adds `enabled_for_search_nodes` attribute
7+
```

docs/data-sources/encryption_at_rest.md

+1
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ output "is_gcp_encryption_at_rest_valid" {
135135

136136
- `aws_kms_config` (Attributes) Amazon Web Services (AWS) KMS configuration details and encryption at rest configuration set for the specified project. (see [below for nested schema](#nestedatt--aws_kms_config))
137137
- `azure_key_vault_config` (Attributes) Details that define the configuration of Encryption at Rest using Azure Key Vault (AKV). (see [below for nested schema](#nestedatt--azure_key_vault_config))
138+
- `enabled_for_search_nodes` (Boolean) Flag that indicates whether Encryption at Rest for Dedicated Search Nodes is enabled in the specified project.
138139
- `google_cloud_kms_config` (Attributes) Details that define the configuration of Encryption at Rest using Google Cloud Key Management Service (KMS). (see [below for nested schema](#nestedatt--google_cloud_kms_config))
139140
- `id` (String) The ID of this resource.
140141

docs/resources/encryption_at_rest.md

+1
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ resource "mongodbatlas_encryption_at_rest" "test" {
155155

156156
- `aws_kms_config` (Block List) Amazon Web Services (AWS) KMS configuration details and encryption at rest configuration set for the specified project. (see [below for nested schema](#nestedblock--aws_kms_config))
157157
- `azure_key_vault_config` (Block List) Details that define the configuration of Encryption at Rest using Azure Key Vault (AKV). (see [below for nested schema](#nestedblock--azure_key_vault_config))
158+
- `enabled_for_search_nodes` (Boolean) Flag that indicates whether Encryption at Rest for Dedicated Search Nodes is enabled in the specified project.
158159
- `google_cloud_kms_config` (Block List) Details that define the configuration of Encryption at Rest using Google Cloud Key Management Service (KMS). (see [below for nested schema](#nestedblock--google_cloud_kms_config))
159160

160161
### Read-Only

internal/service/encryptionatrest/data_source.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ func (d *encryptionAtRestDS) Read(ctx context.Context, req datasource.ReadReques
3636
return
3737
}
3838

39-
connV2 := d.Client.AtlasV2
39+
// TODO: update before merging to master: connV2 := d.Client.AtlasV2
40+
connV2 := d.Client.AtlasPreview
4041
projectID := earConfig.ProjectID.ValueString()
4142

4243
encryptionResp, _, err := connV2.EncryptionAtRestUsingCustomerKeyManagementApi.GetEncryptionAtRest(context.Background(), projectID).Execute()

internal/service/encryptionatrest/data_source_schema.go

+18-11
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ package encryptionatrest
33
import (
44
"context"
55

6-
"go.mongodb.org/atlas-sdk/v20250219001/admin"
6+
// TODO: update before merging to master: "go.mongodb.org/atlas-sdk/v20250219001/admin"
7+
"github.com/mongodb/atlas-sdk-go/admin"
78

89
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
910
"github.com/hashicorp/terraform-plugin-framework/types"
@@ -139,24 +140,30 @@ func DataSourceSchema(ctx context.Context) schema.Schema {
139140
"id": schema.StringAttribute{
140141
Computed: true,
141142
},
143+
"enabled_for_search_nodes": schema.BoolAttribute{
144+
Computed: true,
145+
MarkdownDescription: "Flag that indicates whether Encryption at Rest for Dedicated Search Nodes is enabled in the specified project.",
146+
},
142147
},
143148
}
144149
}
145150

146151
type TFEncryptionAtRestDSModel struct {
147-
AzureKeyVaultConfig *TFAzureKeyVaultConfigModel `tfsdk:"azure_key_vault_config"`
148-
AwsKmsConfig *TFAwsKmsConfigModel `tfsdk:"aws_kms_config"`
149-
GoogleCloudKmsConfig *TFGcpKmsConfigModel `tfsdk:"google_cloud_kms_config"`
150-
ID types.String `tfsdk:"id"`
151-
ProjectID types.String `tfsdk:"project_id"`
152+
AzureKeyVaultConfig *TFAzureKeyVaultConfigModel `tfsdk:"azure_key_vault_config"`
153+
AwsKmsConfig *TFAwsKmsConfigModel `tfsdk:"aws_kms_config"`
154+
GoogleCloudKmsConfig *TFGcpKmsConfigModel `tfsdk:"google_cloud_kms_config"`
155+
ID types.String `tfsdk:"id"`
156+
ProjectID types.String `tfsdk:"project_id"`
157+
EnabledForSearchNodes types.Bool `tfsdk:"enabled_for_search_nodes"`
152158
}
153159

154160
func NewTFEncryptionAtRestDSModel(projectID string, encryptionResp *admin.EncryptionAtRest) *TFEncryptionAtRestDSModel {
155161
return &TFEncryptionAtRestDSModel{
156-
ID: types.StringValue(projectID),
157-
ProjectID: types.StringValue(projectID),
158-
AwsKmsConfig: NewTFAwsKmsConfigItem(encryptionResp.AwsKms),
159-
AzureKeyVaultConfig: NewTFAzureKeyVaultConfigItem(encryptionResp.AzureKeyVault),
160-
GoogleCloudKmsConfig: NewTFGcpKmsConfigItem(encryptionResp.GoogleCloudKms),
162+
ID: types.StringValue(projectID),
163+
ProjectID: types.StringValue(projectID),
164+
AwsKmsConfig: NewTFAwsKmsConfigItem(encryptionResp.AwsKms),
165+
AzureKeyVaultConfig: NewTFAzureKeyVaultConfigItem(encryptionResp.AzureKeyVault),
166+
GoogleCloudKmsConfig: NewTFGcpKmsConfigItem(encryptionResp.GoogleCloudKms),
167+
EnabledForSearchNodes: types.BoolPointerValue(encryptionResp.EnabledForSearchNodes),
161168
}
162169
}

internal/service/encryptionatrest/model.go

+28-6
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,26 @@ package encryptionatrest
33
import (
44
"context"
55

6-
"go.mongodb.org/atlas-sdk/v20250219001/admin"
6+
// TODO: update before merging to master: "go.mongodb.org/atlas-sdk/v20250219001/admin"
7+
"github.com/mongodb/atlas-sdk-go/admin"
78

89
"github.com/hashicorp/terraform-plugin-framework/types"
910

1011
"github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion"
1112
)
1213

1314
func NewTFEncryptionAtRestRSModel(ctx context.Context, projectID string, encryptionResp *admin.EncryptionAtRest) *TfEncryptionAtRestRSModel {
15+
enabledForSearchNodes := false
16+
if encryptionResp.EnabledForSearchNodes != nil {
17+
enabledForSearchNodes = encryptionResp.GetEnabledForSearchNodes()
18+
}
1419
return &TfEncryptionAtRestRSModel{
15-
ID: types.StringValue(projectID),
16-
ProjectID: types.StringValue(projectID),
17-
AwsKmsConfig: NewTFAwsKmsConfig(ctx, encryptionResp.AwsKms),
18-
AzureKeyVaultConfig: NewTFAzureKeyVaultConfig(ctx, encryptionResp.AzureKeyVault),
19-
GoogleCloudKmsConfig: NewTFGcpKmsConfig(ctx, encryptionResp.GoogleCloudKms),
20+
ID: types.StringValue(projectID),
21+
ProjectID: types.StringValue(projectID),
22+
AwsKmsConfig: NewTFAwsKmsConfig(ctx, encryptionResp.AwsKms),
23+
AzureKeyVaultConfig: NewTFAzureKeyVaultConfig(ctx, encryptionResp.AzureKeyVault),
24+
GoogleCloudKmsConfig: NewTFGcpKmsConfig(ctx, encryptionResp.GoogleCloudKms),
25+
EnabledForSearchNodes: types.BoolValue(enabledForSearchNodes),
2026
}
2127
}
2228

@@ -151,3 +157,19 @@ func NewAtlasAzureKeyVault(tfAzKeyVaultConfigSlice []TFAzureKeyVaultConfigModel)
151157
RequirePrivateNetworking: v.RequirePrivateNetworking.ValueBoolPointer(),
152158
}
153159
}
160+
161+
func NewAtlasEncryptionAtRest(encryptionAtRestPlan, encryptionAtRestState *TfEncryptionAtRestRSModel, atlasEncryptionAtRest *admin.EncryptionAtRest) *admin.EncryptionAtRest {
162+
if hasAwsKmsConfigChanged(encryptionAtRestPlan.AwsKmsConfig, encryptionAtRestState.AwsKmsConfig) {
163+
atlasEncryptionAtRest.AwsKms = NewAtlasAwsKms(encryptionAtRestPlan.AwsKmsConfig)
164+
}
165+
if hasAzureKeyVaultConfigChanged(encryptionAtRestPlan.AzureKeyVaultConfig, encryptionAtRestState.AzureKeyVaultConfig) {
166+
atlasEncryptionAtRest.AzureKeyVault = NewAtlasAzureKeyVault(encryptionAtRestPlan.AzureKeyVaultConfig)
167+
}
168+
if hasGcpKmsConfigChanged(encryptionAtRestPlan.GoogleCloudKmsConfig, encryptionAtRestState.GoogleCloudKmsConfig) {
169+
atlasEncryptionAtRest.GoogleCloudKms = NewAtlasGcpKms(encryptionAtRestPlan.GoogleCloudKmsConfig)
170+
}
171+
if encryptionAtRestPlan.EnabledForSearchNodes != encryptionAtRestState.EnabledForSearchNodes {
172+
atlasEncryptionAtRest.EnabledForSearchNodes = encryptionAtRestPlan.EnabledForSearchNodes.ValueBoolPointer()
173+
}
174+
return atlasEncryptionAtRest
175+
}

internal/service/encryptionatrest/model_test.go

+12-9
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import (
44
"context"
55
"testing"
66

7-
"go.mongodb.org/atlas-sdk/v20250219001/admin"
7+
// TODO: update before merging to master: "go.mongodb.org/atlas-sdk/v20250219001/admin"
8+
"github.com/mongodb/atlas-sdk-go/admin"
89

910
"github.com/hashicorp/terraform-plugin-framework/types"
1011
"github.com/stretchr/testify/assert"
@@ -84,9 +85,10 @@ var (
8485
ServiceAccountKey: types.StringValue(serviceAccountKey),
8586
}
8687
EncryptionAtRest = &admin.EncryptionAtRest{
87-
AwsKms: AWSKMSConfiguration,
88-
AzureKeyVault: AzureKeyVault,
89-
GoogleCloudKms: GoogleCloudKMS,
88+
AwsKms: AWSKMSConfiguration,
89+
AzureKeyVault: AzureKeyVault,
90+
GoogleCloudKms: GoogleCloudKMS,
91+
EnabledForSearchNodes: &enabled,
9092
}
9193
)
9294

@@ -100,11 +102,12 @@ func TestNewTfEncryptionAtRestRSModel(t *testing.T) {
100102
name: "Success NewTFAwsKmsConfig",
101103
sdkModel: EncryptionAtRest,
102104
expectedResult: &encryptionatrest.TfEncryptionAtRestRSModel{
103-
ID: types.StringValue(projectID),
104-
ProjectID: types.StringValue(projectID),
105-
AwsKmsConfig: []encryptionatrest.TFAwsKmsConfigModel{TfAwsKmsConfigModel},
106-
AzureKeyVaultConfig: []encryptionatrest.TFAzureKeyVaultConfigModel{TfAzureKeyVaultConfigModel},
107-
GoogleCloudKmsConfig: []encryptionatrest.TFGcpKmsConfigModel{TfGcpKmsConfigModel},
105+
ID: types.StringValue(projectID),
106+
ProjectID: types.StringValue(projectID),
107+
AwsKmsConfig: []encryptionatrest.TFAwsKmsConfigModel{TfAwsKmsConfigModel},
108+
AzureKeyVaultConfig: []encryptionatrest.TFAzureKeyVaultConfigModel{TfAzureKeyVaultConfigModel},
109+
GoogleCloudKmsConfig: []encryptionatrest.TFGcpKmsConfigModel{TfGcpKmsConfigModel},
110+
EnabledForSearchNodes: types.BoolValue(enabled),
108111
},
109112
},
110113
}

internal/service/encryptionatrest/resource.go

+28-21
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import (
88
"reflect"
99
"time"
1010

11-
"go.mongodb.org/atlas-sdk/v20250219001/admin"
11+
// TODO: update before merging to master: "go.mongodb.org/atlas-sdk/v20250219001/admin"
12+
"github.com/mongodb/atlas-sdk-go/admin"
1213

1314
"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
1415
"github.com/hashicorp/terraform-plugin-framework/path"
1516
"github.com/hashicorp/terraform-plugin-framework/resource"
1617
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
18+
"github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
1719
"github.com/hashicorp/terraform-plugin-framework/resource/schema/boolplanmodifier"
1820
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
1921
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
@@ -52,11 +54,12 @@ type encryptionAtRestRS struct {
5254
}
5355

5456
type TfEncryptionAtRestRSModel struct {
55-
ID types.String `tfsdk:"id"`
56-
ProjectID types.String `tfsdk:"project_id"`
57-
AwsKmsConfig []TFAwsKmsConfigModel `tfsdk:"aws_kms_config"`
58-
AzureKeyVaultConfig []TFAzureKeyVaultConfigModel `tfsdk:"azure_key_vault_config"`
59-
GoogleCloudKmsConfig []TFGcpKmsConfigModel `tfsdk:"google_cloud_kms_config"`
57+
ID types.String `tfsdk:"id"`
58+
ProjectID types.String `tfsdk:"project_id"`
59+
AwsKmsConfig []TFAwsKmsConfigModel `tfsdk:"aws_kms_config"`
60+
AzureKeyVaultConfig []TFAzureKeyVaultConfigModel `tfsdk:"azure_key_vault_config"`
61+
GoogleCloudKmsConfig []TFGcpKmsConfigModel `tfsdk:"google_cloud_kms_config"`
62+
EnabledForSearchNodes types.Bool `tfsdk:"enabled_for_search_nodes"`
6063
}
6164

6265
type TFAwsKmsConfigModel struct {
@@ -105,6 +108,12 @@ func (r *encryptionAtRestRS) Schema(ctx context.Context, req resource.SchemaRequ
105108
},
106109
MarkdownDescription: "Unique 24-hexadecimal digit string that identifies your project.",
107110
},
111+
"enabled_for_search_nodes": schema.BoolAttribute{
112+
Optional: true,
113+
Computed: true,
114+
Default: booldefault.StaticBool(false),
115+
MarkdownDescription: "Flag that indicates whether Encryption at Rest for Dedicated Search Nodes is enabled in the specified project.",
116+
},
108117
},
109118
Blocks: map[string]schema.Block{
110119
"aws_kms_config": schema.ListNestedBlock{
@@ -262,7 +271,8 @@ func (r *encryptionAtRestRS) Schema(ctx context.Context, req resource.SchemaRequ
262271
func (r *encryptionAtRestRS) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
263272
var encryptionAtRestPlan *TfEncryptionAtRestRSModel
264273
var encryptionAtRestConfig *TfEncryptionAtRestRSModel
265-
connV2 := r.Client.AtlasV2
274+
// TODO: update before merging to master: connV2 := d.Client.AtlasV2
275+
connV2 := r.Client.AtlasPreview
266276

267277
resp.Diagnostics.Append(req.Plan.Get(ctx, &encryptionAtRestPlan)...)
268278
resp.Diagnostics.Append(req.Config.Get(ctx, &encryptionAtRestConfig)...)
@@ -272,6 +282,9 @@ func (r *encryptionAtRestRS) Create(ctx context.Context, req resource.CreateRequ
272282

273283
projectID := encryptionAtRestPlan.ProjectID.ValueString()
274284
encryptionAtRestReq := &admin.EncryptionAtRest{}
285+
if !encryptionAtRestPlan.EnabledForSearchNodes.IsNull() {
286+
encryptionAtRestReq.EnabledForSearchNodes = conversion.Pointer(encryptionAtRestPlan.EnabledForSearchNodes.ValueBool())
287+
}
275288
if encryptionAtRestPlan.AwsKmsConfig != nil {
276289
encryptionAtRestReq.AwsKms = NewAtlasAwsKms(encryptionAtRestPlan.AwsKmsConfig)
277290
}
@@ -344,7 +357,8 @@ func (r *encryptionAtRestRS) Read(ctx context.Context, req resource.ReadRequest,
344357
isImport = true
345358
}
346359

347-
connV2 := r.Client.AtlasV2
360+
// TODO: update before merging to master: connV2 := d.Client.AtlasV2
361+
connV2 := r.Client.AtlasPreview
348362

349363
encryptionResp, getResp, err := connV2.EncryptionAtRestUsingCustomerKeyManagementApi.GetEncryptionAtRest(context.Background(), projectID).Execute()
350364
if err != nil {
@@ -374,7 +388,8 @@ func (r *encryptionAtRestRS) Update(ctx context.Context, req resource.UpdateRequ
374388
var encryptionAtRestState *TfEncryptionAtRestRSModel
375389
var encryptionAtRestConfig *TfEncryptionAtRestRSModel
376390
var encryptionAtRestPlan *TfEncryptionAtRestRSModel
377-
connV2 := r.Client.AtlasV2
391+
// TODO: update before merging to master: connV2 := d.Client.AtlasV2
392+
connV2 := r.Client.AtlasPreview
378393

379394
// get current config
380395
resp.Diagnostics.Append(req.Config.Get(ctx, &encryptionAtRestConfig)...)
@@ -398,17 +413,8 @@ func (r *encryptionAtRestRS) Update(ctx context.Context, req resource.UpdateRequ
398413
return
399414
}
400415

401-
if hasAwsKmsConfigChanged(encryptionAtRestPlan.AwsKmsConfig, encryptionAtRestState.AwsKmsConfig) {
402-
atlasEncryptionAtRest.AwsKms = NewAtlasAwsKms(encryptionAtRestPlan.AwsKmsConfig)
403-
}
404-
if hasAzureKeyVaultConfigChanged(encryptionAtRestPlan.AzureKeyVaultConfig, encryptionAtRestState.AzureKeyVaultConfig) {
405-
atlasEncryptionAtRest.AzureKeyVault = NewAtlasAzureKeyVault(encryptionAtRestPlan.AzureKeyVaultConfig)
406-
}
407-
if hasGcpKmsConfigChanged(encryptionAtRestPlan.GoogleCloudKmsConfig, encryptionAtRestState.GoogleCloudKmsConfig) {
408-
atlasEncryptionAtRest.GoogleCloudKms = NewAtlasGcpKms(encryptionAtRestPlan.GoogleCloudKmsConfig)
409-
}
410-
411-
encryptionResp, _, err := connV2.EncryptionAtRestUsingCustomerKeyManagementApi.UpdateEncryptionAtRest(ctx, projectID, atlasEncryptionAtRest).Execute()
416+
updateReq := NewAtlasEncryptionAtRest(encryptionAtRestPlan, encryptionAtRestState, atlasEncryptionAtRest)
417+
encryptionResp, _, err := connV2.EncryptionAtRestUsingCustomerKeyManagementApi.UpdateEncryptionAtRest(ctx, projectID, updateReq).Execute()
412418
if err != nil {
413419
resp.Diagnostics.AddError("error updating encryption at rest", fmt.Sprintf(errorUpdateEncryptionAtRest, err.Error()))
414420
return
@@ -431,7 +437,8 @@ func (r *encryptionAtRestRS) Delete(ctx context.Context, req resource.DeleteRequ
431437
}
432438

433439
enabled := false
434-
connV2 := r.Client.AtlasV2
440+
// TODO: update before merging to master: connV2 := d.Client.AtlasV2
441+
connV2 := r.Client.AtlasPreview
435442
projectID := encryptionAtRestState.ProjectID.ValueString()
436443

437444
_, _, err := connV2.EncryptionAtRestUsingCustomerKeyManagementApi.GetEncryptionAtRest(context.Background(), projectID).Execute()

internal/service/encryptionatrest/resource_migration_test.go

+5-40
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import (
55
"strconv"
66
"testing"
77

8-
"go.mongodb.org/atlas-sdk/v20250219001/admin"
8+
// TODO: update before merging to master: "go.mongodb.org/atlas-sdk/v20250219001/admin"
9+
"github.com/mongodb/atlas-sdk-go/admin"
910

1011
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
1112

@@ -27,6 +28,7 @@ func TestMigEncryptionAtRest_basicAWS(t *testing.T) {
2728
}
2829
useDatasource = mig.IsProviderVersionAtLeast("1.19.0") // data source introduced in this version
2930
useRequirePrivateNetworking = mig.IsProviderVersionAtLeast("1.28.0") // require_private_networking introduced in this version
31+
useEnabledForSearchNodes = mig.IsProviderVersionAtLeast("1.30.0") // enabled_for_search_nodes introduced in this version
3032
)
3133

3234
resource.Test(t, resource.TestCase{
@@ -35,13 +37,13 @@ func TestMigEncryptionAtRest_basicAWS(t *testing.T) {
3537
Steps: []resource.TestStep{
3638
{
3739
ExternalProviders: mig.ExternalProviders(),
38-
Config: acc.ConfigAwsKms(projectID, &awsKms, useDatasource, useRequirePrivateNetworking),
40+
Config: acc.ConfigAwsKms(projectID, &awsKms, useDatasource, useRequirePrivateNetworking, useEnabledForSearchNodes),
3941
Check: resource.ComposeAggregateTestCheckFunc(
4042
acc.CheckEARExists(resourceName),
4143
resource.TestCheckResourceAttr(resourceName, "aws_kms_config.0.enabled", "true"),
4244
),
4345
},
44-
mig.TestStepCheckEmptyPlan(acc.ConfigAwsKms(projectID, &awsKms, useDatasource, useRequirePrivateNetworking)),
46+
mig.TestStepCheckEmptyPlan(acc.ConfigAwsKms(projectID, &awsKms, useDatasource, useRequirePrivateNetworking, useEnabledForSearchNodes)),
4547
},
4648
})
4749
}
@@ -135,40 +137,3 @@ func TestMigEncryptionAtRest_basicGCP(t *testing.T) {
135137
},
136138
})
137139
}
138-
139-
func TestMigEncryptionAtRest_basicAWS_from_v1_11_0(t *testing.T) {
140-
var (
141-
resourceName = "mongodbatlas_encryption_at_rest.test"
142-
projectID = os.Getenv("MONGODB_ATLAS_PROJECT_EAR_PE_AWS_ID") // to use RequirePrivateNetworking, Atlas Project is required to have FF enabled
143-
144-
awsKms = admin.AWSKMSConfiguration{
145-
Enabled: conversion.Pointer(true),
146-
AccessKeyID: conversion.StringPtr(os.Getenv("AWS_ACCESS_KEY_ID")),
147-
SecretAccessKey: conversion.StringPtr(os.Getenv("AWS_SECRET_ACCESS_KEY")),
148-
CustomerMasterKeyID: conversion.StringPtr(os.Getenv("AWS_CUSTOMER_MASTER_KEY_ID")),
149-
Region: conversion.StringPtr(conversion.AWSRegionToMongoDBRegion(os.Getenv("AWS_REGION"))),
150-
RoleId: conversion.StringPtr(os.Getenv("AWS_EAR_ROLE_ID")),
151-
}
152-
useDatasource = mig.IsProviderVersionAtLeast("1.19.0") // data source introduced in this version
153-
useRequirePrivateNetworking = mig.IsProviderVersionAtLeast("1.28.0") // require_private_networking introduced in this version
154-
)
155-
156-
resource.Test(t, resource.TestCase{
157-
PreCheck: func() { acc.PreCheckAwsEnv(t) },
158-
CheckDestroy: acc.EARDestroy,
159-
Steps: []resource.TestStep{
160-
{
161-
ExternalProviders: acc.ExternalProvidersWithAWS("1.11.0"),
162-
Config: acc.ConfigAwsKms(projectID, &awsKms, false, false),
163-
Check: resource.ComposeAggregateTestCheckFunc(
164-
acc.CheckEARExists(resourceName),
165-
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
166-
resource.TestCheckResourceAttr(resourceName, "aws_kms_config.0.enabled", "true"),
167-
resource.TestCheckResourceAttr(resourceName, "aws_kms_config.0.region", awsKms.GetRegion()),
168-
resource.TestCheckResourceAttr(resourceName, "aws_kms_config.0.role_id", awsKms.GetRoleId()),
169-
),
170-
},
171-
mig.TestStepCheckEmptyPlan(acc.ConfigAwsKms(projectID, &awsKms, useDatasource, useRequirePrivateNetworking)),
172-
},
173-
})
174-
}

0 commit comments

Comments
 (0)