aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jinwei.me/infra/cloudflare.tf17
-rw-r--r--jinwei.me/infra/outputs.tf2
2 files changed, 18 insertions, 1 deletions
diff --git a/jinwei.me/infra/cloudflare.tf b/jinwei.me/infra/cloudflare.tf
new file mode 100644
index 0000000..5c79607
--- /dev/null
+++ b/jinwei.me/infra/cloudflare.tf
@@ -0,0 +1,17 @@
1provider "cloudflare" {}
2
3data "cloudflare_zones" "domain" {
4 filter {
5 name = var.site_domain
6 }
7}
8
9resource "cloudflare_record" "s3_bucket" {
10 zone_id = data.cloudflare_zones.domain.zones[0].id
11 name = var.s3_cdn_name
12 value = aws_s3_bucket.main.bucket_regional_domain_name
13 type = "CNAME"
14
15 ttl = 1
16 proxied = true
17}
diff --git a/jinwei.me/infra/outputs.tf b/jinwei.me/infra/outputs.tf
index d5df1df..bb21fc5 100644
--- a/jinwei.me/infra/outputs.tf
+++ b/jinwei.me/infra/outputs.tf
@@ -31,7 +31,7 @@ output "instance" {
31output "s3" { 31output "s3" {
32 description = "S3 bucket for wordpress" 32 description = "S3 bucket for wordpress"
33 value = { 33 value = {
34 bucket_domain_name = aws_s3_bucket.main.bucket_domain_name 34 bucket_domain_name = aws_s3_bucket.main.bucket_regional_domain_name
35 policy = aws_s3_bucket_policy.main.policy 35 policy = aws_s3_bucket_policy.main.policy
36 } 36 }
37} 37}
Powered by cgit v1.2.3 (git 2.41.0)