Terraform: Can't create a null_data_source map of lists

Created on 12 Aug 2016  路  3Comments  路  Source: hashicorp/terraform

Trying to find a workaround for #8153 I attempted to use null_data_source. This worked fine for a map of strings, but doesn't work for a map of lists. Since there is no documentation on null_data_source this might be a feature not a bug (though the lack of documentation is a bug :) )

Terraform Version

Terraform v0.7.0

Affected Resource(s)

  • null_data_source

    Terraform Configuration Files

data "null_data_source" "testmapds" {
    inputs = {
        key1 = ["value11", "value12"]
        key2 = ["value21", "value22"]
    }
}

Expected Behavior

A map of lists

Actual Behavior

Error refreshing state: 1 error(s) occurred:

* inputs: 2 error(s) decoding:

* '[key1]' expected type 'string', got unconvertible type '[]interface {}'
* '[key2]' expected type 'string', got unconvertible type '[]interface {}'

Steps to Reproduce

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

  1. terraform apply
enhancement hashiboignore providenull

All 3 comments

Hi @WolverineFan! Thanks for opening an issue. This isn't possible right now because of limitations in HCL and the helper/schema interface. null_data_source was never really intended for public use (according to @apparentlymart, it's author!). I don't have a timescale for when we can fix this, unfortunately.

Thanks for the feedback. Now that I have a valid workaround for output maps https://github.com/hashicorp/terraform/issues/8153#issuecomment-239548132 I'm good. If anyone needs it, I suspect that same workaround would work fine for null_data_source as well (though I haven't tested it).

Since this was just in service of a workaround anyway, I'm going to close this out now. The new features coming in Terraform v0.12.0 will hopefully take care of any remaining use-cases that might've caused use of null_data_source as a workaround. If not, please let us know in a new issue!

Was this page helpful?
0 / 5 - 0 ratings