terraform-plugin-sdk icon indicating copy to clipboard operation
terraform-plugin-sdk copied to clipboard

"ValidateFunc is not yet supported on lists or sets"

Open immarvin opened this issue 5 years ago • 4 comments

Hi, when I am trying to add some validation for TypeList attribute in my resource schema, terraform validate complain this message. I wonder why Terraform impose such restriction, is it necessary? thanks

immarvin avatar May 14 '19 03:05 immarvin

Is there a good reason this isn't supported or does the work just need to be done to implement it?

dwradcliffe avatar Sep 19 '19 12:09 dwradcliffe

Is there a workaround for this?

ctrombley avatar Nov 07 '19 19:11 ctrombley

Hi guys!

Any updates on this?

I see a https://github.com/hashicorp/terraform-plugin-sdk/blob/v1.11.0/helper/validation/list.go but it seems that it's unusable because of https://github.com/hashicorp/terraform-plugin-sdk/blob/v1.11.0/helper/schema/schema.go#L852.

ozerovandrei avatar May 02 '20 13:05 ozerovandrei

it's nearly 3 years now, if there are no plans on implementing this, at least close this issue with acknowledgment.

AniketKariya avatar Apr 21 '22 15:04 AniketKariya

I needed this today. It would be useful to have ValidateFuncs supported on schema.TypeList for my use case

brianonn avatar Jan 25 '23 05:01 brianonn

is there any workaround for this?

iamunni avatar Jun 03 '23 22:06 iamunni

The newer Terraform Plugin Framework, which was released last year, was developed from the ground up to not impose type-based restrictions on configuration validation logic amongst many other benefits. In particular, the HashiCorp Developer website includes framework documentation pages dedicated to validation for resource, data source, and provider configurations. It also provides a SDK migration guide for existing providers, including the ability to iteratively introduce framework resources alongside SDK resources using Terraform Plugin Mux, if desired.

Given the likelihood that this particular feature will not be implemented in this SDK and that it is already implemented in the newer framework, I'm going to close this issue as suggested by https://github.com/hashicorp/terraform-plugin-sdk/issues/156#issuecomment-1105348253.

bflad avatar Jun 05 '23 14:06 bflad

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar Jul 06 '23 02:07 github-actions[bot]