-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tf
More file actions
79 lines (66 loc) · 1.48 KB
/
main.tf
File metadata and controls
79 lines (66 loc) · 1.48 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
####### ENVIRONMENT ########
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.11.0"
}
}
}
provider aws {
region = var.aws_region
}
module resources {
source = "./resources"
instance_type = var.instance_type
aws_region = var.aws_region
platform = var.platform
permissions_path= var.permissions_path
availability_zone = var.az
}
####### VARIABLES ########
variable aws_region {
type = string
}
variable az {
type = string
default = ""
}
variable instance_type {
type = string
default = "c5d.4xlarge"
}
variable platform {
type = string
description = "Platform for image."
validation {
condition = can(regex("^(windows|amzn_linux/amd64|linux/arm64|linux/amd64)$", var.platform))
error_message = "Available platform options: windows, linux/arm64, linux/amd64, amzn_linux/amd64"
}
default = "linux/amd64"
}
variable permissions_path {
type = string
description = "Path to JSON file with IAM permissions."
default = ""
}
####### OUTPUTS ########
output connection {
value = module.resources.connection_str
}
output ec2_public_ip {
value = module.resources.ec2_public_ip
}
output instance_id {
value = module.resources.instance_id
}
output ami_id {
sensitive=true
value = module.resources.ami_id
}
output userdata_path {
value = module.resources.userdata_path
}
output aws_region {
value = var.aws_region
}