Skip to content
This repository was archived by the owner on Nov 23, 2021. It is now read-only.

Commit 1061b67

Browse files
expanded readme for clarity on the problem this solves
1 parent 580a0ba commit 1061b67

File tree

3 files changed

+33
-12
lines changed

3 files changed

+33
-12
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# terraform-aws-ebs-optimized
22

3-
A terraform module to return true (1) or false (0) based on if an instance type
4-
supports the EBS optmized flag. If you want to use different instance types and
5-
would rather use EBS optimization whenever possible, this module does the heavy
6-
lifting of determining if that's possible.
3+
A terraform module to return true or false based on if an instance type
4+
supports the EBS optmized flag. If you want to use various instance types and
5+
EBS optimization, this module does the heavy lifting of determining if that's
6+
possible. Without the module, EC2 instance creation would fail on unsupported
7+
types and -- even worse -- launch configurations will create normally but fail
8+
silently when instances attempt to launch. This module means you don't need to
9+
think about that problem.
710

811
## Usage example
912

examples/ebs_optimized_test_fixture/main.tf

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,33 @@ data "aws_ami" "ubuntu" {
2626
owners = ["099720109477"] # Canonical
2727
}
2828

29+
resource "aws_launch_configuration" "ebs_optimized" {
30+
name_prefix = "test_ebs_optimized"
31+
image_id = "${data.aws_ami.ubuntu.id}"
32+
instance_type = "${var.supported_type}"
33+
ebs_optimized = "${module.supported_ebs.answer}"
34+
}
35+
36+
resource "aws_launch_configuration" "ebs_not_optimized" {
37+
name_prefix = "test_ebs_not_optimized"
38+
image_id = "${data.aws_ami.ubuntu.id}"
39+
instance_type = "${var.unsupported_type}"
40+
41+
ebs_optimized = "${module.unsupported_ebs.answer}"
42+
}
43+
2944
resource "aws_instance" "ebs_optimized" {
3045
ami = "${data.aws_ami.ubuntu.id}"
3146
instance_type = "${var.supported_type}"
32-
tags = "${merge(local.tags, map("Name", "test_ebs_optimized"))}"
3347
ebs_optimized = "${module.supported_ebs.answer}"
48+
tags = "${merge(local.tags, map("Name", "test_ebs_optimized"))}"
3449
}
3550

3651
resource "aws_instance" "ebs_not_optimized" {
3752
ami = "${data.aws_ami.ubuntu.id}"
3853
instance_type = "${var.unsupported_type}"
39-
tags = "${merge(local.tags, map("Name", "test_not_ebs_optimized"))}"
4054
ebs_optimized = "${module.unsupported_ebs.answer}"
55+
tags = "${merge(local.tags, map("Name", "test_not_ebs_optimized"))}"
4156
}
4257

4358
module "supported_ebs" {

main.tf

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
/**
22
# terraform-aws-ebs-optimized
33
4-
* A terraform module to return true (1) or false (0) based on if an instance type
5-
* supports the EBS optmized flag. If you want to use different instance types and
6-
* would rather use EBS optimization whenever possible, this module does the heavy
7-
* lifting of determining if that's possible.
4+
* A terraform module to return true or false based on if an instance type
5+
* supports the EBS optmized flag. If you want to use various instance types and
6+
* EBS optimization, this module does the heavy lifting of determining if that's
7+
* possible. Without the module, EC2 instance creation would fail on unsupported
8+
* types and -- even worse -- launch configurations will create normally but fail
9+
* silently when instances attempt to launch. This module means you don't need to
10+
* think about that problem.
811
912
* ## Usage example
1013
@@ -15,12 +18,12 @@
1518
* description = "Size/type of the host."
1619
* default = "m1.large"
1720
* }
18-
*
21+
*
1922
* module "ebs_optimized" {
2023
* source = "terraform-aws-modules/ebs-optimized/aws"
2124
* instance_type = "${var.web_type}"
2225
* }
23-
*
26+
*
2427
* resource "aws_instance" "web" {
2528
* ami = "${data.aws_ami.ubuntu.id}"
2629
* instance_type = "${var.web_type}"

0 commit comments

Comments
 (0)