upgrade CloudFlare provider

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2020-01-22 21:03:28 +01:00
parent f519666812
commit 73bde3c212
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
4 changed files with 37 additions and 18 deletions

View File

@ -56,12 +56,12 @@ secrets:
pass services/consul/client-crt > ansible/files/consul-client.crt
pass services/consul/client-key > ansible/files/consul-client.key
echo "Saving secrets to: terraform.tfvars"
@echo "\
@echo -e "\
# secrets extracted from password-store\n\
digitalocean_token = \"$(shell pass cloud/DigitalOcean/token)\"\n\
cloudflare_token = \"$(shell pass cloud/Cloudflare/token)\"\n\
cloudflare_email = \"$(shell pass cloud/Cloudflare/email)\"\n\
cloudflare_org_id = \"$(shell pass cloud/Cloudflare/org_id)\"\n\
cloudflare_account = \"$(shell pass cloud/Cloudflare/account)\"\n\
digitalocean_token = \"$(shell pass cloud/DigitalOcean/token)\"\n\
alicloud_access_key = \"$(shell pass cloud/Alibaba/access-key)\"\n\
alicloud_secret_key = \"$(shell pass cloud/Alibaba/secret-key)\"\n\
" > terraform.tfvars

24
main.tf
View File

@ -6,8 +6,8 @@ provider "digitalocean" {
provider "cloudflare" {
email = var.cloudflare_email
token = var.cloudflare_token
org_id = var.cloudflare_org_id
api_key = var.cloudflare_token
account_id = var.cloudflare_account
}
provider "google" {
@ -40,6 +40,22 @@ terraform {
}
}
/* 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
}
}
/* RESOURCES ------------------------------------*/
module "nimbus-master" {
@ -79,7 +95,7 @@ module "nimbus-nodes" {
/* DNS ------------------------------------------*/
resource "cloudflare_record" "nimbus-test-stats" {
domain = var.public_domain
zone_id = local.zones["status.im"]
name = "nimbus-test-stats"
type = "A"
proxied = true
@ -88,7 +104,7 @@ resource "cloudflare_record" "nimbus-test-stats" {
}
resource "cloudflare_record" "serenity-testnets" {
domain = var.public_domain
zone_id = local.zones["status.im"]
name = "serenity-testnets"
type = "A"
proxied = true

View File

@ -1,21 +1,21 @@
/* REQUIRED -------------------------------------*/
variable "cloudflare_token" {
description = "Token for interacting with Cloudflare API."
}
variable "digitalocean_token" {
description = "Token for interacting with DigitalOcean API."
}
variable "cloudflare_email" {
description = "Email address of Cloudflare account."
}
variable "cloudflare_org_id" {
variable "cloudflare_token" {
description = "Token for interacting with Cloudflare API."
}
variable "cloudflare_account" {
description = "ID of the CloudFlare organization."
}
variable "digitalocean_token" {
description = "Token for interacting with DigitalOcean API."
}
variable "alicloud_access_key" {
description = "Alibaba Cloud API access key."
}

View File

@ -1,4 +1,7 @@
terraform {
required_version = ">= 0.12"
required_providers {
cloudflare = " = 2.3.0"
digitalocean = " = 1.12.0"
}
}