more terraform boilerplates
This commit is contained in:
15
terraform/templates/cloud-deployment-example/civo.tf
Normal file
15
terraform/templates/cloud-deployment-example/civo.tf
Normal 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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
40
terraform/templates/cloud-deployment-example/main.tf
Normal file
40
terraform/templates/cloud-deployment-example/main.tf
Normal file
@@ -0,0 +1,40 @@
|
||||
# General Terraform Settings
|
||||
# ---
|
||||
|
||||
terraform {
|
||||
required_providers {
|
||||
cloudflare = {
|
||||
source = "cloudflare/cloudflare"
|
||||
version = "~> 3.0"
|
||||
}
|
||||
civo = {
|
||||
source = "civo/civo"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Declare Variables
|
||||
# ---
|
||||
# TODO: Create a yourfile.auto.tfvars file in the project directory and add your variables in it.
|
||||
# Example:
|
||||
# cloudflare_email = "youremail@yourmail.com"
|
||||
# cloudflare_api_key = "your-api-key"
|
||||
# civo_token = "your-token"
|
||||
|
||||
variable "cloudflare_email" {}
|
||||
variable "cloudflare_api_key" {}
|
||||
variable "civo_token" {}
|
||||
|
||||
# Set Default Provider Settings
|
||||
# ---
|
||||
|
||||
provider "cloudflare" {
|
||||
email = var.cloudflare_email
|
||||
api_key = var.cloudflare_api_key
|
||||
}
|
||||
|
||||
provider "civo" {
|
||||
token = var.civo_token
|
||||
# (optional) change the defaullt region
|
||||
# region = "FRA1"
|
||||
}
|
||||
24
terraform/templates/simple-docker-example/main.tf
Normal file
24
terraform/templates/simple-docker-example/main.tf
Normal file
@@ -0,0 +1,24 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
docker = {
|
||||
source = "kreuzwerker/docker"
|
||||
version = "~> 2.13.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "docker" {}
|
||||
|
||||
resource "docker_image" "nginx" {
|
||||
name = "nginx:latest"
|
||||
keep_locally = false
|
||||
}
|
||||
|
||||
resource "docker_container" "nginx" {
|
||||
image = docker_image.nginx.latest
|
||||
name = "tutorial"
|
||||
ports {
|
||||
internal = 80
|
||||
external = 8000
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user