However - as the package name suggests - this package is not meant to deal with such validation and using it for simple multi-attribute plan-time validation can feel awkward.
Such validation also doesn't run during terraform validate, but "later" during terraform plan.
Problem Statement
Providers today are able to validate multiple attributes using
customdiff
'sValidate*
functions:https://godoc.org/github.com/hashicorp/terraform-plugin-sdk/helper/customdiff#ValidateValue https://godoc.org/github.com/hashicorp/terraform-plugin-sdk/helper/customdiff#ValidateChange
However - as the package name suggests - this package is not meant to deal with such validation and using it for simple multi-attribute plan-time validation can feel awkward.
Such validation also doesn't run during
terraform validate
, but "later" duringterraform plan
.Examples
https://github.com/terraform-providers/terraform-provider-azurerm/blob/94cf18b287d634ee16aa5e37d3a73d3e8a356fa4/azurerm/resource_arm_cosmosdb_account.go#L384-L392
https://github.com/terraform-providers/terraform-provider-aws/blob/98b8b848ca94031b20c3e626c9d40484e3af80de/aws/resource_aws_lb_target_group.go#L684-L692
https://github.com/terraform-providers/terraform-provider-aws/issues/10963
Proposal
TODO