forked from milliHQ/terraform-aws-next-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.tf
165 lines (142 loc) · 4.81 KB
/
variables.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
##########
# Settings
##########
variable "next_tf_dir" {
description = "Relative path to the .next-tf dir."
type = string
default = "./.next-tf"
}
variable "create_image_optimization" {
description = "Controls whether resources for image optimization support should be created or not."
type = bool
default = true
}
variable "domain_names" {
description = "Alternative domain names for the CloudFront distribution."
type = list(string)
default = []
}
variable "create_domain_name_records" {
description = "Controls whether Route 53 records for the for the domain_names should be created."
type = bool
default = true
}
variable "domain_zone_names" {
type = list(string)
default = []
}
variable "expire_static_assets" {
description = "Number of days after which static assets from previous deployments should be removed from S3. Set to -1 to disable expiration."
type = number
default = 30
}
variable "use_awscli_for_static_upload" {
description = "Use AWS CLI when uploading static resources to S3 instead of default Bash script. Some cases may fail with 403 Forbidden when using the Bash script."
type = bool
default = false
}
###################
# Lambdas (Next.js)
###################
variable "lambda_environment_variables" {
type = map(string)
description = "Map that defines environment variables for the Lambda Functions in Next.js."
default = {}
}
variable "lambda_runtime" {
description = "Lambda Function runtime"
type = string
default = "nodejs14.x"
}
variable "lambda_memory_size" {
description = "Amount of memory in MB a Lambda Function can use at runtime. Valid value between 128 MB to 10,240 MB, in 1 MB increments."
type = number
default = 1024
}
variable "lambda_timeout" {
description = "Max amount of time a Lambda Function has to return a response in seconds. Should not be more than 30 (Limited by API Gateway)."
type = number
default = 10
}
variable "lambda_policy_json" {
description = "Additional policy document as JSON to attach to the Lambda Function role"
type = string
default = null
}
variable "lambda_role_permissions_boundary" {
type = string
# https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html
description = "ARN of IAM policy that scopes aws_iam_role access for the lambda"
default = null
}
#########################
# Cloudfront Distribution
#########################
variable "cloudfront_price_class" {
description = "Price class for the CloudFront distributions (main & proxy config). One of PriceClass_All, PriceClass_200, PriceClass_100."
type = string
default = "PriceClass_100"
}
variable "cloudfront_viewer_certificate_arn" {
type = string
default = null
}
variable "cloudfront_minimum_protocol_version" {
description = "Minimum version of the SSL protocol that you want CloudFront to use for HTTPS connections. One of SSLv3, TLSv1, TLSv1_2016, TLSv1.1_2016, TLSv1.2_2018 or TLSv1.2_2019."
type = string
default = "TLSv1.2_2019"
}
variable "cloudfront_origins" {
type = list(any)
default = null
}
variable "cloudfront_custom_behaviors" {
type = list(any)
default = null
}
variable "cloudfront_origin_headers" {
description = "Header keys that should be sent to the S3 or Lambda origins. Should not contain any header that is defined via cloudfront_cache_key_headers."
type = list(string)
default = []
}
variable "cloudfront_cache_key_headers" {
description = "Header keys that should be used to calculate the cache key in CloudFront."
type = list(string)
default = ["Authorization"]
}
variable "cloudfront_geo_restriction" {
description = "Options to control distribution of content, object with restriction_type and locations."
type = object({
restriction_type = string,
locations = list(string),
})
default = {
restriction_type = "none"
locations = []
}
validation {
condition = contains(["none", "blacklist", "whitelist"], var.cloudfront_geo_restriction.restriction_type)
error_message = "The restriction_type must be \"none\", \"blacklist\", or \"whitelist\"."
}
}
##########
# Labeling
##########
variable "deployment_name" {
description = "Identifier for the deployment group (alphanumeric characters, underscores, hyphens, slashes, hash signs and dots are allowed)."
type = string
default = "tf-next"
}
variable "tags" {
description = "Tag metadata to label AWS resources that support tags."
type = map(string)
default = {}
}
################
# Debug Settings
################
variable "debug_use_local_packages" {
description = "Use locally built packages rather than download them from npm."
type = bool
default = false
}