Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #############################
- # ec2 instance
- #############################
- resource "aws_instance" "my-cool-instance" {
- count = 1
- ami = "${lookup(var.ami, var.region)}"
- instance_type = "t2.micro"
- key_name = "${var.key_pair_name}"
- ebs_optimized = true
- monitoring = true
- vpc_security_group_ids = ["${module.sg_allow_ssh_in.this_security_group_id}", "${module.sg_allow_all_out.this_security_group_id}", "${module.sg_allow_web_in.this_security_group_id}"]
- associate_public_ip_address = true
- subnet_id = "${module.vpc.public_subnets[0]}"
- # os disk
- root_block_device {
- volume_size = "50"
- }
- # tags (to provide name)
- tags = {
- Name = "magnifier-btc-dev${count.index}"
- }
- }
- #############################
- # ebs vols and attach
- #############################
- resource "aws_ebs_volume" "data" {
- availability_zone = "${aws_instance.my-cool-instance.availability_zone}"
- type = "gp2"
- size = 128
- encrypted = true
- }
- resource "aws_volume_attachment" "ebs_att" {
- device_name = "/dev/sdh"
- volume_id = "${aws_ebs_volume.data.id}"
- instance_id = "${aws_instance.my-cool-instance.id}"
- }
Add Comment
Please, Sign In to add comment