-
Notifications
You must be signed in to change notification settings - Fork 0
/
ec2.tf
56 lines (43 loc) · 1.27 KB
/
ec2.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
resource "aws_instance" "ec2" {
ami = var.ami_id
instance_type = var.instance_type
key_name = aws_key_pair.rr-tf.key_name
tenancy = "default"
subnet_id = aws_subnet.external_subnets[0].id
vpc_security_group_ids = [aws_security_group.aurora_sg.id]
associate_public_ip_address = true
root_block_device {
volume_size = "100"
volume_type = "gp2"
encrypted = true
delete_on_termination = true
}
ebs_block_device {
device_name = "/dev/xvda"
volume_size = "1000"
volume_type = "gp2"
encrypted = true
delete_on_termination = true
}
connection {
type = "ssh"
user = "ec2-user"
private_key = file("/Users/tehila/.ssh/id_rsa")
host = self.public_ip
timeout = "5m"
}
provisioner "file" {
source = "${path.module}/jenkins.sh"
destination = "/tmp/jenkins.sh" # Adjust destination path as needed
}
provisioner "remote-exec" {
inline = [
"sudo chmod +x /tmp/jenkins.sh",
"sudo /tmp/jenkins.sh"
]
}
depends_on = [aws_instance.ec2]
tags = {
Name = "Super_Instance"
}
}