Skip to content

WildBeavers/terraform-aws-ec2-instance

 
 

Repository files navigation

AWS EC2 Instance Terraform module

Terraform module which creates EC2 instance(s) on AWS. This module is intended for the following use cases:

  • creation of one EC2 instance with default values
  • creation of several identical EC2 instances when an autoscaling group is not an option

These types of AWS resources are created:

Terraform versions

Only Terraform version 0.12.6 or later is supported, there are no plans to backport features for Terraform 0.11. Pin module version to ~> v3.0.

Usage

module "ec2_cluster" {
  source                 = "github.com/WildBeavers/terraform-aws-ec2-instance.git?ref=master"

  ami                    = "ami-ebd02392"
  instance_count         = 5
  instance_type          = "t2.micro"
  key_name               = "user1"
  monitoring             = true
  name                   = "my-cluster"
  subnet_id              = "subnet-eddcdzz4"
  vpc_security_group_ids = ["sg-12345678"]

  tags = {
    Terraform   = "true"
    Environment = "dev"
  }
}

Examples

Modul Documentation

For both, input and output parameters, documentation is available.

Notes

  • When using variable attached_block_device then you MUST NOT use ebs_block_device of the EC2 module. Terraform currently supports only either inline (i.e. as a sub block of aws_instance) or separate creation and attachment of EBS volumes (see note) The attached_block_device is the preferred way for creating volumes using this module.

Authors

This module is a fork of the module terraform-aws-ec2-instance which has been developed by Anton Babenko.

License

Apache 2 Licensed. See LICENSE for full details.

Packages

No packages published

Languages

  • HCL 96.1%
  • Makefile 3.9%