Skip to content

Commit

Permalink
Add Terraform script
Browse files Browse the repository at this point in the history
  • Loading branch information
rioastamal committed Jun 28, 2021
1 parent 32a9a84 commit a0b5643
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions terraform/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.terraform/
48 changes: 48 additions & 0 deletions terraform/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
terraform {
required_version = "~> 1.0.0"

required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "2.15.0"
}
}

backend "remote" {
organization = "quranweb"

workspaces {
name = "domain"
}
}
}

variable "cf_api_token" {
type = string
}

variable "cf" {
type = map
}

provider "cloudflare" {
api_token = var.cf_api_token
}

# quranweb.id -> netlify
resource "cloudflare_record" "netlify" {
zone_id = var.cf.zone_id
name = var.cf.domain
type = "CNAME"
value = var.cf.netlify_domain
proxied = true
}

# www.quranweb.id -> netlify
resource "cloudflare_record" "www_netlify" {
zone_id = var.cf.zone_id
name = "www.${var.cf.domain}"
type = "CNAME"
value = var.cf.netlify_domain
proxied = true
}

0 comments on commit a0b5643

Please sign in to comment.