@@ -223,17 +223,40 @@ func resourceMongoDBAtlasEncryptionAtRestRead(d *schema.ResourceData, meta inter
223
223
224
224
values = flattenAzureVault (& resp .AzureKeyVault )
225
225
if ! counterEmptyValues (values ) {
226
+ azure , azureOk := d .GetOk ("azure_key_vault" )
227
+ if azureOk {
228
+ azure2 := azure .(map [string ]interface {})
229
+ values ["secret" ] = cast .ToString (azure2 ["secret" ])
230
+ if v , sa := values ["secret" ]; sa {
231
+ if v .(string ) == "" {
232
+ delete (values , "secret" )
233
+ }
234
+ }
235
+ }
226
236
if err = d .Set ("azure_key_vault" , values ); err != nil {
227
237
return fmt .Errorf (errorAlertEncryptionAtRestSetting , "azure_key_vault" , d .Id (), err )
228
238
}
229
239
}
230
240
231
241
values = flattenGCPKms (& resp .GoogleCloudKms )
232
242
if ! counterEmptyValues (values ) {
243
+ gcp , gcpOk := d .GetOk ("google_cloud_kms" )
244
+ if gcpOk {
245
+ gcp2 := gcp .(map [string ]interface {})
246
+ values ["service_account_key" ] = cast .ToString (gcp2 ["service_account_key" ])
247
+ if v , sa := values ["service_account_key" ]; sa {
248
+ if v .(string ) == "" {
249
+ delete (values , "service_account_key" )
250
+ }
251
+ }
252
+ }
233
253
if err = d .Set ("google_cloud_kms" , values ); err != nil {
234
254
return fmt .Errorf (errorAlertEncryptionAtRestSetting , "google_cloud_kms" , d .Id (), err )
235
255
}
236
256
}
257
+ if err = d .Set ("project_id" , d .Id ()); err != nil {
258
+ return fmt .Errorf (errorAlertEncryptionAtRestSetting , "project_id" , d .Id (), err )
259
+ }
237
260
238
261
return nil
239
262
}
0 commit comments