9
9
"reflect"
10
10
"time"
11
11
12
- matlas "go.mongodb.org/atlas/mongodbatlas"
13
-
14
12
"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
15
13
"github.com/hashicorp/terraform-plugin-framework/path"
16
14
"github.com/hashicorp/terraform-plugin-framework/resource"
@@ -21,10 +19,10 @@ import (
21
19
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
22
20
"github.com/hashicorp/terraform-plugin-framework/types"
23
21
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
24
-
25
22
"github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas/framework/conversion"
26
23
retrystrategy "github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas/framework/retry"
27
24
validators "github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas/framework/validator"
25
+ matlas "go.mongodb.org/atlas/mongodbatlas"
28
26
)
29
27
30
28
const (
@@ -431,20 +429,23 @@ func handleGcpKmsConfig(ctx context.Context, earRSCurrent, earRSNew, earRSConfig
431
429
}
432
430
}
433
431
434
- func handleAwsKmsConfigDefaults (ctx context.Context , earRSCurrent , earRSNew , earRSConfig * tfEncryptionAtRestRSModel ) {
432
+ func handleAwsKmsConfigDefaults (ctx context.Context , currentStateFile , newStateFile , earRSConfig * tfEncryptionAtRestRSModel ) {
435
433
// this is required to avoid unnecessary change detection during plan after migration to Plugin Framework if user didn't set this block
436
- if earRSCurrent .AwsKmsConfig == nil {
437
- earRSNew .AwsKmsConfig = []tfAwsKmsConfigModel {}
434
+ if currentStateFile .AwsKmsConfig == nil {
435
+ newStateFile .AwsKmsConfig = []tfAwsKmsConfigModel {}
438
436
return
439
437
}
440
438
441
439
// handling sensitive values that are not returned in the API response, so we sync them from the config
442
440
// that user provided. encryptionAtRestRSConfig is nil during Read(), so we use the current plan
443
441
if earRSConfig != nil && len (earRSConfig .AwsKmsConfig ) > 0 {
444
- earRSNew .AwsKmsConfig [0 ].Region = earRSConfig .AwsKmsConfig [0 ].Region
442
+ newStateFile .AwsKmsConfig [0 ].Region = earRSConfig .AwsKmsConfig [0 ].Region
445
443
} else {
446
- earRSNew .AwsKmsConfig [0 ].Region = earRSCurrent .AwsKmsConfig [0 ].Region
444
+ newStateFile .AwsKmsConfig [0 ].Region = currentStateFile .AwsKmsConfig [0 ].Region
447
445
}
446
+
447
+ // Secret access key is not returned by the API response
448
+ newStateFile .AwsKmsConfig [0 ].SecretAccessKey = currentStateFile .AwsKmsConfig [0 ].SecretAccessKey
448
449
}
449
450
450
451
func handleAzureKeyVaultConfigDefaults (ctx context.Context , earRSCurrent , earRSNew , earRSConfig * tfEncryptionAtRestRSModel ) {
0 commit comments