-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
63 lines (46 loc) · 1.11 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
data "aws_ami" "this" {
most_recent = true
owners = ["amazon"]
filter {
name = "name"
values = ["amzn2-ami-hvm-*-gp2"]
}
filter {
name = "root-device-type"
values = ["ebs"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
filter {
name = "architecture"
values = ["x86_64"]
}
}
resource "aws_key_pair" "this" {
key_name = "aws-grafana-lab-key"
public_key = file("~/.ssh/id_rsa.pub")
tags = {
Name = "mate-aws-grafana-lab"
}
}
resource "aws_instance" "this" {
ami = data.aws_ami.this.id
instance_type = "t2.micro"
associate_public_ip_address = true
subnet_id = var.subnet_id
vpc_security_group_ids = [var.security_group_id]
key_name = aws_key_pair.this.key_name
tags = {
Name = "mate-aws-grafana-lab"
}
user_data = file("./install-grafana.sh")
}
##############################################
######## Write your code here -> #############
##############################################
# 1 - create policy
# 2 - create role
# 3 - create policy to role attachment
# 4 - create instance profile