provider/random: Use schema Noop functions

This commit is contained in:
James Nugent 2016-11-06 10:07:38 -06:00
parent 314a56e503
commit a7451bfab3
2 changed files with 8 additions and 21 deletions

View File

@ -16,16 +16,3 @@ func Provider() terraform.ResourceProvider {
},
}
}
// stubRead is a do-nothing Read implementation used for our resources,
// which don't actually need to do anything on read.
func stubRead(d *schema.ResourceData, meta interface{}) error {
return nil
}
// stubDelete is a do-nothing Dete implementation used for our resources,
// which don't actually need to do anything unusual on delete.
func stubDelete(d *schema.ResourceData, meta interface{}) error {
d.SetId("")
return nil
}

View File

@ -7,23 +7,23 @@ import (
func resourceShuffle() *schema.Resource {
return &schema.Resource{
Create: CreateShuffle,
Read: stubRead,
Delete: stubDelete,
Read: schema.Noop,
Delete: schema.RemoveFromState,
Schema: map[string]*schema.Schema{
"keepers": &schema.Schema{
"keepers": {
Type: schema.TypeMap,
Optional: true,
ForceNew: true,
},
"seed": &schema.Schema{
"seed": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"input": &schema.Schema{
"input": {
Type: schema.TypeList,
Required: true,
ForceNew: true,
@ -32,7 +32,7 @@ func resourceShuffle() *schema.Resource {
},
},
"result": &schema.Schema{
"result": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
@ -40,7 +40,7 @@ func resourceShuffle() *schema.Resource {
},
},
"result_count": &schema.Schema{
"result_count": {
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
@ -49,7 +49,7 @@ func resourceShuffle() *schema.Resource {
}
}
func CreateShuffle(d *schema.ResourceData, meta interface{}) error {
func CreateShuffle(d *schema.ResourceData, _ interface{}) error {
input := d.Get("input").([]interface{})
seed := d.Get("seed").(string)