@@ -1336,55 +1336,55 @@ func flattenObservabilityConfig(config *vaultmodels.HashicorpCloudVault20201125O
13361336 configMap ["cloudwatch_secret_access_key" ] = config ["cloudwatch_secret_access_key" ].(string )
13371337 }
13381338 }
1339+ }
1340+
1341+ if elasticsearch := config .Elasticsearch ; elasticsearch != nil {
1342+ configMap ["elasticsearch_endpoint" ] = elasticsearch .Endpoint
1343+ configMap ["elasticsearch_dataset" ] = elasticsearch .Dataset
1344+ configMap ["elasticsearch_user" ] = elasticsearch .User
1345+
1346+ // Since the API return this sensitive fields as redacted, we don't update it on the config in this situations
1347+ if elasticsearch .Password != "redacted" {
1348+ configMap ["elasticsearch_password" ] = elasticsearch .Password
1349+ } else {
1350+ if configParam , ok := d .GetOk (propertyName ); ok && len (configParam .([]interface {})) > 0 {
1351+ config := configParam .([]interface {})[0 ].(map [string ]interface {})
1352+ configMap ["elasticsearch_password" ] = config ["elasticsearch_password" ].(string )
1353+ }
1354+ }
1355+ }
13391356
1340- if elasticsearch := config .Elasticsearch ; elasticsearch != nil {
1341- configMap ["elasticsearch_endpoint" ] = elasticsearch .Endpoint
1342- configMap ["elasticsearch_dataset" ] = elasticsearch .Dataset
1343- configMap ["elasticsearch_user" ] = elasticsearch .User
1357+ if http := config .HTTP ; http != nil {
1358+ configMap ["http_headers" ] = http .Headers
1359+ configMap ["http_codec" ] = http .Codec
1360+ configMap ["http_compression" ] = http .Compression
1361+ configMap ["http_method" ] = http .Method
1362+ configMap ["http_payload_prefix" ] = http .PayloadPrefix
1363+ configMap ["http_payload_suffix" ] = http .PayloadSuffix
1364+ configMap ["http_uri" ] = http .URI
1365+
1366+ if http .Basic != nil {
1367+ configMap ["http_basic_user" ] = http .Basic .User
13441368
13451369 // Since the API return this sensitive fields as redacted, we don't update it on the config in this situations
1346- if elasticsearch .Password != "redacted" {
1347- configMap ["elasticsearch_password " ] = elasticsearch .Password
1370+ if http . Basic .Password != "redacted" {
1371+ configMap ["http_basic_password " ] = http . Basic .Password
13481372 } else {
13491373 if configParam , ok := d .GetOk (propertyName ); ok && len (configParam .([]interface {})) > 0 {
13501374 config := configParam .([]interface {})[0 ].(map [string ]interface {})
1351- configMap ["elasticsearch_password " ] = config ["elasticsearch_password " ].(string )
1375+ configMap ["http_basic_password " ] = config ["http_basic_password " ].(string )
13521376 }
13531377 }
13541378 }
13551379
1356- if http := config .HTTP ; http != nil {
1357- configMap ["http_headers" ] = http .Headers
1358- configMap ["http_codec" ] = http .Codec
1359- configMap ["http_compression" ] = http .Compression
1360- configMap ["http_method" ] = http .Method
1361- configMap ["http_payload_prefix" ] = http .PayloadPrefix
1362- configMap ["http_payload_suffix" ] = http .PayloadSuffix
1363- configMap ["http_uri" ] = http .URI
1364-
1365- if http .Basic != nil {
1366- configMap ["http_basic_user" ] = http .Basic .User
1367-
1368- // Since the API return this sensitive fields as redacted, we don't update it on the config in this situations
1369- if http .Basic .Password != "redacted" {
1370- configMap ["http_basic_password" ] = http .Basic .Password
1371- } else {
1372- if configParam , ok := d .GetOk (propertyName ); ok && len (configParam .([]interface {})) > 0 {
1373- config := configParam .([]interface {})[0 ].(map [string ]interface {})
1374- configMap ["http_basic_password" ] = config ["http_basic_password" ].(string )
1375- }
1376- }
1377- }
1378-
1379- if http .Bearer != nil {
1380- // Since the API return this sensitive fields as redacted, we don't update it on the config in this situations
1381- if http .Bearer .Token != "redacted" {
1382- configMap ["http_bearer_token" ] = http .Bearer .Token
1383- } else {
1384- if configParam , ok := d .GetOk (propertyName ); ok && len (configParam .([]interface {})) > 0 {
1385- config := configParam .([]interface {})[0 ].(map [string ]interface {})
1386- configMap ["http_bearer_token" ] = config ["http_bearer_token" ].(string )
1387- }
1380+ if http .Bearer != nil {
1381+ // Since the API return this sensitive fields as redacted, we don't update it on the config in this situations
1382+ if http .Bearer .Token != "redacted" {
1383+ configMap ["http_bearer_token" ] = http .Bearer .Token
1384+ } else {
1385+ if configParam , ok := d .GetOk (propertyName ); ok && len (configParam .([]interface {})) > 0 {
1386+ config := configParam .([]interface {})[0 ].(map [string ]interface {})
1387+ configMap ["http_bearer_token" ] = config ["http_bearer_token" ].(string )
13881388 }
13891389 }
13901390 }
0 commit comments