-
Notifications
You must be signed in to change notification settings - Fork 298
/
Copy pathmain.tf
40 lines (36 loc) · 874 Bytes
/
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
terraform {
required_version = ">= 1.4.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.0.0"
}
}
}
#tfsec:ignore:aws-ec2-enforce-http-token-imds
resource "aws_instance" "mongo" {
ami = "ami-02868af3c3df4b3aa"
instance_type = var.instance_type
key_name = var.key_name
subnet_id = var.subnet_id
vpc_security_group_ids = [var.sg_id]
root_block_device {
volume_size = 10
encrypted = true
}
/*
user_data = << EOF
#! /bin/bash
sudo apt-get update
sudo apt-get install -y nginx
sudo systemctl start nginx
sudo systemctl enable nginx
echo "<h1>CloudAcademy 2021</h1>" | sudo tee /var/www/html/index.html
EOF
*/
user_data = filebase64("${path.module}/install.sh")
tags = {
Name = "Mongo"
Owner = "CloudAcademy"
}
}