import ( "github.com/hashicorp/terraform/helper/schema" ) func resourceMyResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ "my_attribute": &schema.Schema{ Type: schema.TypeString, Required: true, }, }, Create: resourceMyResourceCreate, Read: resourceMyResourceRead, Update: resourceMyResourceUpdate, Delete: resourceMyResourceDelete, } } func resourceMyResourceCreate(d *schema.ResourceData, m interface{}) error { myAttribute := d.Get("my_attribute").(string) // do something with myAttribute d.Set("my_attribute", myAttribute) return nil }
import ( "github.com/hashicorp/terraform/helper/schema" ) func resourceMyResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ "my_attribute": &schema.Schema{ Type: schema.TypeString, Required: true, Description: "Some description of my_attribute", }, }, Create: resourceMyResourceCreate, Read: resourceMyResourceRead, Update: resourceMyResourceUpdate, Delete: resourceMyResourceDelete, } }In this example, `Describe` is used to provide a description of the `my_attribute` schema attribute, which will be shown to users when they view the resource within the Terraform CLI. Overall, the `github.com/hashicorp/terraform/helper/schema` package is a part of the Terraform framework and provides helpers for defining and validating the schema for Terraform resources.