Skip to content

Files

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Complete EC2 instance

Configuration in this directory creates EC2 instances with different sets of arguments (with Elastic IP, with network interface attached, with credit specifications).

Usage

To run this example you need to execute:

$ terraform init
$ terraform plan
$ terraform apply

Note that this example may create resources which can cost money. Run terraform destroy when you don't need these resources.

Requirements

Name Version
terraform >= 1.0
aws >= 4.66

Providers

Name Version
aws >= 4.66

Modules

Name Source Version
ec2_complete ../../ n/a
ec2_cpu_options ../../ n/a
ec2_disabled ../../ n/a
ec2_ignore_ami_changes ../../ n/a
ec2_metadata_options ../../ n/a
ec2_multiple ../../ n/a
ec2_network_interface ../../ n/a
ec2_open_capacity_reservation ../../ n/a
ec2_spot_instance ../../ n/a
ec2_t2_unlimited ../../ n/a
ec2_t3_unlimited ../../ n/a
ec2_targeted_capacity_reservation ../../ n/a
security_group terraform-aws-modules/security-group/aws ~> 4.0
vpc terraform-aws-modules/vpc/aws ~> 5.0

Resources

Name Type
aws_ec2_capacity_reservation.open resource
aws_ec2_capacity_reservation.targeted resource
aws_kms_key.this resource
aws_network_interface.this resource
aws_placement_group.web resource
aws_ami.amazon_linux data source
aws_ami.amazon_linux_23 data source
aws_availability_zones.available data source

Inputs

No inputs.

Outputs

Name Description
ec2_complete_arn The ARN of the instance
ec2_complete_availability_zone The availability zone of the created instance
ec2_complete_capacity_reservation_specification Capacity reservation specification of the instance
ec2_complete_ebs_block_device EBS block device information
ec2_complete_ephemeral_block_device Ephemeral block device information
ec2_complete_iam_instance_profile_arn ARN assigned by AWS to the instance profile
ec2_complete_iam_instance_profile_id Instance profile's ID
ec2_complete_iam_instance_profile_unique Stable and unique string identifying the IAM instance profile
ec2_complete_iam_role_arn The Amazon Resource Name (ARN) specifying the IAM role
ec2_complete_iam_role_name The name of the IAM role
ec2_complete_iam_role_unique_id Stable and unique string identifying the IAM role
ec2_complete_id The ID of the instance
ec2_complete_instance_state The state of the instance. One of: pending, running, shutting-down, terminated, stopping, stopped
ec2_complete_primary_network_interface_id The ID of the instance's primary network interface
ec2_complete_private_dns The 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
ec2_complete_public_dns The public DNS name assigned to the instance. For EC2-VPC, this is only available if you've enabled DNS hostnames for your VPC
ec2_complete_public_ip The public IP address assigned to the instance, if applicable. NOTE: If you are using an aws_eip with your instance, you should refer to the EIP's address directly and not use public_ip as this field will change after the EIP is attached
ec2_complete_root_block_device Root block device information
ec2_complete_tags_all A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block
ec2_ignore_ami_changes_ami The AMI of the instance (ignore_ami_changes = true)
ec2_multiple The full output of the ec2_module module
ec2_spot_instance_arn The ARN of the instance
ec2_spot_instance_capacity_reservation_specification Capacity reservation specification of the instance
ec2_spot_instance_id The ID of the instance
ec2_spot_instance_instance_state The state of the instance. One of: pending, running, shutting-down, terminated, stopping, stopped
ec2_spot_instance_primary_network_interface_id The ID of the instance's primary network interface
ec2_spot_instance_private_dns The 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
ec2_spot_instance_public_dns The public DNS name assigned to the instance. For EC2-VPC, this is only available if you've enabled DNS hostnames for your VPC
ec2_spot_instance_public_ip The public IP address assigned to the instance, if applicable. NOTE: If you are using an aws_eip with your instance, you should refer to the EIP's address directly and not use public_ip as this field will change after the EIP is attached
ec2_spot_instance_tags_all A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block
ec2_t2_unlimited_arn The ARN of the instance
ec2_t2_unlimited_availability_zone The availability zone of the created instance
ec2_t2_unlimited_capacity_reservation_specification Capacity reservation specification of the instance
ec2_t2_unlimited_id The ID of the instance
ec2_t2_unlimited_instance_state The state of the instance. One of: pending, running, shutting-down, terminated, stopping, stopped
ec2_t2_unlimited_primary_network_interface_id The ID of the instance's primary network interface
ec2_t2_unlimited_private_dns The 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
ec2_t2_unlimited_public_dns The public DNS name assigned to the instance. For EC2-VPC, this is only available if you've enabled DNS hostnames for your VPC
ec2_t2_unlimited_public_ip The public IP address assigned to the instance, if applicable. NOTE: If you are using an aws_eip with your instance, you should refer to the EIP's address directly and not use public_ip as this field will change after the EIP is attached
ec2_t2_unlimited_tags_all A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block
ec2_t3_unlimited_arn The ARN of the instance
ec2_t3_unlimited_availability_zone The availability zone of the created instance
ec2_t3_unlimited_capacity_reservation_specification Capacity reservation specification of the instance
ec2_t3_unlimited_id The ID of the instance
ec2_t3_unlimited_instance_state The state of the instance. One of: pending, running, shutting-down, terminated, stopping, stopped
ec2_t3_unlimited_primary_network_interface_id The ID of the instance's primary network interface
ec2_t3_unlimited_private_dns The 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
ec2_t3_unlimited_public_dns The public DNS name assigned to the instance. For EC2-VPC, this is only available if you've enabled DNS hostnames for your VPC
ec2_t3_unlimited_public_ip The public IP address assigned to the instance, if applicable. NOTE: If you are using an aws_eip with your instance, you should refer to the EIP's address directly and not use public_ip as this field will change after the EIP is attached
ec2_t3_unlimited_tags_all A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block
spot_bid_status The current bid status of the Spot Instance Request
spot_instance_availability_zone The availability zone of the created spot instance
spot_instance_id The Instance ID (if any) that is currently fulfilling the Spot Instance request
spot_request_state The current request state of the Spot Instance Request