add main.tf and variables.tf

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2020-04-02 17:43:26 +02:00
parent b51739e6cb
commit fe52c279a6
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
2 changed files with 81 additions and 0 deletions

44
main.tf Normal file
View File

@ -0,0 +1,44 @@
/* DERIVED --------------------------------------*/
provider "digitalocean" {
token = var.digitalocean_token
spaces_access_id = var.digitalocean_spaces_id
spaces_secret_key = var.digitalocean_spaces_key
}
provider "cloudflare" {
email = var.cloudflare_email
api_key = var.cloudflare_token
account_id = var.cloudflare_account
}
/* DATA -----------------------------------------*/
terraform {
backend "consul" {
address = "https://consul.statusim.net:8400"
/* Lock to avoid syncing issues */
lock = true
/* KV store has a limit of 512KB */
gzip = true
/* WARNING This needs to be changed for every repo. */
path = "terraform/starterpack/"
ca_file = "ansible/files/consul-ca.crt"
cert_file = "ansible/files/consul-client.crt"
key_file = "ansible/files/consul-client.key"
}
}
/* CF Zones ------------------------------------*/
/* CloudFlare Zone IDs required for records */
data "cloudflare_zones" "active" {
filter { status = "active" }
}
/* For easier access to zone ID by domain name */
locals {
zones = {
for zone in data.cloudflare_zones.active.zones:
zone.name => zone.id
}
}

37
variables.tf Normal file
View File

@ -0,0 +1,37 @@
/* REQUIRED -------------------------------------*/
variable "cloudflare_token" {
description = "Token for interacting with Cloudflare API."
}
variable "cloudflare_email" {
description = "Email address of Cloudflare account."
}
variable "cloudflare_account" {
description = "ID of CloudFlare Account."
}
variable "digitalocean_token" {
description = "Token for interacting with DigitalOcean API."
}
variable "digitalocean_spaces_id" {
description = "ID for access to DigitalOcean spaces API."
}
variable "digitalocean_spaces_key" {
description = "Key for access to DigitalOcean spaces API."
}
/* GENERAL --------------------------------------*/
variable "public_domain" {
description = "Domain under which the public sites go."
default = "status.im"
}
variable "domain" {
description = "DNS Domain to update"
default = "statusim.net"
}