Skip to content

Commit 4c5be37

Browse files
committed
naming
1 parent 7fc411c commit 4c5be37

File tree

11 files changed

+23
-35
lines changed

11 files changed

+23
-35
lines changed

infrastructure/terraform/bin/terraform.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# A wrapper for running terraform projects
55
# - handles remote state
66
# - uses consistent .tfvars files for each environment
7-
export TF_LOG=DEBUG
7+
88
##
99
# Set Script Version
1010
##

infrastructure/terraform/components/acct/module_s3bucket_access_logs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module "s3bucket_access_logs" {
2-
source = "git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/s3bucket?ref=v=2.0.2"
2+
source = "git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/s3bucket?ref=v=1.0.9"
33

44
name = "access-logs"
55

infrastructure/terraform/components/acct/module_sandbox_kms.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ module "kms_sandbox" {
1313
deletion_window = var.kms_deletion_window
1414
alias = "alias/${local.csi}-sandbox"
1515
iam_delegation = true
16-
}
16+
}
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
resource "aws_acm_certificate" "cert" {
1+
resource "aws_acm_certificate" "files" {
22
provider = aws.us-east-1
33

4-
domain_name = local.cloudfront_domain_name
4+
domain_name = local.cloudfront_files_domain_name
55
validation_method = "DNS"
66

77
lifecycle {
88
create_before_destroy = true
99
}
1010
}
1111

12-
resource "aws_acm_certificate_validation" "main" {
13-
provider = aws.us-east-1
12+
resource "aws_acm_certificate_validation" "files" {
13+
provider = aws.us-east-1
14+
15+
certificate_arn = aws_acm_certificate.files.arn
1416

15-
certificate_arn = aws_acm_certificate.cert.arn
17+
validation_record_fqdns = [for record in aws_route53_record.acm_validation_files : record.fqdn]
1618
}

infrastructure/terraform/components/app/cloudfront_distribution_download.tf renamed to infrastructure/terraform/components/app/cloudfront_distribution_main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ resource "aws_cloudfront_distribution" "main" {
33

44
enabled = true
55
is_ipv6_enabled = true
6-
comment = "NHS Notify Template files CDN (${local.csi})"
6+
comment = "NHS Notify templates files CDN (${local.csi})"
77
default_root_object = "index.html"
88
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-priceclass
99
price_class = "PriceClass_100"
@@ -16,11 +16,11 @@ resource "aws_cloudfront_distribution" "main" {
1616
}
1717

1818
aliases = [
19-
local.cloudfront_domain_name
19+
local.cloudfront_files_domain_name
2020
]
2121

2222
viewer_certificate {
23-
acm_certificate_arn = aws_acm_certificate.cert.arn
23+
acm_certificate_arn = aws_acm_certificate_validation.files.certificate_arn
2424
# Supports 1.2 & 1.3 - https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/secure-connections-supported-viewer-protocols-ciphers.html
2525
minimum_protocol_version = "TLSv1.2_2021"
2626
ssl_support_method = "sni-only"
@@ -33,7 +33,7 @@ resource "aws_cloudfront_distribution" "main" {
3333

3434
origin {
3535
domain_name = module.backend_api.download_bucket_regional_domain_name
36-
origin_access_control_id = aws_cloudfront_origin_access_control.main.id
36+
origin_access_control_id = aws_cloudfront_origin_access_control.s3.id
3737
origin_id = "S3-${local.csi}-download"
3838
}
3939

infrastructure/terraform/components/app/cloudfront_origin_access_control.tf renamed to infrastructure/terraform/components/app/cloudfront_origin_access_control_s3.tf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
# Origin Access Control for S3
2-
resource "aws_cloudfront_origin_access_control" "main" {
3-
provider = aws.us-east-1
1+
resource "aws_cloudfront_origin_access_control" "s3" {
2+
provider = aws.us-east-1
43

54
name = "${local.csi}-s3bucket-download"
65
description = "Origin Access Control for ${module.backend_api.download_bucket_name}"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
locals {
2-
cloudfront_domain_name = "files.${local.root_domain_name}"
3-
root_domain_name = "${var.environment}.${local.acct.dns_zone["name"]}"
2+
cloudfront_files_domain_name = "files.${local.root_domain_name}"
3+
root_domain_name = "${var.environment}.${local.acct.dns_zone["name"]}"
44
}

infrastructure/terraform/components/app/route53_record_acm_validation.tf renamed to infrastructure/terraform/components/app/route53_record_acm_validation_files.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
resource "aws_route53_record" "acm_validation" {
1+
resource "aws_route53_record" "acm_validation_files" {
22
for_each = {
3-
for dvo in aws_acm_certificate.cert.domain_validation_options :
3+
for dvo in aws_acm_certificate.files.domain_validation_options :
44
dvo.domain_name => {
55
name = dvo.resource_record_name
66
record = dvo.resource_record_value

infrastructure/terraform/components/app/route53_record_cloudfront.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
resource "aws_route53_record" "cloudfront" {
1+
resource "aws_route53_record" "cloudfront_files" {
22
zone_id = aws_route53_record.root.zone_id
3-
name = local.cloudfront_domain_name
3+
name = local.cloudfront_files_domain_name
44
type = "A"
55

66
alias {

infrastructure/terraform/components/sandbox/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,4 @@ variable "letter_suppliers" {
8585
}
8686

8787
description = "Letter suppliers enabled in the environment"
88-
}
88+
}

0 commit comments

Comments
 (0)