Skip to content

Commit 13d1a59

Browse files
committed
fix
1 parent 3986322 commit 13d1a59

File tree

4 files changed

+66
-6
lines changed

4 files changed

+66
-6
lines changed

terraform/envs/qa/main.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ module "frontend" {
9191
CoreCertificateArn = var.CoreCertificateArn
9292
CorePublicDomain = var.CorePublicDomain
9393
IcalPublicDomain = var.IcalPublicDomain
94+
LinkryPublicDomain = var.LinkryPublicDomain
9495
LinkryKvArn = aws_cloudfront_key_value_store.linkry_kv.arn
9596
LinkryKvId = aws_cloudfront_key_value_store.linkry_kv.id
9697
}
@@ -119,6 +120,18 @@ resource "aws_route53_record" "ical" {
119120
}
120121
}
121122

123+
resource "aws_route53_record" "linkry" {
124+
for_each = toset(["A", "AAAA"])
125+
zone_id = "Z04502822NVIA85WM2SML"
126+
type = each.key
127+
name = var.LinkryPublicDomain
128+
alias {
129+
name = module.frontend.linkry_cloudfront_domain_name
130+
zone_id = "Z2FDTNDATAQYW2"
131+
evaluate_target_health = false
132+
}
133+
}
134+
122135
// This section last: moved records into modules
123136
moved {
124137
from = aws_dynamodb_table.app_audit_log

terraform/modules/frontend/main.tf

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,46 @@ resource "aws_s3_bucket_policy" "frontend_bucket_policy" {
282282

283283
}
284284

285+
resource "aws_cloudfront_distribution" "linkry_cloudfront_distribution" {
286+
http_version = "http2and3"
287+
origin {
288+
origin_id = "DummyOrigin"
289+
domain_name = "example.com"
290+
custom_origin_config {
291+
http_port = 80
292+
https_port = 443
293+
origin_protocol_policy = "https-only"
294+
origin_ssl_protocols = ["TLSv1", "TLSv1.1", "TLSv1.2"]
295+
}
296+
}
297+
aliases = [var.LinkryPublicDomain]
298+
enabled = true
299+
is_ipv6_enabled = true
300+
default_cache_behavior {
301+
compress = true
302+
target_origin_id = "DummyOrigin"
303+
viewer_protocol_policy = "redirect-to-https"
304+
allowed_methods = ["GET", "HEAD"]
305+
cached_methods = ["GET", "HEAD"]
306+
307+
function_association {
308+
event_type = "viewer-request"
309+
function_arn = aws_cloudfront_function.linkry_redirect.arn
310+
}
311+
}
312+
viewer_certificate {
313+
acm_certificate_arn = var.CoreCertificateArn
314+
minimum_protocol_version = "TLSv1.2_2021"
315+
ssl_support_method = "sni-only"
316+
}
317+
restrictions {
318+
geo_restriction {
319+
restriction_type = "none"
320+
}
321+
}
322+
price_class = "PriceClass_100"
323+
}
324+
285325
output "main_cloudfront_distribution_id" {
286326
value = aws_cloudfront_distribution.app_cloudfront_distribution.id
287327
}
@@ -297,3 +337,11 @@ output "ical_cloudfront_distribution_id" {
297337
output "ical_cloudfront_domain_name" {
298338
value = aws_cloudfront_distribution.ical_cloudfront_distribution.domain_name
299339
}
340+
341+
output "linkry_cloudfront_distribution_id" {
342+
value = aws_cloudfront_distribution.linkry_cloudfront_distribution.id
343+
}
344+
345+
output "linkry_cloudfront_domain_name" {
346+
value = aws_cloudfront_distribution.linkry_cloudfront_distribution.domain_name
347+
}

terraform/modules/frontend/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ variable "IcalPublicDomain" {
1818
description = "Ical Public Host"
1919
}
2020

21+
variable "LinkryPublicDomain" {
22+
type = string
23+
description = "Ical Public Host"
24+
}
25+
2126

2227
variable "CoreCertificateArn" {
2328
type = string

terraform/modules/lambdas/main.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,9 @@ resource "aws_iam_role" "api_role" {
3030
{
3131
Action = "sts:AssumeRole"
3232
Effect = "Allow"
33-
Sid = ""
3433
Principal = {
3534
Service = "lambda.amazonaws.com"
3635
}
37-
Condition = {
38-
StringEquals = {
39-
"aws:SourceArn" = "arn:aws:lambda:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:function:${local.core_api_lambda_name}"
40-
}
41-
}
4236
},
4337
]
4438
})

0 commit comments

Comments
 (0)