Giter Club home page Giter Club logo

tf-aws-ec2's Introduction

Preparing the environment

  1. Clone the repository using git
git clone the-repository/project
  1. Change to the project directory
cd project/
  1. Init the Terraform project
terraform init
  1. Validate the configurations files
terraform validate
  1. Lint the project

Installation guide for tflint -> https://github.com/terraform-linters/tflint

tflint
  1. Validate for security best practices

Installation guide for tfsec -> https://aquasecurity.github.io/tfsec/v1.28.1/guides/installation/

tfsec
  1. Give some format (just in case)
terraform fmt

Providers

Name Version
aws 5.50.0

Requirements

Name Version
terraform ~> 1.5.5
aws ~> 5.50.0

Modules

No modules.

Resources

Name Type
aws_cloudwatch_metric_alarm.cpu_utilization resource
aws_cloudwatch_metric_alarm.memory_utilization resource
aws_ebs_encryption_by_default.enabled resource
aws_eip.public_ip resource
aws_iam_instance_profile.ec2_instance_profile resource
aws_iam_role.ec2_instance_role resource
aws_instance.ec2_instance resource
aws_security_group.ec2_instance_sg resource
aws_sns_topic.ec2_alarms resource
aws_sns_topic_subscription.email_subscriptions resource
aws_ebs_default_kms_key.current data source
aws_iam_policy_document.ec2_role data source
aws_kms_key.by_alias data source

Inputs

Name Description Type Default Required
additional_volumes Additional EBS volumes to attach to the instance. CAUTION: volumes aren't mounted automatically.
map(object({
device_name = string
volume_size = number
volume_type = string
identifier = string
mount_point = string
encrypted = bool
delete_on_termination = bool
kms_key_id = string
}))
{
"volume1": {
"delete_on_termination": true,
"device_name": "/dev/sdf",
"encrypted": true,
"identifier": "logs",
"kms_key_id": "",
"mount_point": "/mnt/logs",
"volume_size": 50,
"volume_type": "gp3"
},
"volume2": {
"delete_on_termination": true,
"device_name": "/dev/sdg",
"encrypted": true,
"identifier": "data",
"kms_key_id": "arn:aws:kms:us-east-1:123456789012:key/abcd1234-abcd-1234-abcd-1234abcd1234",
"mount_point": "/mnt/data",
"volume_size": 100,
"volume_type": "io2"
}
}
no
ami AMI ID string "ami-022e1a32d3f742bd8" no
aws_region AWS region where the EC2 instance will be deployed string "us-east-1" no
ebs_volume_size Size of the EBS volume in GB number 20 no
email_addresses List of email addresses to subscribe to the SNS topic. list(string) [] no
instance_name Name of the EC2 instance string "my-ec2-instance" no
instance_type EC2 instance type string "t2.micro" no
key_name Key Pair name string "key-name" no
kms_key_arn KMS key ID to use for EBS volume encryption string "" no
private_ip Private IP address string "10.0.0.40" no
security_group_rules Map of security group rules with CIDR block, port, and description
map(object({
cidr = string
port = number
description = string
}))
{
"http": {
"cidr": "10.0.0.0/24",
"description": "Allow HTTP",
"port": 80
},
"https": {
"cidr": "10.0.0.0/24",
"description": "Allow HTTPS",
"port": 443
},
"ssh": {
"cidr": "10.0.0.0/24",
"description": "Allow SSH",
"port": 22
}
}
no
sns_topic_arn ARN of the SNS topic to send notifications to (optional). If not provided, a new topic will be created. string "" no
subnet_id Subnet ID string "" no
tags Tags to be applied to resources map(string)
{
"Environment": "Development",
"Owner": "Frankin Garcia"
}
no
use_private_ip Flag to determine whether to use a private IP or public IP bool true no
vpc_id VPC ID string "" no
windows If is Windows server bool true no

Outputs

Name Description
instance_id ID of the EC2 instance
instance_ip IP address of the EC2 instance
security_group_id ID of the security group

tf-aws-ec2's People

Contributors

kenkogeek avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.