Skip to content

Commit 587f5ca

Browse files
authored
Merge branch 'master' into update-doc-cockpit
2 parents ce30112 + c283df4 commit 587f5ca

40 files changed

+13851
-1042
lines changed

.github/workflows/acceptance-tests.yaml

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,79 @@ jobs:
5454
uses: actions/setup-go@v5
5555
with:
5656
go-version: 1.24.0
57+
# This CI supports skipping flaky or broken tests via GitHub repository variables.
58+
# This allows quick fixes without code changes when tests break due to external factors.
59+
#
60+
# HOW TO SKIP TESTS:
61+
# 1. Go to: Settings → Secrets and variables → Actions → Variables
62+
# 2. Create or edit Repository variables:
63+
# - SKIP_TESTS_<PRODUCT>: Skip patterns for any product (uppercase)
64+
# - SKIP_TESTS_ALL: Skip patterns applied to ALL products
65+
#
66+
# PATTERN SYNTAX:
67+
# - Single test: TestAccServer_Basic
68+
# - Multiple tests: TestAccServer_Basic|TestAccServer_Other
69+
# - Wildcard: TestAccServer.*
70+
# - Contains: .*IPAM.*
71+
#
72+
# EXAMPLE:
73+
# Variable: SKIP_TESTS_BAREMETAL
74+
# Value: TestAccServer_Basic|TestAccServer_WithIPAMPrivateNetwork
75+
- name: Determine Skip Pattern
76+
id: skip-config
77+
run: |
78+
PRODUCT="${{ matrix.products }}"
79+
SKIP_PATTERN=""
80+
81+
case "$PRODUCT" in
82+
baremetal)
83+
SKIP_PATTERN="$SKIP_TESTS_BAREMETAL"
84+
;;
85+
esac
86+
87+
if [ -n "$SKIP_TESTS_ALL" ]; then
88+
if [ -n "$SKIP_PATTERN" ]; then
89+
SKIP_PATTERN="${SKIP_PATTERN}|${SKIP_TESTS_ALL}"
90+
else
91+
SKIP_PATTERN="$SKIP_TESTS_ALL"
92+
fi
93+
fi
94+
95+
echo "skip_pattern=$SKIP_PATTERN" >> $GITHUB_OUTPUT
96+
env:
97+
SKIP_TESTS_BAREMETAL: ${{ vars.SKIP_TESTS_BAREMETAL }}
98+
SKIP_TESTS_ALL: ${{ vars.SKIP_TESTS_ALL }}
5799
- name: Run Acceptance Tests
58-
run: go test -v ./internal/services/${{ matrix.products }} -timeout=2h
100+
run: |
101+
SKIP_PATTERN="${{ steps.skip-config.outputs.skip_pattern }}"
102+
103+
if [ -n "$SKIP_PATTERN" ]; then
104+
echo ""
105+
echo "SKIPPING TESTS"
106+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
107+
echo "Pattern: $SKIP_PATTERN"
108+
echo ""
109+
echo "Tests that will be skipped:"
110+
go test -list=. ./internal/services/${{ matrix.products }} | grep -E "$SKIP_PATTERN" || true
111+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
112+
echo ""
113+
114+
go test -v ./internal/services/${{ matrix.products }} -timeout=2h -skip="$SKIP_PATTERN"
115+
TEST_RESULT=$?
116+
else
117+
go test -v ./internal/services/${{ matrix.products }} -timeout=2h
118+
TEST_RESULT=$?
119+
fi
120+
121+
if [ -n "$SKIP_PATTERN" ]; then
122+
echo ""
123+
echo "CI Skip Configuration:"
124+
echo "Pattern: $SKIP_PATTERN"
125+
echo "To modify: Update SKIP_TESTS_$(echo ${{ matrix.products }} | tr '[:lower:]' '[:upper:]') in GitHub repository variables"
126+
fi
127+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
128+
129+
exit $TEST_RESULT
59130
env:
60131
TF_LOG: DEBUG
61132
TF_ACC: 1

.github/workflows/nightly.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
products:
1414
- account
1515
- applesilicon
16+
- autoscaling
1617
- az
1718
- baremetal
1819
- billing
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
---
2+
subcategory: "Autoscaling"
3+
page_title: "Scaleway: scaleway_autoscaling_instance_group"
4+
---
5+
6+
# Resource: scaleway_autoscaling_instance_group
7+
8+
Books and manages Autoscaling Instance groups.
9+
10+
## Example Usage
11+
12+
### Basic
13+
14+
```terraform
15+
resource "scaleway_autoscaling_instance_group" "main" {
16+
name = "asg-group"
17+
template_id = scaleway_autoscaling_instance_template.main.id
18+
tags = ["terraform-test", "instance-group"]
19+
capacity {
20+
max_replicas = 5
21+
min_replicas = 1
22+
cooldown_delay = "300"
23+
}
24+
load_balancer {
25+
id = scaleway_lb.main.id
26+
backend_ids = [scaleway_lb_backend.main.id]
27+
private_network_id = scaleway_vpc_private_network.main.id
28+
}
29+
}
30+
```
31+
32+
### With template and policies
33+
34+
```terraform
35+
resource "scaleway_vpc" "main" {
36+
name = "TestAccAutoscalingVPC"
37+
}
38+
39+
resource "scaleway_vpc_private_network" "main" {
40+
name = "TestAccAutoscalingVPC"
41+
vpc_id = scaleway_vpc.main.id
42+
}
43+
44+
resource "scaleway_block_volume" "main" {
45+
iops = 5000
46+
size_in_gb = 10
47+
}
48+
49+
resource "scaleway_block_snapshot" "main" {
50+
name = "test-ds-block-snapshot-basic"
51+
volume_id = scaleway_block_volume.main.id
52+
}
53+
54+
resource "scaleway_lb_ip" "main" {}
55+
resource "scaleway_lb" "main" {
56+
ip_id = scaleway_lb_ip.main.id
57+
name = "test-lb"
58+
type = "lb-s"
59+
private_network {
60+
private_network_id = scaleway_vpc_private_network.main.id
61+
}
62+
}
63+
64+
resource "scaleway_lb_backend" "main" {
65+
lb_id = scaleway_lb.main.id
66+
forward_protocol = "tcp"
67+
forward_port = 80
68+
proxy_protocol = "none"
69+
}
70+
71+
resource "scaleway_autoscaling_instance_template" "main" {
72+
name = "autoscaling-instance-template-basic"
73+
commercial_type = "PLAY2-MICRO"
74+
tags = ["terraform-test", "basic"]
75+
volumes {
76+
name = "as-volume"
77+
volume_type = "sbs"
78+
boot = true
79+
from_snapshot {
80+
snapshot_id = scaleway_block_snapshot.main.id
81+
}
82+
perf_iops = 5000
83+
}
84+
public_ips_v4_count = 1
85+
private_network_ids = [scaleway_vpc_private_network.main.id]
86+
}
87+
88+
resource "scaleway_autoscaling_instance_group" "main" {
89+
name = "autoscaling-instance-group-basic"
90+
template_id = scaleway_autoscaling_instance_template.main.id
91+
tags = ["terraform-test", "instance-group"]
92+
capacity {
93+
max_replicas = 5
94+
min_replicas = 1
95+
cooldown_delay = "300"
96+
}
97+
load_balancer {
98+
id = scaleway_lb.main.id
99+
backend_ids = [scaleway_lb_backend.main.id]
100+
private_network_id = scaleway_vpc_private_network.main.id
101+
}
102+
delete_servers_on_destroy = true
103+
}
104+
105+
resource "scaleway_autoscaling_instance_policy" "up" {
106+
instance_group_id = scaleway_autoscaling_instance_group.main.id
107+
name = "scale-up-if-cpu-high"
108+
action = "scale_up"
109+
type = "flat_count"
110+
value = 1
111+
priority = 1
112+
113+
metric {
114+
name = "cpu scale up"
115+
managed_metric = "managed_metric_instance_cpu"
116+
operator = "operator_greater_than"
117+
aggregate = "aggregate_average"
118+
sampling_range_min = 5
119+
threshold = 70
120+
}
121+
}
122+
123+
resource "scaleway_autoscaling_instance_policy" "down" {
124+
instance_group_id = scaleway_autoscaling_instance_group.main.id
125+
name = "scale-down-if-cpu-low"
126+
action = "scale_down"
127+
type = "flat_count"
128+
value = 1
129+
priority = 2
130+
131+
metric {
132+
name = "cpu scale down"
133+
managed_metric = "managed_metric_instance_cpu"
134+
operator = "operator_less_than"
135+
aggregate = "aggregate_average"
136+
sampling_range_min = 5
137+
threshold = 40
138+
}
139+
}
140+
```
141+
142+
## Argument Reference
143+
144+
The following arguments are supported:
145+
146+
- `template_id` - (Required) The ID of the Instance template to attach to the Instance group.
147+
- `tags` - (Optional) The tags associated with the Instance group.
148+
- `name` - (Optional) The Instance group name.
149+
- `capacity` - (Optional) The specification of the minimum and maximum replicas for the Instance group, and the cooldown interval between two scaling events.
150+
- `max_replicas` - The maximum count of Instances for the Instance group.
151+
- `min_replicas` - The minimum count of Instances for the Instance group.
152+
- `cooldown_delay` - Time (in seconds) after a scaling action during which requests to carry out a new scaling action will be denied.
153+
- `load_balancer` - (Optional) The specification of the Load Balancer to link to the Instance group.
154+
- `id` - The ID of the Load Balancer.
155+
- `backend_ids` - The Load Balancer backend IDs.
156+
- `private_network_id` - The ID of the Private Network attached to the Load Balancer.
157+
- `delete_servers_on_destroy` - (Optional) Whether to delete all instances in this group when the group is destroyed. Set to `true` to tear them down, `false` (the default) leaves them running.
158+
- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the Instance group exists.
159+
- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the Project the Instance group is associated with.
160+
161+
## Attributes Reference
162+
163+
In addition to all arguments above, the following attributes are exported:
164+
165+
- `id` - The ID of the Instance group.
166+
- `created_at` - Date and time of Instance group's creation (RFC 3339 format).
167+
- `updated_at` - Date and time of Instance group's last update (RFC 3339 format).
168+
169+
~> **Important:** Autoscaling Instance group IDs are [zonal](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111`
170+
171+
## Import
172+
173+
Autoscaling Instance groups can be imported using `{zone}/{id}`, e.g.
174+
175+
```bash
176+
terraform import scaleway_autoscaling_instance_group.main fr-par-1/11111111-1111-1111-1111-111111111111
177+
```
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
subcategory: "Autoscaling"
3+
page_title: "Scaleway: scaleway_autoscaling_instance_policy"
4+
---
5+
6+
# Resource: scaleway_autoscaling_instance_policy
7+
8+
Books and manages Autoscaling Instance policies.
9+
10+
## Example Usage
11+
12+
### Basic
13+
14+
```terraform
15+
resource "scaleway_autoscaling_instance_policy" "up" {
16+
instance_group_id = scaleway_autoscaling_instance_group.main.id
17+
name = "scale-up-if-cpu-high"
18+
action = "scale_up"
19+
type = "flat_count"
20+
value = 1
21+
priority = 1
22+
23+
metric {
24+
name = "cpu scale up"
25+
managed_metric = "managed_metric_instance_cpu"
26+
operator = "operator_greater_than"
27+
aggregate = "aggregate_average"
28+
sampling_range_min = 5
29+
threshold = 70
30+
}
31+
}
32+
33+
resource "scaleway_autoscaling_instance_policy" "down" {
34+
instance_group_id = scaleway_autoscaling_instance_group.main.id
35+
name = "scale-down-if-cpu-low"
36+
action = "scale_down"
37+
type = "flat_count"
38+
value = 1
39+
priority = 2
40+
41+
metric {
42+
name = "cpu scale down"
43+
managed_metric = "managed_metric_instance_cpu"
44+
operator = "operator_less_than"
45+
aggregate = "aggregate_average"
46+
sampling_range_min = 5
47+
threshold = 40
48+
}
49+
}
50+
```
51+
52+
## Argument Reference
53+
54+
The following arguments are supported:
55+
56+
- `instance_group_id` - (Required) The ID of the Instance group related to this policy.
57+
- `name` - (Optional) The Instance policy name.
58+
- `action` - (Required) The action to execute when the metric-based condition is met.
59+
- `type` - (Required) How to use the number defined in `value` when determining by how many Instances to scale up/down.
60+
- `value` - (Required) The value representing the magnitude of the scaling action to take for the Instance group. Depending on the `type` parameter, this number could represent a total number of Instances in the group, a number of Instances to add, or a percentage to scale the group by.
61+
- `priority` - (Required) The priority of this policy compared to all other scaling policies. This determines the processing order. The lower the number, the higher the priority.
62+
- `metric` - (Optional) Cockpit metric to use when determining whether to trigger a scale up/down action.
63+
- `name` - Name or description of the metric policy.
64+
- `operator` - Operator used when comparing the threshold value of the chosen `metric` to the actual sampled and aggregated value.
65+
- `aggregate` - How the values sampled for the `metric` should be aggregated.
66+
- `managed_metric` - The managed metric to use for this policy. These are available by default in Cockpit without any configuration or `node_exporter`. The chosen metric forms the basis of the condition that will be checked to determine whether a scaling action should be triggered.
67+
- `cockpit_metric_name` - The custom metric to use for this policy. This must be stored in Scaleway Cockpit. The metric forms the basis of the condition that will be checked to determine whether a scaling action should be triggered
68+
- `sampling_range_min` - The Interval of time, in minutes, during which metric is sampled.
69+
- `threshold` - The threshold value to measure the aggregated sampled `metric` value against. Combined with the `operator` field, determines whether a scaling action should be triggered.
70+
- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the Instance policy exists.
71+
- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the Project the Instance policy is associated with.
72+
73+
## Attributes Reference
74+
75+
In addition to all arguments above, the following attributes are exported:
76+
77+
- `id` - The ID of the Instance policy.
78+
79+
~> **Important:** Autoscaling policies IDs are [zonal](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111`
80+
81+
## Import
82+
83+
Autoscaling instance policies can be imported using `{zone}/{id}`, e.g.
84+
85+
```bash
86+
terraform import scaleway_autoscaling_instance_policy.main fr-par-1/11111111-1111-1111-1111-111111111111
87+
```

0 commit comments

Comments
 (0)