terraform update2

This commit is contained in:
xcad2k 2021-10-08 15:05:21 +02:00
parent a5f3432802
commit 338df07e6a
3 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,15 @@
data "civo_ssh_key" "sshkey" {
name = "your-ssh-key-name"
}
resource "civo_instance" "server" {
hostname = "servername"
size = "g3.small"
disk_image = "ubuntu-focal"
# (optional):
# ---
# tags = ["python", "nginx"]
# notes = "this is a note for the server"
# initial_user = "user"
# sshkey_id = data.civo_ssh_key.sshkey.id
}

View File

@ -0,0 +1,9 @@
variable "zone_id" {}
resource "cloudflare_record" "server" {
zone_id = var.zone_id
name = "your-dns-name"
value = civo_instance.server.public_ip
type = "A"
proxied = false
}

View File

@ -0,0 +1,17 @@
# For more information, see https://www.terraform.io/docs/backends/types/remote.html
terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 3.0"
}
civo = {
source = "civo/civo"
}
}
}
provider "cloudflare" {
email = var.cloudflare_email
api_key = var.cloudflare_api_key
}