Skip to content

Commit c08fb91

Browse files
authored
Merge pull request #37 from meltwater/readme-improvements
[docs] README Improvements
2 parents 5e133e1 + 1cd2ccf commit c08fb91

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

README.md

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
## Purpose
66

7-
This Terraform module sets up everything necessary for dynamically setting hostnames following a certain pattern on instances spawned by AWS Auto Scaling Groups (ASGs).
7+
This Terraform module sets up everything necessary for dynamically setting hostnames following a certain pattern on instances spawned by AWS Auto Scaling Groups (ASGs).
88

9-
Learn more about our motivation to build this module in [this blog post](https://underthehood.meltwater.com/blog/2020/02/07/dynamic-route53-records-for-aws-auto-scaling-groups-with-terraform/).
9+
Learn more about our motivation to build this module in our blog post [Dynamic Route53 records for AWS Auto Scaling Groups with Terraform](https://underthehood.meltwater.com/blog/2020/02/07/dynamic-route53-records-for-aws-auto-scaling-groups-with-terraform/).
1010

11-
# Requirements
11+
## Requirements
1212

1313
- [Terraform](https://www.terraform.io/downloads.html) 0.12+
1414
- [Terraform AWS provider](https://github.com/terraform-providers/terraform-provider-aws) 2.0+
@@ -30,7 +30,7 @@ tag {
3030
propagate_at_launch = true
3131
}
3232
```
33-
33+
3434
Once you have your ASG set up, you can just invoke this module and point to it:
3535
```hcl
3636
module "clever_name_autoscale_dns" {
@@ -45,26 +45,26 @@ module "clever_name_autoscale_dns" {
4545

4646
## How does it work?
4747

48-
The module sets up the following
48+
The module sets up these things:
4949

50-
- A SNS topic
51-
- A Lambda function
52-
- A topic subscription sending SNS events to the Lambda function
50+
1. A SNS topic
51+
2. A Lambda function
52+
3. A topic subscription sending SNS events to the Lambda function
5353

5454
The Lambda function then does the following:
5555

5656
- Fetch the `asg:hostname_pattern` tag value from the ASG, and parse out the hostname and Route53 zone ID from it.
57-
- If it's a instance being created
57+
- If it's an instance being **created**
5858
- Fetch internal IP from EC2 API
5959
- Create a Route53 record pointing the hostname to the IP
6060
- Set the Name tag of the instance to the initial part of the generated hostname
61-
- If it's an instance being deleted
61+
- If it's an instance being **deleted**
6262
- Fetch the internal IP from the existing record from the Route53 API
6363
- Delete the record
6464

6565
## Setup
6666

67-
Add `initial_lifecycle_hook` definitions to your `aws_autoscaling_group resource` , like so:
67+
Add `initial_lifecycle_hook` definitions to your `aws_autoscaling_group` resource , like so:
6868

6969
```hcl
7070
resource "aws_autoscaling_group" "my_asg" {
@@ -113,7 +113,7 @@ resource "aws_autoscaling_group" "my_asg" {
113113
module "autoscale_dns" {
114114
source = "meltwater/asg-dns-handler/aws"
115115
version = "x.y.z"
116-
116+
117117
autoscale_handler_unique_identifier = "my_asg_handler"
118118
autoscale_route53zone_arn = var.internal_zone_id
119119
vpc_name = var.vpc_name
@@ -122,17 +122,13 @@ module "autoscale_dns" {
122122

123123
## Difference between Lifecycle action
124124

125-
Lifecycle_hook can have `CONTINUE` or `ABANDON` as default_result. By setting default_result to `ABANDON` will terminate the instance if the lambda function fails to update the DNS record as required. `Complete_lifecycle_action` in lambda function returns `LifecycleActionResult` as `CONTINUE` on success to Lifecycle_hook. But if lambda function fails, Lifecycle_hook doesn't get any response from `Complete_lifecycle_action` which results in timeout and terminates the instance.
125+
Lifecycle_hook can have `CONTINUE` or `ABANDON` as default_result. By setting default_result to `ABANDON` will terminate the instance if the lambda function fails to update the DNS record as required. `Complete_lifecycle_action` in lambda function returns `LifecycleActionResult` as `CONTINUE` on success to Lifecycle_hook. But if lambda function fails, Lifecycle_hook doesn't get any response from `Complete_lifecycle_action` which results in timeout and terminates the instance.
126126

127127
At the conclusion of a lifecycle hook, the result is either ABANDON or CONTINUE.
128128
If the instance is launching, CONTINUE indicates that your actions were successful, and that the instance can be put into service. Otherwise, ABANDON indicates that your custom actions were unsuccessful, and that the instance can be terminated.
129129

130130
If the instance is terminating, both ABANDON and CONTINUE allow the instance to terminate. However, ABANDON stops any remaining actions, such as other lifecycle hooks, while CONTINUE allows any other lifecycle hooks to complete.
131131

132-
## TODO
133-
134-
- Reverse lookup records?
135-
136132
## License and Copyright
137133

138134
This project was built at Meltwater. It is licensed under the [Apache License 2.0](LICENSE).

0 commit comments

Comments
 (0)