Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new field 'consistent balancing' #176

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/resources/cdn_origingroup.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ resource "edgecenter_cdn_origingroup" "origin_group_1" {
enabled = true
backup = true
}
consistent_balancing = true
}
```

Expand All @@ -37,6 +38,7 @@ resource "edgecenter_cdn_origingroup" "origin_group_1" {

### Required

- `consistent_balancing` (Boolean) Consistent load balancing (consistent hashing) for the source group
- `name` (String) Add the source group name.
- `origin` (Block Set, Min: 1) Add information about your sources. (see [below for nested schema](#nestedblock--origin))
- `use_next` (Boolean) Specify whether or not the CDN will use the next source in the list if your source responds with an HTTP status code of 4XX or 5XX.
Expand Down
6 changes: 6 additions & 0 deletions edgecenter/resource_edgecenter_cdn_origin_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ func resourceCDNOriginGroup() *schema.Resource {
},
},
},
"consistent_balancing": {
Type: schema.TypeBool,
Required: true,
Description: "Consistent load balancing (consistent hashing) for the source group",
},
},
CreateContext: resourceCDNOriginGroupCreate,
ReadContext: resourceCDNOriginGroupRead,
Expand All @@ -79,6 +84,7 @@ func resourceCDNOriginGroupCreate(ctx context.Context, d *schema.ResourceData, m
req.Name = d.Get("name").(string)
req.UseNext = d.Get("use_next").(bool)
req.Origins = setToOriginRequests(d.Get("origin").(*schema.Set))
req.ConsistentBalancing = d.Get("consistent_balancing").(bool)

result, err := client.OriginGroups().Create(ctx, &req)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func TestAccOriginGroup(t *testing.T) {
source = "yandex.ru"
enabled = true
}
consistent_balancing = true
}
`, params.Source, params.Enabled)
}
Expand Down
1 change: 1 addition & 0 deletions examples/resources/edgecenter_cdn_origingroup/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ resource "edgecenter_cdn_origingroup" "origin_group_1" {
enabled = true
backup = true
}
consistent_balancing = true
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/AlekSi/pointer v1.2.0
github.com/Edge-Center/edgecenter-dns-sdk-go v0.1.3
github.com/Edge-Center/edgecenter-storage-sdk-go v0.2.0
github.com/Edge-Center/edgecentercdn-go v0.1.8
github.com/Edge-Center/edgecentercdn-go v0.1.10
github.com/Edge-Center/edgecentercloud-go v0.1.11
github.com/Edge-Center/edgecentercloud-go/v2 v2.1.4-0.20240703075841-dfdec037dd37
github.com/connerdouglass/go-retry v1.0.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ github.com/Edge-Center/edgecenter-dns-sdk-go v0.1.3 h1:k36RWZ+dteXLMiEsu/KiSFSaN
github.com/Edge-Center/edgecenter-dns-sdk-go v0.1.3/go.mod h1:xWN2LYVokamADMRz1cPhOrYX/NlxiDJp9tjBumHU5G8=
github.com/Edge-Center/edgecenter-storage-sdk-go v0.2.0 h1:1aPDpywWbaF7VEjP/GjVoSgcipxWTTzEPPZv5kOWE8A=
github.com/Edge-Center/edgecenter-storage-sdk-go v0.2.0/go.mod h1:TcWO0BPvDsE6AGlPBqpKCZhoQ70rRlqmm85J32qcL8I=
github.com/Edge-Center/edgecentercdn-go v0.1.8 h1:ImGcpQ/jSY3D5aSWzEca2+YgDV/Gd7jWQJbKnphBV8I=
github.com/Edge-Center/edgecentercdn-go v0.1.8/go.mod h1:RwEyxwPAmxor1mZKUTa2bIU2p5qM6kcAofUkaE4O1V4=
github.com/Edge-Center/edgecentercdn-go v0.1.10 h1:Hj+SjvPClhOYtpmoS2g33WrxyHitUBHroNSwRBZ9P1U=
github.com/Edge-Center/edgecentercdn-go v0.1.10/go.mod h1:RwEyxwPAmxor1mZKUTa2bIU2p5qM6kcAofUkaE4O1V4=
github.com/Edge-Center/edgecentercloud-go v0.1.11 h1:00h5o/71lEoSdU1B4AWmviuOfO28P6nsRP+afjIsW80=
github.com/Edge-Center/edgecentercloud-go v0.1.11/go.mod h1:kmXGtx0lL1ib+SPfJe/uIAyDHamquAvqiftoLSyhxF8=
github.com/Edge-Center/edgecentercloud-go/v2 v2.1.4-0.20240703075841-dfdec037dd37 h1:Q2qKSUaKOxXr9s5ACVC5/zcQMjjFBTX/NUwoTQS/4m8=
Expand Down
Loading