ojongerius / terraform-provider-datadog

A Terraform plugin to manage Datadog resources.
Mozilla Public License 2.0
29 stars 6 forks source link

Add support for template variables in datadog_dashboard resource #2

Closed ojongerius closed 9 years ago

ojongerius commented 9 years ago

Template variables are comparable to tags in the builtin AWS provider in the way that they are dictionaries where key and values are defined by the user.

In the AWS provider tags are mostly handled outside of the resource specific files. tags.go, has a convenience function tagsSchema() and resources that have different connections and structs (ELB, EC) have specific helper files.

Having at least some shared variable helper functions makes sense for us too, as we will reuse 'template variables' between Timeboards and Screenboards

There are similar helper functions split up between tags.go, tagsEC.go etc. They all have:

The difference between these is that they each handle getting, setting and diffing based on the structs they operate on, and connections they operate on.

Going through the AWS route table resource you'll notice all the work is offloaded to the helpers. The only references are:

ojongerius commented 9 years ago

Damn, rereading the API, the above not applicable at all.

It actually is just a list of dicts with:

template_variables [optional, default=None]

A list of template variables for using Dashboard templating. Template variable definitions follow this form:

name [required]
The name of the variable.
prefix [optional, default=None]
The tag prefix associated with the variable. Only tags with this prefix will appear in the variable dropdown.
default [optional, default=None]

The default value for the template variable on dashboard load
``
ojongerius commented 9 years ago

All done. Did add TODO to implement an acceptance test for changes.

ojongerius commented 9 years ago

Related upstream PR: https://github.com/zorkian/go-datadog-api/pull/12