mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-23 07:02:57 -06:00
eec6c88fd2
random_shuffle takes a list of strings and returns a new list with the same items in a random permutation. Optionally allows the result list to be a different length than the input list. A shorter result than input results in some items being excluded. A longer result than input results in some items being repeated, but never more often than the number of input items.
32 lines
846 B
Go
32 lines
846 B
Go
package random
|
|
|
|
import (
|
|
"github.com/hashicorp/terraform/helper/schema"
|
|
"github.com/hashicorp/terraform/terraform"
|
|
)
|
|
|
|
// Provider returns a terraform.ResourceProvider.
|
|
func Provider() terraform.ResourceProvider {
|
|
return &schema.Provider{
|
|
Schema: map[string]*schema.Schema{},
|
|
|
|
ResourcesMap: map[string]*schema.Resource{
|
|
"random_id": resourceId(),
|
|
"random_shuffle": resourceShuffle(),
|
|
},
|
|
}
|
|
}
|
|
|
|
// 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
|
|
}
|