Skip to content

A Terraform module to create instance ec2 on Amazon Web Services (AWS).

License

Notifications You must be signed in to change notification settings

hadenlabs/terraform-aws-ec2-instance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

29 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Latest Release Lint CI Test pre-commit Conventional Commits KeepAChangelog

terraform-aws-ec2-instance

terraform-aws-ec2-instance for project

Requirements

This is a list of plugins that need to be installed previously to enjoy all the goodies of this configuration:

Usage

  module "main" {
    source = "hadenlabs/ec2-instance/aws"
    version = "0.1.0"
  }

Full working examples can be found in examples folder.

Examples

common

  module "main" {
    source  = "hadenlabs/ec2-instance/aws"
    version = "0.1.0"

    providers = {
      aws = aws
    }

    ami            = data.aws_ami.amazon_linux.id

    public_key     = var.public_key
    private_key    = var.private_key
  }

with docker

  module "tags" {
    source      = "hadenlabs/tags/null"
    version     = "0.1.1"
    namespace   = var.namespace
    environment = var.environment
    stage       = var.stage
    name        = var.name
    tags        = var.tags
  }

  module "main" {
    source  = "hadenlabs/ec2-instance/aws"
    version = "0.1.0"
    providers = {
      aws = aws
    }

    name           = module.tags.name
    ami            = data.aws_ami.amazon_linux.id
    tags           = module.tags.tags
    enabled_docker = var.enabled_docker
    public_key     = var.public_key
    private_key    = var.private_key
  }

Requirements

Name Version
terraform >= 0.13
aws >=3.2.0
null >=0.1.0

Providers

Name Version
aws >=3.2.0
null >=0.1.0

Modules

No modules.

Resources

Name Type
aws_instance.this resource
aws_key_pair.this resource
aws_security_group.this resource
aws_security_group_rule.egress resource
aws_security_group_rule.ingress resource
null_resource.provision_core resource
null_resource.provision_docker resource

Inputs

Name Description Type Default Required
ami Id of ami of aws string n/a yes
enabled_docker enabled install docker bool false no
instance_type type instance string "t2.micro" no
name Solution name, e.g. 'app' or 'jenkins' string n/a yes
private_key private key string n/a yes
public_key public key string n/a yes
rule_ingress list rule for security group
list(object({
from_port = number
to_port = number
protocol = string
cidr_blocks = list(string)
}))
[] no
ssh_port port ssh number 22 no
ssh_user user ssh string "ubuntu" no
tags Additional tags (e.g. map('BusinessUnit','XYZ') map(string) {} no

Outputs

Name Description
aws_key_pair key_pair of instance.
instance instance instance.
private_ip private ip.
public_ip public ip.

Help

Got a question?

File a GitHub issue.

Contributing

Bug Reports & Feature Requests

Please use the issue tracker to report any bugs or file feature requests.

Development

In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.

  1. Fork the repo on GitHub

  2. Clone the project to your own machine

  3. Commit changes to your own branch

  4. Push your work back up to your fork

  5. Submit a Pull Request so that we can review your changes

NOTE: Be sure to rebase the latest changes from "upstream" before making a pull request!

Module Versioning

This Module follows the principles of Semantic Versioning (SemVer).

Using the given version number of MAJOR.MINOR.PATCH, we apply the following constructs:

  1. Use the MAJOR version for incompatible changes.
  2. Use the MINOR version when adding functionality in a backwards compatible manner.
  3. Use the PATCH version when introducing backwards compatible bug fixes.

Backwards compatibility in 0.0.z and 0.y.z version

  • In the context of initial development, backwards compatibility in versions 0.0.z is not guaranteed when z is increased. (Initial development)
  • In the context of pre-release, backwards compatibility in versions 0.y.z is not guaranteed when y is increased. (Pre-release)

Copyright

Copyright Β© 2018-2021 Hadenlabs

Trademarks

All other trademarks referenced herein are the property of their respective owners.

License

The code and styles are licensed under the LGPL-3.0 license See project license..

Don't forget to 🌟 Star 🌟 the repo if you like terraform-aws-ec2-instance

Your feedback is appreciated