import ( "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/schema.ResourceData" ) func resourceUpdate(d *schema.ResourceData, m interface{}) error { changes := d.GetChange("my_property") if changes != nil { oldVal, newVal := changes.([]interface{}) // do something with oldVal and newVal } // rest of the function }
import ( "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/schema.ResourceData" ) func resourceCreate(d *schema.ResourceData, m interface{}) error { changes := d.GetChange("my_property") if changes == nil { // my_property has not changed } // rest of the function }In this example, we define a function that is called when the "my_resource" resource is created. We use "ResourceData.GetChange" to check if the "my_property" property has changed, and if not, we do something else. Overall, the "github.com.hashicorp.terraform.helper.schema" package library provides convenient functions for working with the schema of Terraform providers, and "ResourceData.GetChange" is one of the functions that can help to retrieve changes made to a resource.