mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-09-18 17:19:58 +00:00
c9826b1452
* Vendor schema/helper/customdiff * Support subnetwork IP CIDR range expansion * Change wording
17 lines
427 B
Go
17 lines
427 B
Go
package customdiff
|
|
|
|
import (
|
|
"github.com/hashicorp/terraform/helper/schema"
|
|
)
|
|
|
|
// ComputedIf returns a CustomizeDiffFunc that sets the given key's new value
|
|
// as computed if the given condition function returns true.
|
|
func ComputedIf(key string, f ResourceConditionFunc) schema.CustomizeDiffFunc {
|
|
return func(d *schema.ResourceDiff, meta interface{}) error {
|
|
if f(d, meta) {
|
|
d.SetNewComputed(key)
|
|
}
|
|
return nil
|
|
}
|
|
}
|