EC2
Terraform module to create AWS EC2 instance(s) resources
Inputs
40 / 83
amioptionalstringID of AMI to use for the instance
nullami_ssm_parameteroptionalstringSSM parameter name for the AMI ID. For Amazon Linux AMI SSM parameters see [reference](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-public-parameters-ami.html)
/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64associate_public_ip_addressoptionalboolWhether to associate a public IP address with an instance in a VPC
nullavailability_zoneoptionalstringAZ to start the instance in
nullcapacity_reservation_specificationoptionalobject({ capacity_reservation_preference = optional(string) capacity_reservation…Describes an instance's Capacity Reservation targeting option
nullcpu_creditsoptionalstringThe credit option for CPU usage (unlimited or standard)
nullcpu_optionsoptionalobject({ amd_sev_snp = optional(string) core_count = optional(number) nested_vir…Defines CPU options to apply to the instance at launch time.
nullcreateoptionalboolWhether to create an instance
truecreate_eipoptionalboolDetermines whether a public EIP will be created and associated with the instance.
falsecreate_iam_instance_profileoptionalboolDetermines whether an IAM instance profile is created or to use an existing IAM instance profile
falsecreate_security_groupoptionalboolDetermines whether a security group will be created
truecreate_spot_instanceoptionalboolDepicts if the instance is a spot instance
falsedisable_api_stopoptionalboolIf true, enables EC2 Instance Stop Protection
nulldisable_api_terminationoptionalboolIf true, enables EC2 Instance Termination Protection
nullebs_optimizedoptionalboolIf true, the launched EC2 instance will be EBS-optimized
nullebs_volumesoptionalmap(object({ encrypted = optional(bool) final_snapshot = optional(bool) iops = o…Additional EBS volumes to attach to the instance
nulleip_domainoptionalstringIndicates if this EIP is for use in VPC
vpceip_tagsoptionalmap(string)A map of additional tags to add to the eip
{}enable_primary_ipv6optionalboolWhether to assign a primary IPv6 Global Unicast Address (GUA) to the instance when launched in a dual-stack or IPv6-only subnet
nullenable_volume_tagsoptionalboolWhether to enable volume tags (if enabled it conflicts with root_block_device tags)
trueenclave_options_enabledoptionalboolWhether Nitro Enclaves will be enabled on the instance. Defaults to `false`
nullephemeral_block_deviceoptionalmap(object({ device_name = string no_device = optional(bool) virtual_name = opti…Customize Ephemeral (also known as Instance Store) volumes on the instance
nullforce_destroyoptionalboolDestroys instance even if `disable_api_termination` or `disable_api_stop` is set to true. Once this parameter is set to true, a successful terraform apply run before a destroy is required to update this value in the resource state. Without a successful terraform apply after this parameter is set, th…
nullget_password_dataoptionalboolIf true, wait for password data to become available and retrieve it
nullhibernationoptionalboolIf true, the launched EC2 instance will support hibernation
nullhost_idoptionalstringID of a dedicated host that the instance will be assigned to. Use when an instance is to be launched on a specific dedicated host
nullhost_resource_group_arnoptionalstringARN of the host resource group in which to launch the instances. If you specify an ARN, omit the `tenancy` parameter or set it to `host`
nulliam_instance_profileoptionalstringIAM Instance Profile to launch the instance with. Specified as the name of the Instance Profile
nulliam_role_descriptionoptionalstringDescription of the role
nulliam_role_nameoptionalstringName to use on IAM role created
nulliam_role_pathoptionalstringIAM role path
nulliam_role_permissions_boundaryoptionalstringARN of the policy that is used to set the permissions boundary for the IAM role
nulliam_role_policiesoptionalmap(string)Policies attached to the IAM role
{}iam_role_tagsoptionalmap(string)A map of additional tags to add to the IAM role/profile created
{}iam_role_use_name_prefixoptionalboolDetermines whether the IAM role name (`iam_role_name` or `name`) is used as a prefix
trueignore_ami_changesoptionalboolWhether changes to the AMI ID changes should be ignored by Terraform. Note - changing this value will result in the replacement of the instance
falseinstance_initiated_shutdown_behavioroptionalstringShutdown behavior for the instance. Amazon defaults this to stop for EBS-backed instances and terminate for instance-store instances. Cannot be set on instance-store instance
nullinstance_market_optionsoptionalobject({ market_type = optional(string) spot_options = optional(object({ instanc…The market (purchasing) option for the instance. If set, overrides the `create_spot_instance` variable
nullinstance_tagsoptionalmap(string)Additional tags for the instance
{}instance_typeoptionalstringThe type of instance to start
t3.microAll 83 are optional — the module deploys with none of them set. Showing 40, so the site stays a static download — the remaining 43 are in the source.
Outputs
30
amiAMI ID that was used to create the instance
arnThe ARN of the instance
availability_zoneThe availability zone of the created instance
capacity_reservation_specificationCapacity reservation specification of the instance
ebs_block_deviceEBS block device information
ebs_volumesMap of EBS volumes created and their attributes
ephemeral_block_deviceEphemeral block device information
iam_instance_profile_arnARN assigned by AWS to the instance profile
iam_instance_profile_idInstance profile's ID
iam_instance_profile_uniqueStable and unique string identifying the IAM instance profile
iam_role_arnThe Amazon Resource Name (ARN) specifying the IAM role
iam_role_nameThe name of the IAM role
iam_role_unique_idStable and unique string identifying the IAM role
idThe ID of the instance
instance_stateThe state of the instance
ipv6_addressesThe IPv6 address assigned to the instance, if applicable
outpost_arnThe ARN of the Outpost the instance is assigned to
password_dataBase-64 encoded encrypted password data for the instance. Useful for getting the administrator password for instances running Microsoft Windows. This attribute is only exported if `get_password_data` is true
primary_network_interface_idThe ID of the instance's primary network interface
private_dnsThe private DNS name assigned to the instance. Can only be used inside the Amazon EC2, and only available if you've enabled DNS hostnames for your VPC
private_ipThe private IP address assigned to the instance
public_dnsThe public DNS name assigned to the instance. For EC2-VPC, this is only available if you've enabled DNS hostnames for your VPC
public_ipThe public IP address assigned to the instance, if applicable.
root_block_deviceRoot block device information
security_group_arnAmazon Resource Name (ARN) of the security group
security_group_idID of the security group
spot_bid_statusThe current bid status of the Spot Instance Request
spot_instance_idThe Instance ID (if any) that is currently fulfilling the Spot Instance request
spot_request_stateThe current request state of the Spot Instance Request
tags_allA map of tags assigned to the resource, including those inherited from the provider default_tags configuration block
What the agent wires into the next module. An edge on the architecture diagram is one of these consumed by something else.