ec2-basic-layout

binbashar/ec2-basic-layout/aws

Terraform Module HCL AWS

Terraform module to deploy a typical EC2 layout that includes an instance with a security group and a dns record.

Install
module "ec2-basic-layout" {
source = "binbashar/ec2-basic-layout/aws"
version = "0.3.36"
}
plain text: /constructs/tfmod-binbashar-ec2-basic-layout-aws/install.txt
⭐ Source on GitHub 📦 Registry page
README

Terraform Module: AWS EC2 Basic Layout Overview This module could be useful if you find yourself creating a layout that includes the following resources: EC2 Instance w/ configurable AMI, family type, key pair, networking, userdata, among others. EC2 Profile with a customizable IAM Role supporting both AWS and customer managed policies. Multiple EBS dynamic blocks (root_block_device, ebs_block_device and ephemeral_block_device) w/ configurable type, size, device name and encryption configs among others. Security group for the instance above. Optionally associate a public IP address with the instance. DNS record with a record that points to the instance private IP / public IP. Tags: both EC2 and EBS. SSM support for interactive shell access via browser or AWS CLI Personally we have seen the

Inputs (31)
NameTypeDescriptionDefault
key_pair_namestringKey Pair Name required
namestringName required
vpc_idstringVPC ID required
subnet_idstringSubnet ID required
private_ipstringPrivate IP address to associate with the instance in the VPCnull
tag_approved_ami_valuestringSet the specific tag ApprovedAMI ('true' | 'false') that identifies aws-config c"false"
ebs_block_devicelist(map(string))Additional EBS block devices to attach to the instance[]
dns_records_public_hosted_zonelist(any)A list of DNS public (public hosted zone) records to create with the instance's []
disable_api_terminationstringIf true, enables EC2 Instance Termination Protection"false"
instance_typestringEC2 Instance Type"t3.micro"
instance_profilestringThe IAM Instance Profile to launch the instance with. Specified as the name of t""
associate_public_ip_addressboolAssociate a public IP address with the instancefalse
aws_ami_os_ownerstringAWS AMI Operating System Owner, eg: 099720109477 for Canonical "099720109477"
ebs_optimizedstringEnable EBS Optimized"false"
user_datastringThe user data to provide when launching the instance. Do not pass gzip-compressenull
user_data_base64stringCan be used instead of user_data to pass base64-encoded binary data directly. Usnull
tagsmap(string)Tags{}
security_group_idslist(string)A list of security group ids[]
root_block_devicelist(map(string))Customize details about the root block device of the instance. See Block Devices[]
credit_specification_cpustringCan be applied/modified to the EC2 at any time. The credit option for CPU usage."unlimited"
enable_ssm_accessboolIf true, attaches SSM policy to instance rolefalse
ephemeral_block_devicelist(map(string))Customize Ephemeral (also known as Instance Store) volumes on the instance[]
root_device_backup_tagstringEC2 Root Block Device backup tag"True"
policy_arnlist(string)Attach AWS IAM managed policies to the IAM Role.[]
Outputs (12)
dns_record_private
aws_instance_type — The type of the Instance.
aws_instance_iam_profile — The IAM instance profile of the EC2.
aws_instance_assume_role_name — The IAM instance profile of the EC2.
dns_record_public
instance
aws_instance_private_ip — Contains the instance private IP address.
aws_instance_public_ip — Contains the instance public IP address.
aws_instance_ami — The AMI of the Instance.
aws_instance_key_name — The ssh key pair name of the Instance.
aws_instance_volume_tags — The root EBS volume tags of the instace.
security_group
Resources (9)
aws_eipaws_iam_instance_profileaws_iam_policyaws_iam_roleaws_iam_role_policy_attachmentaws_instanceaws_route53_recordaws_security_groupaws_security_group_rule
Details
FrameworkTerraform Module
LanguageHCL
Version0.3.36
Cloud AWS
★ Stars5
Forks3
Total downloads6.5k
Inputs31
Outputs12
Resources9
Examples4
LicenseApache-2.0
Namespacebinbashar
Updated