Terraform module to run a basic ec2 on AWS with some basic defaults.
- ec2
- Basic options exposed
- Security group
- Exposes the official aws-terraform-security-groups
- VPC
- If no VPC is supplied, deploys in default VPC
- EBS
- Create volume and mount or not
- IAM
- Able to provide custom policy or managed policy for instance profile
- Elastic IP
- Optional create
- AMI
- Supply AMI ID or default to ubuntu
- Key pair
- Supply public key or just keyname
- User data
- You are going to want to override
For Terraform v0.12.0+
module "this" {
source = "github.com/robc-io/terraform-aws-ec2-basic"
name = "stuff"
}
No issue is creating limit on this module.
Name | Version |
---|---|
aws | n/a |
random | n/a |
template | n/a |
Name | Description | Type | Default | Required |
---|---|---|---|---|
ami_id | n/a | string |
"" |
no |
create | Boolean to determine if you should create the instance or destroy all associated resources | bool |
true |
no |
create_eip | Optional ability to create elastic IP | bool |
false |
no |
ebs_prevent_destroy | n/a | bool |
false |
no |
ebs_volume_id | The volume id of the ebs volume to mount | string |
"" |
no |
ebs_volume_size | n/a | number |
0 |
no |
ec2_prevent_destroy | n/a | bool |
false |
no |
egress_rules | From terraform-aws-security-group module | list(string) |
[ |
no |
eip_prevent_destroy | n/a | bool |
false |
no |
iam_managed_policies | List of managed policies to add to instance profile. Instance profile must not be specified as it has precendance | list(string) |
[] |
no |
ingress_cidr_blocks | From terraform-aws-security-group module | list(string) |
[] |
no |
ingress_rules | From terraform-aws-security-group module | list(string) |
[] |
no |
ingress_with_cidr_blocks | From terraform-aws-security-group module | list(map(string)) |
[] |
no |
instance_profile_id | n/a | string |
"" |
no |
instance_type | n/a | string |
"m4.large" |
no |
json_policy | A user supplied policy to add to the instance | string |
"" |
no |
json_policy_name | The name of the user defined policy | string |
"" |
no |
key_name | If this is supplied, it takes precidence | string |
"" |
no |
local_public_key | n/a | string |
"" |
no |
monitoring | Send logs and metrics to cloudwatch | bool |
true |
no |
name | The name to be used in tags | any |
n/a | yes |
root_volume_size | n/a | number |
8 |
no |
subnet_id | Supply both vpc_id and subnet_id or deploy into default vpc | string |
"" |
no |
tags | Tags that are appended | map(string) |
{} |
no |
user_data | n/a | string |
"" |
no |
user_data_script | n/a | string |
"user_data_ubuntu_ebs.sh" |
no |
volume_path | n/a | string |
"/dev/sdf" |
no |
vpc_id | Supply both vpc_id and subnet_id or deploy into default vpc | string |
"" |
no |
vpc_security_group_ids | A list of provided descurity group IDs | list(string) |
n/a | yes |
Name | Description |
---|---|
eip_id | n/a |
instance_id | n/a |
instance_profile_id | n/a |
key_name | n/a |
private_ip | n/a |
public_ip | n/a |
volume_path | n/a |
This module has been packaged with terratest tests.
go mod tidy
make test
To run them:
- Install Go
- Run
make test-init
from the root of this repo - Run
make test
again from root
Module managed by robc-io
Apache 2 Licensed. See LICENSE for full details.