-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
41 lines (33 loc) · 950 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
provider "aws" {
region = "ap-south-1"
}
resource "aws_instance" "docker_server" {
ami = "ami-078264b8ba71bc45e"
instance_type = "t2.micro"
user_data = <<-EOF
#!/bin/bash
# Install Docker
yum update -y
amazon-linux-extras install docker -y
service docker start
usermod -a -G docker ec2-user
yum install git
# Install AWS CLI
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
EOF
tags = {
Name = "Docker-Logging-Instance"
}
key_name = "Linux-pair"
}
resource "aws_s3_bucket" "logs_bucket" {
bucket = "docker-container-logs-bucket"
}
output "instance_ip" {
value = aws_instance.docker_server.public_ip
}
output "s3_bucket" {
value = aws_s3_bucket.logs_bucket.bucket
}