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-crt > ansible/files/consul-client.crt
pass services/consul/client-key > ansible/files/consul-client.key pass services/consul/client-key > ansible/files/consul-client.key
echo "Saving secrets to: terraform.tfvars" echo "Saving secrets to: terraform.tfvars"
@echo "\ @echo -e "\
# secrets extracted from password-store\n\ # secrets extracted from password-store\n\
digitalocean_token = \"$(shell pass cloud/DigitalOcean/token)\"\n\
cloudflare_token = \"$(shell pass cloud/Cloudflare/token)\"\n\ cloudflare_token = \"$(shell pass cloud/Cloudflare/token)\"\n\
cloudflare_email = \"$(shell pass cloud/Cloudflare/email)\"\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_access_key = \"$(shell pass cloud/Alibaba/access-key)\"\n\
alicloud_secret_key = \"$(shell pass cloud/Alibaba/secret-key)\"\n\ alicloud_secret_key = \"$(shell pass cloud/Alibaba/secret-key)\"\n\
" > terraform.tfvars " > terraform.tfvars

24
main.tf
View File

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

View File

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

View File

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