Dynamic type in schema

Hi!

I am working with an API that has a dynamic field. Depending on whether I send a string (for instance"0.5") or a number (0.5), the result will differ significantly.
Is it possible to express this using the Terraform SDK?

Ideally I’d like to get different types from d.Get("value") when a user specifies:

value = "0.5"

and

value = 0.5

Looking at the documentation of Schema.Type I’d guess the answer is no. If I set Type = schema.TypeString, d.Get("value") always returns a string.
Is there work being done in this area?

Thanks!

This is not currently possible using the SDK. It is the subject of ongoing work (see, for example, terraform-provider-kubernetes-alpha).

1 Like