rancher_environment: do not crash on empty members

This commit is contained in:
Raphaël Pinson 2017-05-17 18:20:33 +02:00
parent 01e9011231
commit d75ff93165
No known key found for this signature in database
GPG Key ID: DF0A493B74BF771E
1 changed files with 8 additions and 6 deletions

View File

@ -114,13 +114,15 @@ func resourceRancherEnvironmentCreate(d *schema.ResourceData, meta interface{})
if err != nil {
return err
}
members := d.Get("members").([]interface{})
if v, ok := d.GetOk("members"); ok {
members := v.([]interface{})
_, err = envClient.Project.ActionSetmembers(&newEnv, &rancherClient.SetProjectMembersInput{
Members: members,
})
if err != nil {
return err
}
}
return resourceRancherEnvironmentRead(d, meta)
}