rancher_environment: initialize envClient only when members are set
This commit is contained in:
parent
4f521c74b0
commit
1392670a69
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue