Initial commit
This commit is contained in:
24
terraform_pl/.terraform.lock.hcl
generated
Normal file
24
terraform_pl/.terraform.lock.hcl
generated
Normal file
@@ -0,0 +1,24 @@
|
||||
# This file is maintained automatically by "terraform init".
|
||||
# Manual edits may be lost in future updates.
|
||||
|
||||
provider "registry.terraform.io/scaleway/scaleway" {
|
||||
version = "2.2.0"
|
||||
hashes = [
|
||||
"h1:4+BjCUfLPVaSe1tiAECUHv6gIEpu+CeLzeawsegB7ww=",
|
||||
"h1:4M58uMZHO9fYFPBug868UjaDo+EutwtEGSsCHi4E3UM=",
|
||||
"zh:016486d3e448630e29595412b8d31c8a3b2cec83fa531a86ef3d3858f6ebe45d",
|
||||
"zh:0ae1eb5142f866da8849475d976da21a2f7cc905f37c99e7aef810c3369e0f65",
|
||||
"zh:0c2c8bd7b8beb49d6320cbb4dfba647a465dc1d0f3583b01ad7f0b0559cc043a",
|
||||
"zh:1a2ddae054c2e21db960d25432406f01ac0aca7529838176c11a892f62987a8f",
|
||||
"zh:211c92dd31513b06d679f1d9d85ed39911ee32a5c03a2af93e7a5710cb6d0a64",
|
||||
"zh:76ae419f8ebdc39236c14f87b6c03c9b1f2c6f60081fec48d7d3531cadafcdbe",
|
||||
"zh:8a951e6fb2c329d0095edb607e5c760c47838956d7b0a75111692bd77158a445",
|
||||
"zh:9ff0638bd03a39aacf331912ff1547d31c5a5a3e1961bf3ca50a581ae2bf0cba",
|
||||
"zh:a3ece235aefa0a3110ecae34304122fe32a566a9d54123593e9434693b03d764",
|
||||
"zh:a47f101c77be03df35179474110ab05397693ce7efb74c5a133ae3cb0041bb88",
|
||||
"zh:a69562aaf71b7ef7b2c8ef345637a3309762f45d960560453595ea2ec2cb0e2c",
|
||||
"zh:aa4b8699e888b08905271a6a2c5da206ac737742b8a947a1d9ed53c875954cd5",
|
||||
"zh:abb3e3e235b4862ead53397dd09be40c91910931a993b9415185ea6e8492fdb4",
|
||||
"zh:e772b6ccb6d70a2d610c696185d3411548c73ad6e10870f70921021134ef1e67",
|
||||
]
|
||||
}
|
||||
105
terraform_pl/main.tf
Normal file
105
terraform_pl/main.tf
Normal file
@@ -0,0 +1,105 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
scaleway = {
|
||||
source = "scaleway/scaleway"
|
||||
}
|
||||
}
|
||||
required_version = ">= 0.13"
|
||||
}
|
||||
|
||||
provider "scaleway" {
|
||||
zone = var.zone
|
||||
region = var.region
|
||||
}
|
||||
|
||||
resource "scaleway_instance_ip" "public_ip" {
|
||||
project_id = var.project_id
|
||||
}
|
||||
|
||||
resource "scaleway_instance_volume" "volume" {
|
||||
name = "v7days"
|
||||
project_id = var.project_id
|
||||
size_in_gb = var.data_volume_size
|
||||
type = "l_ssd"
|
||||
|
||||
lifecycle {
|
||||
prevent_destroy = true
|
||||
}
|
||||
}
|
||||
|
||||
resource "scaleway_instance_security_group" "security_group" {
|
||||
name = "sg7daysPL"
|
||||
project_id = var.project_id
|
||||
inbound_default_policy = "drop"
|
||||
outbound_default_policy = "accept"
|
||||
|
||||
inbound_rule {
|
||||
action = "accept"
|
||||
port = "22"
|
||||
}
|
||||
|
||||
inbound_rule {
|
||||
action = "accept"
|
||||
port = "80"
|
||||
}
|
||||
|
||||
inbound_rule {
|
||||
action = "accept"
|
||||
port = "443"
|
||||
}
|
||||
|
||||
inbound_rule {
|
||||
action = "accept"
|
||||
port = "26900"
|
||||
protocol = "TCP"
|
||||
}
|
||||
|
||||
inbound_rule {
|
||||
action = "accept"
|
||||
port = "26900"
|
||||
protocol = "UDP"
|
||||
}
|
||||
|
||||
inbound_rule {
|
||||
action = "accept"
|
||||
port = "26901"
|
||||
protocol = "TCP"
|
||||
}
|
||||
|
||||
inbound_rule {
|
||||
action = "accept"
|
||||
port = "26901"
|
||||
protocol = "UDP"
|
||||
}
|
||||
|
||||
inbound_rule {
|
||||
action = "accept"
|
||||
port = "26902"
|
||||
protocol = "TCP"
|
||||
}
|
||||
|
||||
inbound_rule {
|
||||
action = "accept"
|
||||
port = "26902"
|
||||
protocol = "UDP"
|
||||
}
|
||||
}
|
||||
|
||||
resource "scaleway_instance_server" "instance_server" {
|
||||
name = "i7daysPL"
|
||||
project_id = var.project_id
|
||||
type = var.instance_type
|
||||
image = var.instance_image
|
||||
|
||||
tags = ["game", "terraform"]
|
||||
|
||||
ip_id = scaleway_instance_ip.public_ip.id
|
||||
|
||||
additional_volume_ids = [scaleway_instance_volume.volume.id]
|
||||
|
||||
root_volume {
|
||||
size_in_gb = var.instance_volume_size
|
||||
}
|
||||
|
||||
security_group_id = scaleway_instance_security_group.security_group.id
|
||||
}
|
||||
4
terraform_pl/outputs.tf
Normal file
4
terraform_pl/outputs.tf
Normal file
@@ -0,0 +1,4 @@
|
||||
output "public_ip" {
|
||||
description = "The public IP of the i7days server"
|
||||
value = scaleway_instance_ip.public_ip.address
|
||||
}
|
||||
40
terraform_pl/variables.tf
Normal file
40
terraform_pl/variables.tf
Normal file
@@ -0,0 +1,40 @@
|
||||
variable "project_id" {
|
||||
type = string
|
||||
default = "d8504e56-fd7e-4640-9308-6d95e8406c7e"
|
||||
description = "Project id"
|
||||
}
|
||||
|
||||
variable "region" {
|
||||
description = "The region to create things in."
|
||||
default = "pl-waw"
|
||||
}
|
||||
|
||||
variable "zone" {
|
||||
description = "The zone to create things in."
|
||||
default = "pl-waw-1"
|
||||
}
|
||||
|
||||
# Data volume configuration
|
||||
variable "data_volume_size" {
|
||||
description = "Size of data volume"
|
||||
default = 50
|
||||
}
|
||||
|
||||
# Instance configuration
|
||||
variable "instance_type" {
|
||||
description = "Instance type to create."
|
||||
default = "GP1-XS"
|
||||
#default = "DEV1-L"
|
||||
#default = "DEV1-XL"
|
||||
#default = "DEV1-S"
|
||||
}
|
||||
|
||||
variable "instance_image" {
|
||||
description = "Instance image to use."
|
||||
default = "debian_bullseye"
|
||||
}
|
||||
|
||||
variable "instance_volume_size" {
|
||||
description = "Instance type to create."
|
||||
default = 100
|
||||
}
|
||||
Reference in New Issue
Block a user