From 15b9dea7a95765f1f3c09fe0dcb2ea5b5cb669c1 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 4 Aug 2023 14:18:08 +0200 Subject: import some common modules --- digitalocean/domain/main.tf | 16 ++++++++++++++++ digitalocean/domain/providers.tf | 8 ++++++++ digitalocean/domain/variables.tf | 10 ++++++++++ 3 files changed, 34 insertions(+) create mode 100644 digitalocean/domain/main.tf create mode 100644 digitalocean/domain/providers.tf create mode 100644 digitalocean/domain/variables.tf (limited to 'digitalocean/domain') diff --git a/digitalocean/domain/main.tf b/digitalocean/domain/main.tf new file mode 100644 index 0000000..a5980ea --- /dev/null +++ b/digitalocean/domain/main.tf @@ -0,0 +1,16 @@ +resource "digitalocean_domain" "this" { + name = var.name +} + +resource "digitalocean_project_resources" "domain" { + project = var.project_id + resources = [digitalocean_domain.this.urn] +} + +resource "digitalocean_record" "a" { + type = "A" + domain = digitalocean_domain.this.id + value = var.ip_address + name = "@" + ttl = 3600 +} diff --git a/digitalocean/domain/providers.tf b/digitalocean/domain/providers.tf new file mode 100644 index 0000000..68aba8c --- /dev/null +++ b/digitalocean/domain/providers.tf @@ -0,0 +1,8 @@ +terraform { + required_providers { + digitalocean = { + source = "digitalocean/digitalocean" + version = "~> 2.0" + } + } +} diff --git a/digitalocean/domain/variables.tf b/digitalocean/domain/variables.tf new file mode 100644 index 0000000..bcff122 --- /dev/null +++ b/digitalocean/domain/variables.tf @@ -0,0 +1,10 @@ +variable "project_id" { + type = string +} + +variable "name" { + type = string +} +variable "ip_address" { + type = string +} -- cgit v1.2.3