Skip to content

Commit

Permalink
Merge pull request #14 from vngcloud/iam-vserver
Browse files Browse the repository at this point in the history
fix bug change security group
  • Loading branch information
manhtu1997 authored Feb 20, 2023
2 parents ea17aa2 + acaca84 commit 2bedf6b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
5 changes: 0 additions & 5 deletions resource/vserver/resource_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,6 @@ func resourceServerRead(d *schema.ResourceData, m interface{}) error {
externalInterfaces = append(externalInterfaces, externalInterfaceMap)
}
d.Set("external_interfaces", externalInterfaces)
var securityGroups []string
for _, secGroup := range server.SecGroups {
securityGroups = append(securityGroups, secGroup.Uuid)
}
d.Set("security_group", securityGroups)
return nil
}

Expand Down
3 changes: 2 additions & 1 deletion resource/vserver/resource_server_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ func resourceServerGroupCreate(d *schema.ResourceData, m interface{}) error {
}

func resourceServerGroupUpdate(d *schema.ResourceData, m interface{}) error {
if d.HasChange("description") {
if d.HasChange("description") || d.HasChange("name") {
projectID := d.Get("project_id").(string)
updateServerGroupRequest := vserver.UpdateServerGroupRequestV2{
Description: d.Get("description").(string),
Name: d.Get("name").(string),
}
cli := m.(*client.Client)
resp, httpResponse, _ := cli.VserverClient.ServerGroupRestControllerApi.UpdateServerGroupUsingPUT1(context.TODO(), projectID, d.Id(), updateServerGroupRequest)
Expand Down

0 comments on commit 2bedf6b

Please sign in to comment.