-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvariables.tf
More file actions
62 lines (51 loc) · 1.67 KB
/
variables.tf
File metadata and controls
62 lines (51 loc) · 1.67 KB
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
variable "architecture" {
description = "The architecture of the Lambda function."
type = string
default = "arm64"
validation {
condition = contains(["amd64", "arm64"], var.architecture)
error_message = "Architecture must be either amd64 or arm64."
}
}
variable "enable_tracing" {
description = "Enable AWS X-Ray tracing."
type = bool
default = false
}
variable "environment" {
description = "The environment (e.g., 'dev', 'prod') the function will be deployed into."
type = string
}
variable "function_name" {
description = "The name of the function. The value of var.environment will be appended to this name."
type = string
default = "opa-lambda"
}
variable "s3_bucket" {
description = "The name of an existing S3 bucket used for storing rego files. If omitted a new S3 bucket will be created."
type = string
default = ""
}
variable "security_group_ids" {
description = "The security group IDs for the Lambda function. Skip if you won't want to run the lambda within a VPC."
type = list(string)
default = []
}
variable "subnet_ids" {
description = "The subnet IDs for the Lambda function. Skip if you won't want to run the lambda within a VPC."
type = list(string)
default = []
}
variable "tags" {
description = "The tags to apply to the resources."
type = map(string)
default = {}
}
locals {
create_bucket = var.s3_bucket == ""
function_name = "${var.function_name}-${var.environment}"
s3_bucket = local.create_bucket ? aws_s3_bucket.this[0] : data.aws_s3_bucket.this[0]
tags = merge(var.tags, {
Environment = var.environment
})
}