Useful for fast creation of instance with ssm access
module "ec2" {
source = "zahornyak/ec2/aws"
server_name = "bastion"
security_group_ids = ["sg-05bd24bb429900190"]
subnet_id = "subnet-0ddcde2aa05c988f9"
user_data_path = "files/init.sh"
vars = {
foo = "bar"
}
}
Name | Version |
---|---|
terraform | >= 1.3 |
aws | >= 4.45 |
Name | Version |
---|---|
aws | >= 4.45 |
Name | Source | Version |
---|---|---|
ec2_instance | terraform-aws-modules/ec2-instance/aws | ~> 4.3 |
Name | Type |
---|---|
aws_autoscaling_group.this | resource |
aws_autoscaling_policy.scale_down | resource |
aws_autoscaling_policy.scale_up | resource |
aws_cloudwatch_metric_alarm.cpu_high | resource |
aws_cloudwatch_metric_alarm.cpu_low | resource |
aws_eip.this | resource |
aws_iam_instance_profile.ec2_instance_profile | resource |
aws_iam_role.instance_role | resource |
aws_launch_template.as_template | resource |
aws_ami.ami | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
ami | custom ami id | string |
null |
no |
architecture | architecture | string |
"x86_64" |
no |
create_autoscaling_group | if create autoscaling group | bool |
false |
no |
create_eip | creates eip | bool |
true |
no |
instance_profile | custom instance profile | string |
null |
no |
instance_type | instance type | string |
"t2.micro" |
no |
managed_policy_arns | additional managed policy arns | list(string) |
[] |
no |
max_size | max_size asg | number |
1 |
no |
min_size | min_size asg | number |
1 |
no |
monitoring | enable monitoring | bool |
true |
no |
private_ip | private ip | string |
null |
no |
root_block_device | volume config | any |
[] |
no |
scale_down_config | scale down config | any |
{} |
no |
scale_up_config | scale up config | any |
{} |
no |
scaling_default_cooldown | default cooldown | number |
300 |
no |
scaling_termination_policies | termination policies | list(string) |
[ |
no |
security_group_ids | security_group_ids | list(string) |
null |
no |
server_name | server_name | string |
null |
no |
source_dest_check | source_dest_check | bool |
null |
no |
subnet_id | subnet_id | string |
null |
no |
user_data_path | user_data_path | string |
null |
no |
user_data_replace_on_change | recreate on user data change | bool |
true |
no |
vars | variable for user_data | map(string) |
{} |
no |
Name | Description |
---|---|
ami_id | ami id |
ec2_instance_profile | ec2_instance_profile |
eip_ip | public ip of instance |
instance_id | instance id |
instance_role | ec2_instance_profile |
private_dns_name | private dns name |
private_ip | private ip of instance |
public_dns_name | public dns name |