Skip to content

Commit

Permalink
[andromeda] allow pool_id to be optional in gslb member
Browse files Browse the repository at this point in the history
  • Loading branch information
kayrus committed Oct 22, 2024
1 parent 8f06132 commit 4afc5cd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions ccloud/resource_ccloud_gslb_member_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func resourceCCloudGSLBMemberV1() *schema.Resource {
},
"pool_id": {
Type: schema.TypeString,
Required: true,
Optional: true,
},
"port": {
Type: schema.TypeInt,
Expand Down Expand Up @@ -96,12 +96,10 @@ func resourceCCloudGSLBMemberV1Create(ctx context.Context, d *schema.ResourceDat
adminStateUp := d.Get("admin_state_up").(bool)
address := strfmt.IPv4(d.Get("address").(string))
port := int64(d.Get("port").(int))
poolID := strfmt.UUID(d.Get("pool_id").(string))
member := &models.Member{
Address: &address,
AdminStateUp: &adminStateUp,
Port: &port,
PoolID: &poolID,
}
if v, ok := d.GetOk("datacenter_id"); ok && v != "" {
v := strfmt.UUID(v.(string))
Expand All @@ -113,6 +111,10 @@ func resourceCCloudGSLBMemberV1Create(ctx context.Context, d *schema.ResourceDat
if v, ok := d.GetOk("project_id"); ok && v != "" {
member.ProjectID = ptr(v.(string))
}
if v, ok := d.GetOk("pool_id"); ok && v != "" {
v := strfmt.UUID(v.(string))
member.PoolID = &v
}

opts := &members.PostMembersParams{
Member: members.PostMembersBody{
Expand Down Expand Up @@ -181,7 +183,6 @@ func resourceCCloudGSLBMemberV1Update(ctx context.Context, d *schema.ResourceDat
id := d.Id()
member := &models.Member{
Address: ptr(strfmt.IPv4(d.Get("address").(string))),
PoolID: ptr(strfmt.UUID(d.Get("pool_id").(string))),
DatacenterID: ptr(strfmt.UUID(d.Get("datacenter_id").(string))),
Port: ptr(int64(d.Get("port").(int))),
}
Expand All @@ -198,6 +199,10 @@ func resourceCCloudGSLBMemberV1Update(ctx context.Context, d *schema.ResourceDat
v := d.Get("project_id").(string)
member.ProjectID = &v
}
if d.HasChange("pool_id") {
v := strfmt.UUID(d.Get("pool_id").(string))
member.PoolID = &v
}

opts := &members.PutMembersMemberIDParams{
Member: members.PutMembersMemberIDBody{
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/gslb_member_v1.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The following arguments are supported:

* `name` - (Optional) The name of the GSLB member.

* `pool_id` - (Required) The UUID of the GSLB pool to which the member belongs.
* `pool_id` - (Optional) The UUID of the GSLB pool to which the member belongs.

* `port` - (Required) The port on which the member is accepting traffic.

Expand Down

0 comments on commit 4afc5cd

Please sign in to comment.