-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
80 lines (63 loc) · 1.59 KB
/
main.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
variable "ami_id" {
description = "AMI ID "
}
variable "availability_zones" {
type = "list"
description = "List of Availability Zones"
}
variable "environment" {
description = "Environment"
}
variable "instance_type" {
description = "Instance type"
}
variable "region" {
description = "Region"
}
variable "root_volume_size" {
description = "Root volume size"
}
variable "security_groups" {
type = "list"
description = "List of security groups"
}
variable "ssh_key_name" {
description = "SSH Key name"
}
variable "subnet_ids" {
type = "list"
description = "List of subnet IDs"
}
variable "zone_id" {
description = "Public DNS Zone ID"
}
# --------------- PROVIDER --------------- #
provider "aws" {
region = "eu-west-1"
profile = "private"
}
# --------------- SERVICE USER DATA --------------- #
data "template_file" "user_data" {
template = <<-EOF
#!/bin/bash
echo "Hello World!"
EOF
}
# --------------- SERVICE --------------- #
module "service" {
source = "./service"
ami_id = "${var.ami_id}"
availability_zones = "${var.availability_zones}"
cname = "service"
environment = "${var.environment}"
instance_profile = ""
instance_type = "t2.small"
role = "service"
region = "${var.region}"
root_volume_size = 8
security_groups = "${var.security_groups}"
ssh_key_name = "${var.ssh_key_name}"
subnet_ids = "${var.subnet_ids}"
user_data = "${data.template_file.user_data.rendered}"
zone_id = "${var.zone_id}"
}