diff options
author | clarkzjw <[email protected]> | 2022-12-10 21:25:37 -0800 |
---|---|---|
committer | clarkzjw <[email protected]> | 2022-12-10 21:25:37 -0800 |
commit | b4a5f2ee828dd021ab46196e4e05b27074aabe06 (patch) | |
tree | 6730638e8a148494b232e4db675658babb4603ea | |
parent | e2327197c423e23628701dca328fbd05693e7a61 (diff) | |
download | jinwei.me-b4a5f2ee828dd021ab46196e4e05b27074aabe06.tar.gz |
infra: add s3 acl
-rw-r--r-- | jinwei.me/infra/cloudflare.tf | 17 | ||||
-rw-r--r-- | jinwei.me/infra/outputs.tf | 2 |
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 @@ | |||
1 | provider "cloudflare" {} | ||
2 | |||
3 | data "cloudflare_zones" "domain" { | ||
4 | filter { | ||
5 | name = var.site_domain | ||
6 | } | ||
7 | } | ||
8 | |||
9 | resource "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" { | |||
31 | output "s3" { | 31 | output "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 | } |