provider/triton: support importing triton_key
This commit is contained in:
parent
6bdab07174
commit
e1e1a08569
|
@ -20,6 +20,9 @@ func resourceKey() *schema.Resource {
|
|||
Exists: resourceKeyExists,
|
||||
Read: resourceKeyRead,
|
||||
Delete: resourceKeyDelete,
|
||||
Importer: &schema.ResourceImporter{
|
||||
State: resourceKeyImporter,
|
||||
},
|
||||
|
||||
Schema: map[string]*schema.Schema{
|
||||
"name": &schema.Schema{
|
||||
|
@ -87,7 +90,7 @@ func resourceKeyExists(d *schema.ResourceData, meta interface{}) (bool, error) {
|
|||
func resourceKeyRead(d *schema.ResourceData, meta interface{}) error {
|
||||
client := meta.(*cloudapi.Client)
|
||||
|
||||
key, err := client.GetKey(d.Get("name").(string))
|
||||
key, err := client.GetKey(d.Id())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -108,3 +111,7 @@ func resourceKeyDelete(d *schema.ResourceData, meta interface{}) error {
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
func resourceKeyImporter(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
|
||||
return []*schema.ResourceData{d}, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue