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