- Clone the repository using
git
git clone the-repository/project
- Change to the project directory
cd project/
- Init the Terraform project
terraform init
- Validate the configurations files
terraform validate
- Lint the project
Installation guide for tflint -> https://github.com/terraform-linters/tflint
tflint
- Validate for security best practices
Installation guide for tfsec -> https://aquasecurity.github.io/tfsec/v1.28.1/guides/installation/
tfsec
- Give some format (just in case)
terraform fmt
Name | Version |
---|---|
aws | 5.50.0 |
Name | Version |
---|---|
terraform | ~> 1.5.5 |
aws | ~> 5.50.0 |
No modules.
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 |
Name | Description | Type | Default | Required |
---|---|---|---|---|
additional_volumes | Additional EBS volumes to attach to the instance. CAUTION: volumes aren't mounted automatically. | map(object({ |
{ |
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({ |
{ |
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) |
{ |
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 |
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 |