Terraform module which creates firewall on TimeWeb Cloud
module "server" {
source = "deff-dev/cloud-server/timeweb"
version = ">= 1.0.0"
name = "Single-preset"
os = {
name = "ubuntu"
version = "22.04"
}
location = "ru-1"
cpu_frequency = 3.3
disk_type = "nvme"
preset = {
cpu = 1
ram = 1
disk = 15
price = {
min = 100
max = 200
}
}
ssh_keys = ["key_name_1", "key_name_2"]
}
module "firewall" {
source = "deff-dev/cloud-firewall/timeweb"
name = "Web"
rules = [
{
ports = [80, 443]
protocol = "tcp"
cidrs = ["192.168.0.0/24", "192.167.11.112"]
direction = "ingress"
},
{
ports = [80, 443]
protocol = "udp"
cidrs = [""]
direction = "egress"
},
]
resources = [
{
id = module.server.server_id
type = "server"
}
]
depends_on = [module.server, null_resource.default]
}
# Check when server started
resource "null_resource" "default" {
for_each = module.server
connection {
type = "ssh"
user = "root"
private_key = file("~/.ssh/id_rsa")
host = each.value.server_public_ip
}
provisioner "remote-exec" {
inline = ["uptime"]
}
}
Name | Version |
---|---|
terraform | >= 1.3 |
timeweb-cloud | >= 1.3.0 |
Name | Version |
---|---|
timeweb-cloud | >= 1.3.0 |
Name | Version |
---|---|
server | >= 1.0.0 |
Name | Type |
---|---|
twc_firewall.default | resource |
twc_firewall_rule.default | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
name | Name for FireWall | string |
"Managed by terraform" |
yes |
rules | Information about rules | list(object) |
null |
yes |
resources | Link resources | list(object) |
null |
no |
Name | Description |
---|---|
firewall_id | Return firewall id |
Module is maintained by Deff.
Thanks for help denismaster.
Apache 2 Licensed. See LICENSE for full details.