ec2-instance

cloudposse/ec2-instance/aws

Terraform Module HCL AWS

Terraform module for provisioning a general purpose EC2 host

Install
module "ec2-instance" {
source = "cloudposse/ec2-instance/aws"
version = "2.0.0"
}
⭐ Source on GitHub 📦 Registry page
README

Terraform Module for provisioning a general purpose EC2 host. Included features: Automatically create a Security Group Option to switch EIP attachment CloudWatch monitoring and automatic reboot if instance hangs Assume Role capability > [!TIP] > #### 👽 Use Atmos with Terraform > Cloud Posse uses atmos to easily orchestrate multiple environments using Terraform. > Works with Github Actions, Atlantis, or Spacelift. > > > Watch demo of using Atmos with Terraform > > Example of running atmos to manage infrastructure from our Quick Start tutorial. > Usage Note: add ${var.ssh_key_pair} private key to the ssh agent. Include this repository as a module in your existing terraform code. Simple example: ``hcl module "instance" { source = "cloudposse/ec2-instance/aws" # Cloud Posse recommends pinning

Inputs (50)
NameTypeDescriptionDefault
source_dest_checkboolControls if traffic is routed to the instance when the destination address does true
root_block_device_kms_key_idstringKMS key ID used to encrypt EBS volume. When specifying root_block_device_kms_keynull
metadata_http_endpoint_enabledboolWhether the metadata service is availabletrue
kms_key_idstringKMS key ID used to encrypt EBS volume. When specifying kms_key_id, ebs_volume_ennull
enabledboolSet to false to prevent the module from creating any resourcesnull
additional_tag_mapmap(string)Additional key-value pairs to add to each map in `tags_as_list_of_maps`. Not add{}
descriptor_formatsanyDescribe additional descriptors to be output in the `descriptors` output map. Ma{}
ssh_key_pairstringSSH key pair to be provisioned on the instancenull
applying_periodnumberThe period in seconds over which the specified statistic is applied60
tenancystringTenancy of the instance (if the instance is running in a VPC). An instance with "default"
availability_zonestringAvailability Zone the instance is launched in. If not set, will be launched in t""
metric_thresholdnumberThe value against which the specified statistic is compared1
tenantstringID element _(Rarely used, not included by default)_. A customer identifier, indinull
user_data_replace_on_changeboolWhen used in combination with user_data or user_data_base64 will trigger a destrfalse
instance_typestringThe type of the instance"t2.micro"
root_iopsnumberAmount of provisioned IOPS. This must be set if root_volume_type is set of `io1`0
root_throughputnumberAmount of throughput. This must be set if root_volume_type is set to `gp3`0
delimiterstringDelimiter to be used between ID elements. Defaults to `-` (hyphen). Set to `""` null
private_ipstringPrivate IP address to associate with the instance in the VPCnull
ipv6_addresseslist(string)List of IPv6 addresses from the range of the subnet to associate with the primar[]
… and 10 more inputs
Outputs (19)
role — Name of AWS IAM Role associated with the instance
alarm — CloudWatch Alarm ID
primary_network_interface_id — ID of the instance's primary network interface
instance_profile — Name of the instance's profile (either built or supplied)
security_group_id — EC2 instance Security Group ID
public_dns — Public DNS of instance (or DNS of EIP)
arn — ARN of the instance
name — Instance name
additional_eni_ids — Map of ENI to EIP
security_group_arn — EC2 instance Security Group ARN
public_ip — Public IP of instance (or EIP)
ssh_key_pair — Name of the SSH key pair provisioned on the instance
security_group_ids — IDs on the AWS Security Groups associated with the instance
ebs_ids — IDs of EBSs
security_group_name — EC2 instance Security Group name
private_ip — Private IP of instance
private_dns — Private DNS of instance
id — Disambiguated ID of the instance
role_arn — ARN of AWS IAM Role associated with the instance
Resources (12)
aws_cloudwatch_metric_alarmaws_ebs_volumeaws_eipaws_iam_instance_profileaws_iam_policyaws_iam_roleaws_iam_role_policy_attachmentaws_instanceaws_network_interfaceaws_network_interface_attachmentaws_volume_attachmentnull_resource
Details
FrameworkTerraform Module
LanguageHCL
Version2.0.0
Cloud AWS
★ Stars171
Forks222
Total downloads669.8k
Inputs50
Outputs19
Resources12
Examples2
LicenseApache-2.0
Namespacecloudposse
Updated