Skip to content

Commit 015ecea

Browse files
feat(job): cli snapshot jobs tf
1 parent 49fda1b commit 015ecea

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

jobs/instances-snapshot-tf/main.tf

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
terraform {
2+
required_providers {
3+
scaleway = {
4+
source = "scaleway/scaleway"
5+
}
6+
}
7+
required_version = ">= 0.13"
8+
}
9+
10+
variable "project_id" {
11+
type = string
12+
}
13+
14+
variable "region" {
15+
type = string
16+
}
17+
18+
variable "zone" {
19+
type = string
20+
}
21+
22+
variable "block_volume_id" {
23+
type = string
24+
}
25+
26+
resource "scaleway_job_definition" "main" {
27+
name = "job-example-using-cli"
28+
cpu_limit = 140
29+
memory_limit = 256
30+
image_uri = "scaleway/cli:latest"
31+
command = "/scw block snapshot create volume-id=${var.block_volume_id} --debug"
32+
timeout = "2m"
33+
project_id = scaleway_project.snapshot_instance.id
34+
35+
env = {
36+
"SCW_DEFAULT_ORGANIZATION_ID" : var.project_id,
37+
"SCW_DEFAULT_PROJECT_ID" : scaleway_project.snapshot_instance.id,
38+
"SCW_DEFAULT_REGION" : var.region,
39+
"SCW_DEFAULT_ZONE" : var.zone
40+
}
41+
42+
cron {
43+
schedule = "0 * * * *" # run at midnight every day
44+
timezone = "Europe/Paris"
45+
}
46+
}

0 commit comments

Comments
 (0)