alex

alex / scaleway.tf

Last active 1 month ago

Like 0
scaleway.tf Raw
1# Required env vars:
2# SCW_ACCESS_KEY
3# SCW_SECRET_KEY
4# SCW_DEFAULT_ORGANIZATION_ID
5# SCW_DEFAULT_REGION
6# SCW_DEFAULT_ZONE
7provider "scaleway" {}
8
9variable "ssh_key_url" {
10 type = string
11 description = "URL of the ssh public key used for ssh access"
12}
13
14resource "scaleway_account_project" "project" {
15 name = var.project_name
16}
17
18resource "scaleway_account_ssh_key" "default" {
19 name = "default"
20 public_key = data.http.ssh_key.response_body
21}
22
23data "http" "ssh_key" {
24 url = var.ssh_key_url
25}
26
27resource "scaleway_instance_ip" "default" {
28 type = "routed_ipv6"
29}
30
31resource "scaleway_instance_server" "default" {
32 type = "STARDUST1-S"
33 image = "debian_trixie"
34 ip_ids = [scaleway_instance_ip.default.id]
35}
36
37resource "scaleway_billing_budget" "default" {
38 consumption_limit = 100 # 100 Euro cents
39 enabled = true
40}
41
42resource "scaleway_billing_budget_alert" "default" {
43 budget_id = scaleway_billing_budget.default.id
44 threshold = 100
45}
46
47resource "scaleway_billing_budget_alert_notification" "default" {
48 budget_alert_id = scaleway_billing_budget_alert.default.id
49 email_addresses = [var.axiom_notification_email]
50}
51