-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: post live twitch implementation
- Update OIDC role policy - Add default root object - Add Ippon DNS for our Cloudfront and associate a custom TLS certificate - Update the origin access control - Add Cloudfront log bucket and Cloudfront logging configuration
- Loading branch information
Timothée Aufort
committed
Oct 24, 2024
1 parent
73e9897
commit 1b1daa7
Showing
5 changed files
with
146 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
resource "aws_acm_certificate" "cert" { | ||
domain_name = local.my_domain | ||
validation_method = "DNS" | ||
|
||
tags = { | ||
Environment = "my-web-site" | ||
} | ||
|
||
lifecycle { | ||
create_before_destroy = true | ||
prevent_destroy = true | ||
} | ||
|
||
provider = aws.us | ||
} | ||
|
||
resource "aws_acm_certificate_validation" "cert" { | ||
certificate_arn = aws_acm_certificate.cert.arn | ||
validation_record_fqdns = [for record in aws_route53_record.record_validation : record.fqdn] | ||
provider = aws.us | ||
} | ||
|
||
resource "aws_route53_record" "record_validation" { | ||
for_each = { | ||
for dvo in aws_acm_certificate.cert.domain_validation_options : dvo.domain_name => { | ||
name = dvo.resource_record_name | ||
record = dvo.resource_record_value | ||
type = dvo.resource_record_type | ||
} | ||
} | ||
|
||
allow_overwrite = true | ||
name = each.value.name | ||
records = [each.value.record] | ||
ttl = 60 | ||
type = each.value.type | ||
zone_id = data.aws_route53_zone.ippon.zone_id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
data "aws_cloudfront_log_delivery_canonical_user_id" "cloudfront" {} | ||
data "aws_canonical_user_id" "current" {} | ||
|
||
module "cloudfront_log_bucket" { | ||
source = "terraform-aws-modules/s3-bucket/aws" | ||
version = "4.2.1" | ||
|
||
bucket = "${local.origin_bucket_name}-cloudfront-logs" | ||
control_object_ownership = true | ||
object_ownership = "ObjectWriter" | ||
|
||
grant = [{ | ||
type = "CanonicalUser" | ||
permission = "FULL_CONTROL" | ||
id = data.aws_canonical_user_id.current.id | ||
}, { | ||
type = "CanonicalUser" | ||
permission = "FULL_CONTROL" | ||
id = data.aws_cloudfront_log_delivery_canonical_user_id.cloudfront.id # Ref. https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/AccessLogs.html | ||
} | ||
] | ||
|
||
owner = { | ||
id = data.aws_canonical_user_id.current.id | ||
} | ||
|
||
force_destroy = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters