Skip to content

Commit e09deb9

Browse files
authored
Migrate readme yaml (#31)
* Migrate readme yaml * Add related section
1 parent 60f3510 commit e09deb9

File tree

7 files changed

+404
-101
lines changed

7 files changed

+404
-101
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
.terraform/
33
.idea
44
*.iml
5+
6+
.build-harness
7+
build-harness

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
SHELL := /bin/bash
22

3+
# List of targets the `readme` target should call before generating the readme
4+
export README_DEPS ?= docs/targets.md docs/terraform.md
5+
36
-include $(shell curl -sSL -o .build-harness "https://git.io/build-harness"; echo .build-harness)
47

8+
## Lint terraform code
59
lint:
6-
$(SELF) terraform/install terraform/get-modules terraform/get-plugins terraform/lint terraform/validate
10+
$(SELF) terraform/install terraform/get-modules terraform/get-plugins terraform/lint terraform/validate

README.md

Lines changed: 192 additions & 99 deletions
Large diffs are not rendered by default.

README.yaml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
---
2+
#
3+
# This is the canonical configuration for the `README.md`
4+
# Run `make readme` to rebuild the `README.md`
5+
#
6+
7+
# Name of this project
8+
name: terraform-aws-ec2-instance
9+
10+
# Logo for this project
11+
#logo: docs/logo.png
12+
13+
# License of this project
14+
license: "APACHE2"
15+
16+
# Canonical GitHub repo
17+
github_repo: cloudposse/terraform-aws-ec2-instance
18+
19+
# Badges to display
20+
badges:
21+
- name: "Build Status"
22+
image: "https://travis-ci.org/cloudposse/terraform-aws-ec2-instance.svg?branch=master"
23+
url: "https://travis-ci.org/cloudposse/terraform-aws-ec2-instance"
24+
- name: "Latest Release"
25+
image: "https://img.shields.io/github/release/cloudposse/terraform-aws-ec2-instance.svg"
26+
url: "https://github.com/cloudposse/terraform-aws-ec2-instance/releases/latest"
27+
- name: "Slack Community"
28+
image: "https://slack.cloudposse.com/badge.svg"
29+
url: "https://slack.cloudposse.com"
30+
31+
related:
32+
- name: "terraform-aws-ec2-ami-backup"
33+
description: "Terraform module for automatic & scheduled AMI creation"
34+
url: "https://github.com/cloudposse/terraform-aws-ec2-ami-backup"
35+
- name: "terraform-aws-ec2-ami-snapshot"
36+
description: "Terraform module to easily generate AMI snapshots to create replica instances"
37+
url: "https://github.com/cloudposse/terraform-aws-ec2-ami-snapshot"
38+
- name: "terraform-aws-ec2-cloudwatch-sns-alarms"
39+
description: "Terraform module that configures CloudWatch SNS alerts for EC2 instances"
40+
url: "https://github.com/cloudposse/terraform-aws-ec2-cloudwatch-sns-alarms"
41+
- name: "terraform-null-label"
42+
description: "Terraform Module to define a consistent naming convention by (namespace, stage, name, [attributes])"
43+
url: "https://github.com/cloudposse/terraform-null-label"
44+
45+
# Short description of this project
46+
description: |-
47+
Terraform Module for provisioning a general purpose EC2 host.
48+
49+
Included features:
50+
* Automatically create a Security Group
51+
* Option to switch EIP attachment
52+
* CloudWatch monitoring and automatic reboot if instance hangs
53+
* Assume Role capability
54+
55+
# How to use this project
56+
usage: |-
57+
Note: add `${var.ssh_key_pair}` private key to the `ssh agent`.
58+
59+
Include this repository as a module in your existing terraform code.
60+
61+
### Simple example:
62+
63+
```hcl
64+
module "instance" {
65+
source = "git::https://github.com/cloudposse/terraform-aws-ec2-instance.git?ref=master"
66+
ssh_key_pair = "${var.ssh_key_pair}"
67+
instance_type = "${var.instance_type}"
68+
vpc_id = "${var.vpc_id}"
69+
security_groups = ["${var.security_groups}"]
70+
subnet = "${var.subnet}"
71+
name = "${var.name}"
72+
namespace = "${var.namespace}"
73+
stage = "${var.stage}"
74+
}
75+
```
76+
77+
### Example with additional volumes and EIP
78+
79+
```hcl
80+
module "kafka_instance" {
81+
source = "git::https://github.com/cloudposse/terraform-aws-ec2-instance.git?ref=master"
82+
ssh_key_pair = "${var.ssh_key_pair}"
83+
vpc_id = "${var.vpc_id}"
84+
security_groups = ["${var.security_groups}"]
85+
subnet = "${var.subnet}"
86+
associate_public_ip_address = "true"
87+
name = "kafka"
88+
namespace = "cp"
89+
stage = "dev"
90+
additional_ips_count = "1"
91+
ebs_volume_count = "2"
92+
allowed_ports = ["22", "80", "443"]
93+
}
94+
```
95+
96+
# References
97+
references:
98+
- name: "terraform-aws-ec2-bastion-server"
99+
description: 'Terraform Module to define a generic Bastion host with parameterized user_data'
100+
url: "https://github.com/cloudposse/terraform-aws-ec2-bastion-server"
101+
102+
include:
103+
- "docs/targets.md"
104+
- "docs/terraform.md"
105+
106+
# Contributors to this project
107+
contributors:
108+
- name: "Erik Osterman"
109+
github: "osterman"
110+
- name: "Igor Rodionov"
111+
github: "goruha"
112+
- name: "Andriy Knysh"
113+
github: "aknysh"
114+
- name: "Sergey Vasilyev"
115+
github: "s2504s"
116+
- name: "Valeriy"
117+
github: "drama17"
118+
- name: "Ivan Pinatti"
119+
github: "ivan-pinatti"
120+
- name: "Vladimir"
121+
github: "SweetOps"
122+
- name: "Konstantin B"
123+
github: "comeanother"

docs/targets.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## Makefile Targets
2+
```
3+
Available targets:
4+
5+
help This help screen
6+
help/all Display help for all targets
7+
lint Lint terraform code
8+
9+
```

docs/terraform.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
2+
## Inputs
3+
4+
| Name | Description | Type | Default | Required |
5+
|------|-------------|:----:|:-----:|:-----:|
6+
| additional_ips_count | Count of additional EIPs | string | `0` | no |
7+
| allowed_ports | List of allowed ingress ports | list | `<list>` | no |
8+
| ami | The AMI to use for the instance. By default it is the AMI provided by Amazon with Ubuntu 16.04 | string | `` | no |
9+
| applying_period | The period in seconds over which the specified statistic is applied | string | `60` | no |
10+
| assign_eip_address | Assign an Elastic IP address to the instance | string | `true` | no |
11+
| associate_public_ip_address | Associate a public IP address with the instance | string | `true` | no |
12+
| attributes | Additional attributes (e.g. `1`) | list | `<list>` | no |
13+
| availability_zone | Availability Zone the instance is launched in. If not set, will be launched in the first AZ of the region | string | `` | no |
14+
| comparison_operator | The arithmetic operation to use when comparing the specified Statistic and Threshold. Possible values are: GreaterThanOrEqualToThreshold, GreaterThanThreshold, LessThanThreshold, LessThanOrEqualToThreshold. | string | `GreaterThanOrEqualToThreshold` | no |
15+
| create_default_security_group | Create default Security Group with only Egress traffic allowed | string | `true` | no |
16+
| default_alarm_action | | string | `action/actions/AWS_EC2.InstanceId.Reboot/1.0` | no |
17+
| delete_on_termination | Whether the volume should be destroyed on instance termination | string | `true` | no |
18+
| delimiter | Delimiter to be used between `name`, `namespace`, `stage`, etc. | string | `-` | no |
19+
| disable_api_termination | Enable EC2 Instance Termination Protection | string | `false` | no |
20+
| ebs_device_name | Name of the EBS device to mount | list | `<list>` | no |
21+
| ebs_iops | Amount of provisioned IOPS. This must be set with a volume_type of io1 | string | `0` | no |
22+
| ebs_optimized | Launched EC2 instance will be EBS-optimized | string | `false` | no |
23+
| ebs_volume_count | Count of EBS volumes that will be attached to the instance | string | `0` | no |
24+
| ebs_volume_size | Size of the EBS volume in gigabytes | string | `10` | no |
25+
| ebs_volume_type | The type of EBS volume. Can be standard, gp2 or io1 | string | `gp2` | no |
26+
| evaluation_periods | The number of periods over which data is compared to the specified threshold. | string | `5` | no |
27+
| instance_enabled | Flag to control the instance creation. Set to false if it is necessary to skip instance creation | string | `true` | no |
28+
| instance_type | The type of the instance | string | `t2.micro` | no |
29+
| ipv6_address_count | Number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet | string | `0` | no |
30+
| ipv6_addresses | List of IPv6 addresses from the range of the subnet to associate with the primary network interface | list | `<list>` | no |
31+
| metric_name | The name for the alarm's associated metric. Allowed values can be found in https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/ec2-metricscollected.html | string | `StatusCheckFailed_Instance` | no |
32+
| metric_namespace | The namespace for the alarm's associated metric. Allowed values can be found in https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/aws-namespaces.html | string | `AWS/EC2` | no |
33+
| metric_threshold | The value against which the specified statistic is compared | string | `1` | no |
34+
| monitoring | Launched EC2 instance will have detailed monitoring enabled | string | `true` | no |
35+
| name | Name (e.g. `bastion` or `db`) | string | - | yes |
36+
| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | - | yes |
37+
| private_ip | Private IP address to associate with the instance in the VPC | string | `` | no |
38+
| region | AWS Region the instance is launched in | string | `` | no |
39+
| root_iops | Amount of provisioned IOPS. This must be set if root_volume_type is set to `io1` | string | `0` | no |
40+
| root_volume_size | Size of the root volume in gigabytes | string | `10` | no |
41+
| root_volume_type | Type of root volume. Can be standard, gp2 or io1 | string | `gp2` | no |
42+
| security_groups | List of Security Group IDs allowed to connect to the instance | list | `<list>` | no |
43+
| 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 | string | `true` | no |
44+
| ssh_key_pair | SSH key pair to be provisioned on the instance | string | - | yes |
45+
| stage | Stage (e.g. `prod`, `dev`, `staging` | string | - | yes |
46+
| statistic_level | The statistic to apply to the alarm's associated metric. Allowed values are: SampleCount, Average, Sum, Minimum, Maximum | string | `Maximum` | no |
47+
| subnet | VPC Subnet ID the instance is launched in | string | - | yes |
48+
| tags | Additional tags | map | `<map>` | no |
49+
| user_data | Instance user data. Do not pass gzip-compressed data via this argument | string | `` | no |
50+
| vpc_id | The ID of the VPC that the instance security group belongs to | string | - | yes |
51+
| welcome_message | | string | `` | no |
52+
53+
## Outputs
54+
55+
| Name | Description |
56+
|------|-------------|
57+
| additional_eni_ids | Map of ENI to EIP |
58+
| alarm | CloudWatch Alarm ID |
59+
| ebs_ids | IDs of EBSs |
60+
| id | Disambiguated ID of the instance |
61+
| network_interface_id | ID of the network interface that was created with the instance |
62+
| primary_network_interface_id | ID of the instance's primary network interface |
63+
| private_dns | Private DNS of instance |
64+
| private_ip | Private IP of instance |
65+
| public_dns | Public DNS of instance (or DNS of EIP) |
66+
| public_ip | Public IP of instance (or EIP) |
67+
| role | Name of AWS IAM Role associated with the instance |
68+
| security_group_ids | IDs on the AWS Security Groups associated with the instance |
69+
| ssh_key_pair | Name of the SSH key pair provisioned on the instance |
70+

variables.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ variable "name" {
5555
}
5656

5757
variable "delimiter" {
58-
default = "-"
58+
default = "-"
59+
description = "Delimiter to be used between `name`, `namespace`, `stage`, etc."
5960
}
6061

6162
variable "attributes" {

0 commit comments

Comments
 (0)