provider/random: Use schema Noop functions
This commit is contained in:
parent
314a56e503
commit
a7451bfab3
|
@ -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
|
|
||||||
}
|
|
||||||
|
|
|
@ -7,23 +7,23 @@ import (
|
||||||
func resourceShuffle() *schema.Resource {
|
func resourceShuffle() *schema.Resource {
|
||||||
return &schema.Resource{
|
return &schema.Resource{
|
||||||
Create: CreateShuffle,
|
Create: CreateShuffle,
|
||||||
Read: stubRead,
|
Read: schema.Noop,
|
||||||
Delete: stubDelete,
|
Delete: schema.RemoveFromState,
|
||||||
|
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"keepers": &schema.Schema{
|
"keepers": {
|
||||||
Type: schema.TypeMap,
|
Type: schema.TypeMap,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
ForceNew: true,
|
ForceNew: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
"seed": &schema.Schema{
|
"seed": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
ForceNew: true,
|
ForceNew: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
"input": &schema.Schema{
|
"input": {
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
ForceNew: true,
|
||||||
|
@ -32,7 +32,7 @@ func resourceShuffle() *schema.Resource {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
"result": &schema.Schema{
|
"result": {
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Elem: &schema.Schema{
|
Elem: &schema.Schema{
|
||||||
|
@ -40,7 +40,7 @@ func resourceShuffle() *schema.Resource {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
"result_count": &schema.Schema{
|
"result_count": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
ForceNew: 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{})
|
input := d.Get("input").([]interface{})
|
||||||
seed := d.Get("seed").(string)
|
seed := d.Get("seed").(string)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue