Skip to content

Commit 6316d3c

Browse files
committed
Restructure variables for organisation
1 parent 198c48d commit 6316d3c

File tree

3 files changed

+34
-24
lines changed

3 files changed

+34
-24
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "0.0.4"
2+
"version": "0.0.5"
33
}

static-site/cloudfront.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
resource "aws_cloudfront_distribution" "static_site" {
22
comment = "Distribution for ${var.domain_name}"
3-
aliases = [var.domain_name]
3+
aliases = var.cloudfront.aliases
44
enabled = true
55
is_ipv6_enabled = true
66
default_root_object = "index.html"
@@ -13,8 +13,8 @@ resource "aws_cloudfront_distribution" "static_site" {
1313

1414
restrictions {
1515
geo_restriction {
16-
restriction_type = var.restriction_type
17-
locations = var.locations
16+
restriction_type = var.cloudfront.type
17+
locations = var.cloudfront.locations
1818
}
1919
}
2020

@@ -39,7 +39,7 @@ resource "aws_cloudfront_distribution" "static_site" {
3939
viewer_certificate {
4040
acm_certificate_arn = aws_acm_certificate.cloudfront_cert.arn
4141
ssl_support_method = "sni-only"
42-
minimum_protocol_version = var.minimum_protocol_version
42+
minimum_protocol_version = var.cloudfront.viewer_certificate.minimum_protocol_version
4343
cloudfront_default_certificate = false
4444
}
4545

static-site/variables.tf

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,46 @@ variable "domain_name" {
88
description = "The custom domain for your CloudFront distribution"
99
}
1010

11-
variable "minimum_protocol_version" {
12-
type = string
13-
description = "Set the minimum viewer certificate version for the CloudFront distribution"
14-
default = "TLSv1.2_2021"
15-
}
16-
1711
variable "role_name" {
1812
type = string
1913
description = "The name of the role and policy with the ability to deploy"
2014
default = "deploy-static-site"
2115
}
2216

23-
variable "restriction_type" {
24-
type = string
25-
description = "The restriction type for the CloudFront distribution"
26-
default = "none"
17+
variable "repo" {
18+
type = string
19+
description = "The repo path for the project"
2720
}
2821

29-
variable "locations" {
30-
type = list(string)
31-
description = "The locations for the restriction type"
32-
default = []
22+
variable "cloudfront" {
23+
type = object({
24+
aliases = list(string)
25+
26+
restriction = object({
27+
type = string
28+
locations = list(string)
29+
})
30+
31+
viewer_certificate = object({
32+
minimum_protocol_version = string
33+
})
34+
})
35+
36+
default = {
37+
aliases = [var.domain_name]
38+
39+
restriction = {
40+
type = "none"
41+
locations = []
42+
}
43+
44+
viewer_certificate = {
45+
minimum_protocol_version = "TLSv1.2_2021"
46+
}
47+
}
3348
}
3449

3550
variable "tags" {
3651
type = map(string)
3752
description = "The tags to apply to all resources created"
3853
}
39-
40-
variable "repo_path" {
41-
type = string
42-
description = "The repo path for the project"
43-
}

0 commit comments

Comments
 (0)