Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the graph.style.palette_flip field is a boolean but only works if it's passed as a string #29

Closed
dustinlindquist opened this issue Oct 21, 2017 · 0 comments · Fixed by #126
Assignees
Labels

Comments

@dustinlindquist
Copy link

dustinlindquist commented Oct 21, 2017

Terraform Version

Terraform v0.10.7

Affected Resource(s)

  • resource_datadog_timeboard

Debug Output

Failed new testcase for setting palette_flip = true
[Failed testcase after attempting to fix issue by using a map[string]interface instead of a map[string]interface{}(https://gist.github.com/dustinlindquist/f93cea9d87e74b3f763dcd43575cdbf6)

Expected Behavior

If include a style.palette_flip of true or false in a call to update a datadog timeboard:

style {
    palette_flip = true
}

I would expect the call to datadog to include this field and change it respectively.

Actual Behavior

The palette_flip field is not modified and remains defaulted to false.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. add the graph.style.palette_flip = true to "config2" in the resource_datadog_timeboard_test.go

  2. add a valid expectation to the step2.Checks

  3. run the tests and observe the failure.

  4. One can also reproduce this by attempting to set the palette_flip field to true on any hostmap for any timeboard they're trying to update.

Important Factoids

The cause of this appears to be that the graph.style field is a map[string]string{}, forcing the need for the boolean field to be passed as a string. Upon changing it to a map[string]interface{}{} the issue then appears to be related to the 'WeaklyTypeInput' config option from mitchellh/mapstrucutre

that field defaults to false when the decoder is initialized

locally if I set that decoder config to:

config := &DecoderConfig{
    Metadata:         nil,
    Result:           rawVal,
    WeaklyTypedInput: true,
}

then my fix of the graph.style being a map of interfaces instead of a map of strings works.
I've thrown up a branch with my work: https://github.com/dustinlindquist/terraform-provider-datadog/tree/issue29-palette_flip-as-bool

cc @mitchellh

@radeksimko radeksimko added the bug label Oct 30, 2017
@masci masci self-assigned this Oct 31, 2018
@masci masci added this to the 1.6.0 milestone Nov 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants