terraform-provider-google/vendor/github.com/hashicorp/terraform/helper/customdiff/computed.go
Vincent Roseberry c9826b1452
Support subnetwork IP CIDR range expansion (#945)
* Vendor schema/helper/customdiff

* Support subnetwork IP CIDR range expansion

* Change wording
2018-01-17 12:58:37 -08:00

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
}
}