terraform-aws-ec2

Terraform AWS EC2 modules

APACHE-2.0 License

Stars
0
Committers
2

AWS EC2 Instance Terraform module

Terraform module which creates an EC2 instance on AWS.

Usage

Single EC2 Instance

module "ec2_instance" {
  source  = "pankajsao11/aws-ec2/aws"

  name = "single-instance"

  instance_type          = "t2.micro"
  key_name               = "user1"
  monitoring             = true
  vpc_security_group_ids = ["sg-12345678"]
  subnet_id              = "subnet-eddcdzz4"

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

Examples

Providers

Name Version
aws >= 5.0

Modules

No modules.

Resources

Name Type
aws_instance.dev-ec2 resource

Inputs

Name Description Type Default Required
ami ID of AMI to use for the instance string null no
availability_zone AZ to start the instance in string null no
instance_tags Additional tags for the instance map(string) {} no
instance_type The type of instance to start string "t3.micro" no
ipv6_addresses Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface list(string) null no
key_name Key name of the Key Pair to use for the instance; which can be managed using the aws_key_pair resource string null no
launch_template Specifies a Launch Template to configure the instance. Parameters configured on this resource will override the corresponding parameters in the Launch Template map(string) {} no
monitoring If true, the launched EC2 instance will have detailed monitoring enabled bool null no
name Name to be used on EC2 instance created string "" no
private_ip Private IP address to associate with the instance in a VPC string null no
subnet_id The VPC Subnet ID to launch in string null no
tags A mapping of tags to assign to the resource map(string) {} no
vpc_security_group_ids A list of security group IDs to associate with list(string) null no

Outputs

Name Description
ami AMI ID that was used to create the instance
arn The ARN of the instance
availability_zone The availability zone of the created instance
id The ID of the instance
instance_state The state of the instance
ipv6_addresses The IPv6 address assigned to the instance, if applicable
private_dns The private DNS name assigned to the instance. Can only be used inside the Amazon EC2, and only available if you've enabled DNS hostnames for your VPC
private_ip The private IP address assigned to the instance
public_dns The public DNS name assigned to the instance. For EC2-VPC, this is only available if you've enabled DNS hostnames for your VPC
tags_all A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block

Authors

Module is maintained by Pankaj Sahu.

License

Apache 2 Licensed. See LICENSE for full details.

Related Projects