aws_playground

- experiments in aws with terraform
git clone git://git.acid.vegas/aws_playground.git
Log | Files | Refs | Archive | README

ec2.tf (626B)

      1 provider "aws" {
      2   region  = var.aws_region
      3 }
      4 
      5 data "aws_ami" "debian_latest_AMI" {
      6   most_recent = true
      7   owners      = ["136693071363"]
      8   filter {
      9     name   = "name"
     10     values = ["debian-12-amd64-*-*"]
     11   }
     12   filter {
     13     name   = "virtualization-type"
     14     values = ["hvm"]
     15   }
     16 }
     17 
     18 resource "aws_instance" "instance" {
     19   count = var.aws_instance_count
     20   ami = data.aws_ami.debian_latest_AMI.id
     21   instance_type = var.aws_instance_type
     22   vpc_security_group_ids = [var.aws_security_group]
     23   key_name  = var.aws_key_pair_name
     24   user_data = "${file(var.aws_user_data_file_path)}"
     25   tags = {
     26     Name = "node-${count.index}"
     27   }
     28 }