amnk / dd2tf

Export DataDog configuration to Terraform
99 stars 39 forks source link

skip aggregator if empty #9

Closed mllu closed 6 years ago

mllu commented 6 years ago

hi, I found out there is a case when creating a graph in Top List mode, there is no Aggregator return from datadog. So dd2tf will populate aggregator = "" which is invalid datadog terraform syntax and print out error messages as shown below.

Error: datadog_timeboard.######: "graph.6.request.0.aggregator" contains an invalid method "". Valid methods are either "avg", "max", "min", "sum", or "last"

Not sure what's the best way to solve this issue, I implement a deference string function and only add Aggregator if it's not empty string

amnk commented 6 years ago

@mllu interesting... we do check for existence of the object, but I thought zorkian/go-datadog-api will not pass empty strings. Thanks for the fix anyway.