From b4a5f2ee828dd021ab46196e4e05b27074aabe06 Mon Sep 17 00:00:00 2001 From: clarkzjw Date: Sat, 10 Dec 2022 21:25:37 -0800 Subject: infra: add s3 acl --- jinwei.me/infra/cloudflare.tf | 17 +++++++++++++++++ jinwei.me/infra/outputs.tf | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 jinwei.me/infra/cloudflare.tf 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 @@ +provider "cloudflare" {} + +data "cloudflare_zones" "domain" { + filter { + name = var.site_domain + } +} + +resource "cloudflare_record" "s3_bucket" { + zone_id = data.cloudflare_zones.domain.zones[0].id + name = var.s3_cdn_name + value = aws_s3_bucket.main.bucket_regional_domain_name + type = "CNAME" + + ttl = 1 + proxied = true +} 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" { output "s3" { description = "S3 bucket for wordpress" value = { - bucket_domain_name = aws_s3_bucket.main.bucket_domain_name + bucket_domain_name = aws_s3_bucket.main.bucket_regional_domain_name policy = aws_s3_bucket_policy.main.policy } } -- cgit v1.2.3