| 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 |
| 7 | provider "scaleway" {} |
| 8 | |
| 9 | variable "ssh_key_url" { |
| 10 | type = string |
| 11 | description = "URL of the ssh public key used for ssh access" |
| 12 | } |
| 13 | |
| 14 | resource "scaleway_account_project" "project" { |
| 15 | name = var.project_name |
| 16 | } |
| 17 | |
| 18 | resource "scaleway_account_ssh_key" "default" { |
| 19 | name = "default" |
| 20 | public_key = data.http.ssh_key.response_body |
| 21 | } |
| 22 | |
| 23 | data "http" "ssh_key" { |
| 24 | url = var.ssh_key_url |
| 25 | } |
| 26 | |
| 27 | resource "scaleway_instance_ip" "default" { |
| 28 | type = "routed_ipv6" |
| 29 | } |
| 30 | |
| 31 | resource "scaleway_instance_server" "default" { |
| 32 | type = "STARDUST1-S" |
| 33 | image = "debian_trixie" |
| 34 | ip_ids = [scaleway_instance_ip.default.id] |
| 35 | } |
| 36 | |
| 37 | resource "scaleway_billing_budget" "default" { |
| 38 | consumption_limit = 100 # 100 Euro cents |
| 39 | enabled = true |
| 40 | } |
| 41 | |
| 42 | resource "scaleway_billing_budget_alert" "default" { |
| 43 | budget_id = scaleway_billing_budget.default.id |
| 44 | threshold = 100 |
| 45 | } |
| 46 | |
| 47 | resource "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 |
alex / scaleway.tf
Last active 1 month ago
Revision cf6e277322309b2673123c0f7d76e914832c16fb