-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathec2.tf
More file actions
31 lines (26 loc) · 736 Bytes
/
ec2.tf
File metadata and controls
31 lines (26 loc) · 736 Bytes
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
resource "aws_key_pair" "ec2-key" {
key_name = "ec2-key"
public_key = file("~/.ssh/olds/id_rsa.pub")
}
resource "aws_instance" "ec2" {
count = var.instance_count
ami = var.ami
instance_type = var.instance_type
key_name = aws_key_pair.ec2-key.key_name
security_groups = ["${aws_security_group.ec2-sec.name}"]
tags = {
Name = element(var.instance_tags, count.index)
}
}
/*
resource "aws_volume_attachment" "this" {
device_name = "/dev/sdh"
volume_id = aws_ebs_volume.this.id
instance_id = module.ec2.id
}
resource "aws_ebs_volume" "this" {
availability_zone = local.availability_zone
size = 1
tags = local.tags
}
*/