diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-08-04 14:18:08 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-08-04 14:18:08 +0200 |
commit | 15b9dea7a95765f1f3c09fe0dcb2ea5b5cb669c1 (patch) | |
tree | c0c192e00c419ade1779ae62b3aed91bbb3e8778 /digitalocean/server/main.tf | |
parent | initial commit (diff) | |
download | infra-terraform-15b9dea7a95765f1f3c09fe0dcb2ea5b5cb669c1.tar.gz infra-terraform-15b9dea7a95765f1f3c09fe0dcb2ea5b5cb669c1.zip |
import some common modulesv0.0.1
Diffstat (limited to '')
-rw-r--r-- | digitalocean/server/main.tf | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/digitalocean/server/main.tf b/digitalocean/server/main.tf new file mode 100644 index 0000000..78298f4 --- /dev/null +++ b/digitalocean/server/main.tf @@ -0,0 +1,34 @@ +locals { + sshd_config = templatefile("${path.module}/etc/sshd_config", { + port = var.ssh_port + users = [var.user] + }) +} + +resource "digitalocean_droplet" "this" { + image = var.image + name = var.name + region = var.region + size = var.size + monitoring = true + ipv6 = false + vpc_uuid = var.vpc_id + user_data = templatefile("${path.module}/etc/cloud-init.cfg", { + user = var.user + ssh_keys = var.ssh_keys + sshd_config = local.sshd_config + }) + volume_ids = var.volume_ids + droplet_agent = false + graceful_shutdown = true +} + +resource "digitalocean_project_resources" "this" { + project = var.project_id + resources = [digitalocean_droplet.this.urn] +} + +resource "digitalocean_floating_ip_assignment" "this" { + ip_address = var.ip_address + droplet_id = digitalocean_droplet.this.id +} |