This is a compiled terraform module capable of creating:
- EC2 instance
- Route 53 record
- Multi ebs volumes
- Security group.
| Name | Version |
|---|---|
| terraform | >= 1.5.0 |
| aws | >= 5.39.1 |
| Name | Version |
|---|---|
| aws | >= 5.39.1 |
| Name | Source | Version |
|---|---|---|
| ec2_instance | git::https://github.com/terraform-aws-modules/terraform-aws-ec2-instance.git | f3c6436589eba5c0bcac1cf1a81403ed4f3fcaf8 |
| route53_record | git::https://github.com/terraform-aws-modules/terraform-aws-route53.git//modules/records | fb53f9541723161ff39374add047dd8e60441e10 |
| sg | git::https://github.com/cloudposse/terraform-aws-security-group.git | 679216f1bc0b1c39a9bea03456e3eae8261f8dbb |
| Name | Type |
|---|---|
| aws_ebs_volume.this | resource |
| aws_volume_attachment.this | resource |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| allow_all_egress | A convenience that adds to the rules specified elsewhere a rule that allows all egress. If this is false and no egress rules are specified via rules or rule-matrix, then no egress will be allowed. |
bool |
true |
no |
| ami | ID of AMI to use for the instance | string |
null |
no |
| ami_ssm_parameter | SSM parameter name for the AMI ID. For Amazon Linux AMI SSM parameters see reference | string |
"/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2" |
no |
| associate_public_ip_address | Whether to associate a public IP address with an instance in a VPC | bool |
null |
no |
| attach_ebs | Additional EBS block devices to attach to the instance | map(object({ |
{ |
no |
| availability_zone | AZ to start the instance in | string |
null |
no |
| capacity_reservation_specification | Describes an instance's Capacity Reservation targeting option | any |
{} |
no |
| cpu_core_count | Sets the number of CPU cores for an instance | number |
null |
no |
| cpu_credits | The credit option for CPU usage (unlimited or standard) | string |
null |
no |
| cpu_options | Defines CPU options to apply to the instance at launch time. | any |
{} |
no |
| cpu_threads_per_core | Sets the number of CPU threads per core for an instance (has no effect unless cpu_core_count is also set) | number |
null |
no |
| create | Whether to create an instance | bool |
true |
no |
| create_before_destroy | Set true to enable terraform create_before_destroy behavior on the created security group.We only recommend setting this false if you are importing an existing security groupthat you do not want replaced and therefore need full control over its name. Note that changing this value will always cause the security group to be replaced. |
bool |
true |
no |
| create_iam_instance_profile | Determines whether an IAM instance profile is created or to use an existing IAM instance profile | bool |
false |
no |
| create_spot_instance | Depicts if the instance is a spot instance | bool |
false |
no |
| disable_api_stop | If true, enables EC2 Instance Stop Protection | bool |
null |
no |
| disable_api_termination | If true, enables EC2 Instance Termination Protection | bool |
null |
no |
| ebs_block_device | Additional EBS block devices to attach to the instance | list(any) |
[] |
no |
| ebs_optimized | If true, the launched EC2 instance will be EBS-optimized | bool |
null |
no |
| enable_volume_tags | Whether to enable volume tags (if enabled it conflicts with root_block_device tags) | bool |
true |
no |
| enclave_options_enabled | Whether Nitro Enclaves will be enabled on the instance. Defaults to false |
bool |
null |
no |
| ephemeral_block_device | Customize Ephemeral (also known as Instance Store) volumes on the instance | list(map(string)) |
[] |
no |
| get_password_data | If true, wait for password data to become available and retrieve it | bool |
null |
no |
| hibernation | If true, the launched EC2 instance will support hibernation | bool |
null |
no |
| host_id | ID of a dedicated host that the instance will be assigned to. Use when an instance is to be launched on a specific dedicated host | string |
null |
no |
| iam_instance_profile | IAM Instance Profile to launch the instance with. Specified as the name of the Instance Profile | string |
null |
no |
| iam_role_description | Description of the role | string |
null |
no |
| iam_role_name | Name to use on IAM role created | string |
null |
no |
| iam_role_path | IAM role path | string |
null |
no |
| iam_role_permissions_boundary | ARN of the policy that is used to set the permissions boundary for the IAM role | string |
null |
no |
| iam_role_policies | Policies attached to the IAM role | map(string) |
{} |
no |
| iam_role_tags | A map of additional tags to add to the IAM role/profile created | map(string) |
{} |
no |
| iam_role_use_name_prefix | Determines whether the IAM role name (iam_role_name or name) is used as a prefix |
bool |
true |
no |
| ignore_ami_changes | Whether changes to the AMI ID changes should be ignored by Terraform. Note - changing this value will result in the replacement of the instance | bool |
false |
no |
| inline_rules_enabled | NOT RECOMMENDED. Create rules "inline" instead of as separate aws_security_group_rule resources.See #20046 for one of several issues with inline rules. See this post for details on the difference between inline rules and rule resources. |
bool |
false |
no |
| instance_initiated_shutdown_behavior | Shutdown 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 | string |
null |
no |
| instance_tags | Additional tags for the instance | map(string) |
{} |
no |
| instance_type | The type of instance to start | string |
"t3.micro" |
no |
| ipv6_address_count | A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet | number |
null |
no |
| ipv6_addresses | Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface | list(string) |
null |
no |
| key_name | Key name of the Key Pair to use for the instance; which can be managed using the aws_key_pair resource |
string |
null |
no |
| kms_key_id | kms_key_id The ARN for the KMS encryption key | string |
n/a | yes |
| launch_template | Specifies a Launch Template to configure the instance. Parameters configured on this resource will override the corresponding parameters in the Launch Template | map(string) |
{} |
no |
| maintenance_options | The maintenance options for the instance | any |
{} |
no |
| metadata_options | Customize the metadata options of the instance | map(string) |
{ |
no |
| monitoring | If true, the launched EC2 instance will have detailed monitoring enabled | bool |
null |
no |
| name | Name to be used on EC2 instance created | string |
"" |
no |
| network_interface | Customize network interfaces to be attached at instance boot time | list(map(string)) |
[] |
no |
| placement_group | The Placement Group to start the instance in | string |
null |
no |
| preserve_security_group_id | When false and create_before_destroy is true, changes to security group rulescause a new security group to be created with the new rules, and the existing security group is then replaced with the new one, eliminating any service interruption. When true or when changing the value (from false to true or from true to false),existing security group rules will be deleted before new ones are created, resulting in a service interruption, but preserving the security group itself. NOTE: Setting this to true does not guarantee the security group will never be replaced,it only keeps changes to the security group rules from triggering a replacement. See the README for further discussion. |
bool |
false |
no |
| private_dns_name_options | Customize the private DNS name options of the instance | map(string) |
{} |
no |
| private_ip | Private IP address to associate with the instance in a VPC | string |
null |
no |
| putin_khuylo | Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo! | bool |
true |
no |
| revoke_rules_on_delete | Instruct Terraform to revoke all of the Security Group's attached ingress and egress rules before deleting the security group itself. This is normally not needed. |
bool |
false |
no |
| root_block_device | Customize details about the root block device of the instance. See Block Devices below for details | object({ |
{ |
no |
| route_53_record | Configure route53 record | object({ |
{ |
no |
| rule_matrix | A convenient way to apply the same set of rules to a set of subjects. See README for details. | any |
[] |
no |
| rules | A list of Security Group rule objects. All elements of a list must be exactly the same type; use rules_map if you want to supply multiple lists of different types.The keys and values of the Security Group rule objects are fully compatible with the aws_security_group_rule resource,except for security_group_id which will be ignored, and the optional "key" which, if provided, must be uniqueand known at "plan" time. To get more info see the security_group_rule documentation.___Note:___ The length of the list must be known at plan time. This means you cannot use functions like compact or sort when computing the list. |
list(any) |
[] |
no |
| rules_map | A map-like object of lists of Security Group rule objects. All elements of a list must be exactly the same type, so this input accepts an object with keys (attributes) whose values are lists so you can separate different types into different lists and still pass them into one input. Keys must be known at "plan" time. The keys and values of the Security Group rule objects are fully compatible with the aws_security_group_rule resource,except for security_group_id which will be ignored, and the optional "key" which, if provided, must be uniqueand known at "plan" time. To get more info see the security_group_rule documentation. |
any |
{} |
no |
| secondary_private_ips | A list of secondary private IPv4 addresses to assign to the instance's primary network interface (eth0) in a VPC. Can only be assigned to the primary network interface (eth0) attached at instance creation, not a pre-existing network interface i.e. referenced in a network_interface block |
list(string) |
null |
no |
| security_group_create | Whether to create security group and all rules | bool |
true |
no |
| security_group_create_timeout | How long to wait for the security group to be created. | string |
"10m" |
no |
| security_group_delete_timeout | How long to retry on DependencyViolation errors during security group deletion fromlingering ENIs left by certain AWS services such as Elastic Load Balancing. |
string |
"15m" |
no |
| security_group_description | The description to assign to the created Security Group. Warning: Changing the description causes the security group to be replaced. |
string |
"Managed by Terraform" |
no |
| security_group_name | The name to assign to the security group. Must be unique within the VPC. If not provided, will be derived from the null-label.context passed in.If create_before_destroy is true, will be used as a name prefix. |
list(string) |
[] |
no |
| source_dest_check | Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs | bool |
null |
no |
| spot_block_duration_minutes | The required duration for the Spot instances, in minutes. This value must be a multiple of 60 (60, 120, 180, 240, 300, or 360) | number |
null |
no |
| spot_instance_interruption_behavior | Indicates Spot instance behavior when it is interrupted. Valid values are terminate, stop, or hibernate |
string |
null |
no |
| spot_launch_group | A launch group is a group of spot instances that launch together and terminate together. If left empty instances are launched and terminated individually | string |
null |
no |
| spot_price | The maximum price to request on the spot market. Defaults to on-demand price | string |
null |
no |
| spot_type | If set to one-time, after the instance is terminated, the spot request will be closed. Default persistent |
string |
null |
no |
| spot_valid_from | The start date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ) | string |
null |
no |
| spot_valid_until | The end date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ) | string |
null |
no |
| spot_wait_for_fulfillment | If set, Terraform will wait for the Spot Request to be fulfilled, and will throw an error if the timeout of 10m is reached | bool |
null |
no |
| ssm_policy_enabled | Enable SSM policy | bool |
true |
no |
| subnet_id | The VPC Subnet ID to launch in | string |
null |
no |
| tags | A mapping of tags to assign to the resource | map(string) |
{} |
no |
| tenancy | The tenancy of the instance (if the instance is running in a VPC). Available values: default, dedicated, host | string |
null |
no |
| timeouts | Define maximum timeout for creating, updating, and deleting EC2 instance resources | map(string) |
{} |
no |
| user_data | The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see user_data_base64 instead | string |
null |
no |
| user_data_base64 | Can be used instead of user_data to pass base64-encoded binary data directly. Use this instead of user_data whenever the value is not a valid UTF-8 string. For example, gzip-encoded user data must be base64-encoded and passed via this argument to avoid corruption | string |
null |
no |
| user_data_replace_on_change | When used in combination with user_data or user_data_base64 will trigger a destroy and recreate when set to true. Defaults to false if not set | bool |
null |
no |
| volume_tags | A mapping of tags to assign to the devices created by the instance at launch time | map(string) |
{} |
no |
| vpc_id | The ID of the VPC where the Security Group will be created. | string |
n/a | yes |
| vpc_security_group_ids | A list of security group IDs to associate with | list(string) |
[] |
no |
| Name | Description |
|---|---|
| arn | The ARN of the instance |
| attach_ebs | Details about operators roles |
| capacity_reservation_specification | Capacity reservation specification of the instance |
| iam_instance_profile_arn | ARN assigned by AWS to the instance profile |
| iam_instance_profile_id | Instance profile's ID |
| iam_instance_profile_unique | Stable and unique string identifying the IAM instance profile |
| iam_role_arn | The Amazon Resource Name (ARN) specifying the IAM role |
| iam_role_name | The name of the IAM role |
| iam_role_unique_id | Stable and unique string identifying the IAM role |
| id | The ID of the instance |
| instance_state | The state of the instance. One of: pending, running, shutting-down, terminated, stopping, stopped |
| ipv6_addresses | The IPv6 address assigned to the instance, if applicable. |
| outpost_arn | The ARN of the Outpost the instance is assigned to |
| password_data | Base-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_id | The ID of the instance's primary network interface |
| 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 |
| private_ip | The private IP address assigned to the 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 |
| 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 |
| route53_record_fqdn | FQDN built using the zone domain and name |
| route53_record_name | The name of the record |
| sg_arn | The created Security Group ARN (null if using existing security group) |
| sg_id | The created or target Security Group ID |
| sg_ids_list | The ID's of all the security groups |
| sg_name | The created Security Group Name (null if using existing security group) |
| sg_rules_terraform_ids | List of Terraform IDs of created security_group_rule resources, primarily provided to enable depends_on |
| spot_bid_status | The current bid status of the Spot Instance Request |
| 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 |
| tags_all | A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block |