rancher_environment: initialize envClient only when members are set

This commit is contained in:
Raphaël Pinson 2017-05-18 09:35:13 +02:00
parent 4f521c74b0
commit 1392670a69
No known key found for this signature in database
GPG Key ID: DF0A493B74BF771E
1 changed files with 4 additions and 4 deletions

View File

@ -107,11 +107,11 @@ func resourceRancherEnvironmentCreate(d *schema.ResourceData, meta interface{})
log.Printf("[INFO] Environment ID: %s", d.Id())
// Add members
envClient, err := meta.(*Config).EnvironmentClient(d.Id())
if err != nil {
return err
}
if v, ok := d.GetOk("members"); ok {
envClient, err := meta.(*Config).EnvironmentClient(d.Id())
if err != nil {
return err
}
members := v.([]interface{})
_, err = envClient.Project.ActionSetmembers(&newEnv, &rancherClient.SetProjectMembersInput{
Members: members,