Skip to content

Commit

Permalink
Merge branch 'NR-273644' of https://github.com/newrelic/terraform-pro…
Browse files Browse the repository at this point in the history
…vider-newrelic into NR-273644
  • Loading branch information
abasha1234 committed Jun 5, 2024
2 parents fc85d46 + 6ae7f30 commit 74d6aad
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/mitchellh/go-homedir v1.1.0
github.com/newrelic/go-agent/v3 v3.30.0
github.com/newrelic/go-insights v1.0.3
github.com/newrelic/newrelic-client-go/v2 v2.36.3-0.20240531052621-612d979b4edd
github.com/newrelic/newrelic-client-go/v2 v2.36.3-0.20240604195057-f92f8faa7b9c
github.com/stretchr/testify v1.9.0
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8
)
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,10 @@ github.com/newrelic/go-agent/v3 v3.30.0 h1:ZXHCT/Cot4iIPwcegCZURuRQOsfmGA6wilW+S
github.com/newrelic/go-agent/v3 v3.30.0/go.mod h1:9utrgxlSryNqRrTvII2XBL+0lpofXbqXApvVWPpbzUg=
github.com/newrelic/go-insights v1.0.3 h1:zSNp1CEZnXktzSIEsbHJk8v6ZihdPFP2WsO/fzau3OQ=
github.com/newrelic/go-insights v1.0.3/go.mod h1:A20BoT8TNkqPGX2nS/Z2fYmKl3Cqa3iKZd4whzedCY4=
github.com/newrelic/newrelic-client-go/v2 v2.36.3-0.20240531052621-612d979b4edd h1:rjSVhCb35vSlGV+5ZCgANsnz6B3qwBgBjqkVqyk8/1I=
github.com/newrelic/newrelic-client-go/v2 v2.36.3-0.20240531052621-612d979b4edd/go.mod h1:pDFY24/6iIMEbPIdowTRrRn9YYwkXc3j+B+XpTb4oF4=
github.com/newrelic/newrelic-client-go/v2 v2.36.3-0.20240604183935-14d9a6b020c3 h1:JNxLyLE3r8hPj7MmoLKnQ3zn86+tDlThBnzZCj5jF24=
github.com/newrelic/newrelic-client-go/v2 v2.36.3-0.20240604183935-14d9a6b020c3/go.mod h1:pDFY24/6iIMEbPIdowTRrRn9YYwkXc3j+B+XpTb4oF4=
github.com/newrelic/newrelic-client-go/v2 v2.36.3-0.20240604195057-f92f8faa7b9c h1:iK+YGEoSGZI2AZT0HSzejYIfvbWN1MH50kczrzFrSFY=
github.com/newrelic/newrelic-client-go/v2 v2.36.3-0.20240604195057-f92f8faa7b9c/go.mod h1:pDFY24/6iIMEbPIdowTRrRn9YYwkXc3j+B+XpTb4oF4=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw=
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
Expand Down
16 changes: 11 additions & 5 deletions newrelic/data_source_newrelic_entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,19 @@ func flattenEntityData(entity *entities.EntityOutlineInterface, d *schema.Resour

entityTags := (*entity).GetTags()
if len(entityTags) != 0 {
entityTagsJSONMarshalled, err := json.Marshal(entityTags)
if err != nil {
return err
entityTagsJSONMarshalled, jsonMarshalError := json.Marshal(entityTags)
if jsonMarshalError != nil {
log.Printf("[WARNING] Error marshalling entity tags: %v", jsonMarshalError)
log.Printf("[WARNING] The above error is disallowing setting `entity_tags` in the data source")
// do not throw an error, to prevent blocking results being returned by the data source if there is an issue with tag marshalling
return nil
}
if entityTagsJSONMarshalled != nil {
if err = d.Set("entity_tags", string(entityTagsJSONMarshalled)); err != nil {
return err
if entityTagsSetError := d.Set("entity_tags", string(entityTagsJSONMarshalled)); err != nil {
log.Printf("[WARNING] Error setting marshalled entity tags to the state: %v", entityTagsSetError)
log.Printf("[WARNING] The above error is disallowing setting `entity_tags` in the data source")
// do not throw an error, to prevent blocking results being returned by the data source if there is an issue with string conversion
return nil
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion website/docs/d/entity.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ output "key_value_map" {
value = local.key_value_map
}
```
The value of local.key_value_map would look like the following.
The value of `local.key_value_map` would look like the following.

```hcl
{
Expand Down

0 comments on commit 74d6aad

Please sign in to comment.