Skip to content

Commit

Permalink
Merge pull request #53 from meltwater/hikerspath-patch-1
Browse files Browse the repository at this point in the history
Documentation Updates v1
  • Loading branch information
hikerspath authored Mar 22, 2022
2 parents 5377773 + 2a3c8ca commit 0a45bb7
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 34 deletions.
63 changes: 63 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## DEPRECATED

## [v1.1.2](https://github.com/meltwater/terraform-aws-asg-dns-handler/compare/v1.0.5...v1.1.1) - 2022-03-11

### Added

- Changelog for v1 spec

### Changed

- Readme

## [v1.1.1](https://github.com/meltwater/terraform-aws-asg-dns-handler/compare/v1.0.5...v1.1.1) - 2022-03-11

### Changed

- Readme

## [v1.0.5](https://github.com/meltwater/terraform-aws-asg-dns-handler/compare/v1.0.4...v1.0.5) - 2021-07-01

### Changed

- Upgrade Lambda function to use Python 3.8 runtime

## [v1.0.5](https://github.com/meltwater/terraform-aws-asg-dns-handler/compare/v1.0.4...v1.0.5) - 2021-07-01

### Changed

- Upgrade Lambda function to use Python 3.8 runtime

## [v1.0.4](https://github.com/meltwater/terraform-aws-asg-dns-handler/compare/v1.0.3...v1.0.4) - 2019-11-14

### Added

- Added unique id's to allow multiple uses within the same account ([#17](https://github.com/meltwater/terraform-aws-asg-dns-handler/pull/17) [@seanturner83](https://github.com/seanturner83))

### Changed

- Updated testing scenarios for latest aws provider ([#20](https://github.com/meltwater/terraform-aws-asg-dns-handler/pull/20) [@hikerspath](https://github.com/hikerspath))

## [v1.0.3](https://github.com/meltwater/terraform-aws-asg-dns-handler/compare/v1.0.2...v1.0.3) - 2019-02-11

### Fixed

- Fix for Lifecycle_hooks

## [v1.0.2](https://github.com/meltwater/terraform-aws-asg-dns-handler/compare/v1.0.1...v1.0.2) - 2019-01-21

### Changed

- Outputs.tf and variables.tf updated.

## [v1.0.1](https://github.com/meltwater/terraform-aws-asg-dns-handler/compare/v1.0.2...v1.0.1) - 2019-01-21

### Added

- Initial public release.
79 changes: 45 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
[![Build Status](https://cloud.drone.io/api/badges/meltwater/terraform-aws-asg-dns-handler/status.svg)](https://cloud.drone.io/meltwater/terraform-aws-asg-dns-handler)
# ASG DNS Handler | [![Build Status](https://cloud.drone.io/api/badges/meltwater/terraform-aws-asg-dns-handler/status.svg?ref=refs/heads/terraform-0.11)](https://cloud.drone.io/meltwater/terraform-aws-asg-dns-handler)

# ASG DNS handler
> **DEPRECATED**:
> While minimally supported for hotfixes, this branch supporting Terraform v0.11 has been deprecated. Please update to v2.0.0 of this module or greater to be able to make use of all the modules latest features.
## Deprecated
This branch supporting Terraform v0.11 has been deprecated. Please update to v2.0.0 of this module or greater.
This Terraform module sets up everything necessary for dynamically setting hostnames following a certain pattern on instances spawned by AWS Auto Scaling Groups (ASGs).

## Purpose
This module sets up everything necessary for dynamically setting hostnames following a certain pattern on instances spawned by Auto Scaling Groups
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/).

## Maintainers

This repository and the module it houses are maintained Foundation Missions A-Team. Should you encounter issues or require changes to code maintained in this repository, please reachout through an issue that is part of this project.

## Requirements

- [Terraform](https://www.terraform.io/downloads.html) 0.12+ and [Terraform AWS provider](https://github.com/terraform-providers/terraform-provider-aws) 2.0+ use v2+ releases
- [Terraform](https://www.terraform.io/downloads.html) 0.11 and below, [Terraform AWS provider](https://github.com/terraform-providers/terraform-provider-aws) 2.0.14 and below use v1.x releases

## How do I use it?

## Usage
Create an ASG and set the `asg:hostname_pattern` tag for example like this:

```
Expand All @@ -28,7 +37,8 @@ tag {
Once you have your ASG set up, you can just invoke this module and point it to it:
```hcl
module "clever_name_autoscale_dns" {
source = "../../"
source = meltwater/asg-dns-handler/aws"
version = "1.1.2"
autoscale_update_name = "clever_name"
autoscale_group_names = "${aws_autoscaling_group.my_asg.name}"
Expand Down Expand Up @@ -66,12 +76,12 @@ resource "aws_autoscaling_group" "my_asg" {
"${var.aws_subnets}"
]
min_size = "${var.asg_min_count}"
max_size = "${var.asg_max_count}"
desired_capacity = "${var.asg_desired_count}"
health_check_type = "EC2"
min_size = "${var.asg_min_count}"
max_size = "${var.asg_max_count}"
desired_capacity = "${var.asg_desired_count}"
health_check_type = "EC2"
health_check_grace_period = 300
force_delete = false
force_delete = false
launch_configuration = "${aws_launch_configuration.my_launch_config.name}"
Expand All @@ -80,44 +90,45 @@ resource "aws_autoscaling_group" "my_asg" {
}
initial_lifecycle_hook {
name = "lifecycle-launching"
default_result = "ABANDON"
heartbeat_timeout = 60
lifecycle_transition = "autoscaling:EC2_INSTANCE_LAUNCHING"
name = "lifecycle-launching"
default_result = "ABANDON"
heartbeat_timeout = 60
lifecycle_transition = "autoscaling:EC2_INSTANCE_LAUNCHING"
notification_target_arn = "${module.autoscale_dns.autoscale_handling_sns_topic_arn}"
role_arn = "${module.autoscale_dns.agent_lifecycle_iam_role_arn}"
role_arn = "${module.autoscale_dns.agent_lifecycle_iam_role_arn}"
}
initial_lifecycle_hook {
name = "lifecycle-terminating"
default_result = "ABANDON"
heartbeat_timeout = 60
lifecycle_transition = "autoscaling:EC2_INSTANCE_TERMINATING"
name = "lifecycle-terminating"
default_result = "ABANDON"
heartbeat_timeout = 60
lifecycle_transition = "autoscaling:EC2_INSTANCE_TERMINATING"
notification_target_arn = "${module.autoscale_dns.autoscale_handling_sns_topic_arn}"
role_arn = "${module.autoscale_dns.agent_lifecycle_iam_role_arn}"
role_arn = "${module.autoscale_dns.agent_lifecycle_iam_role_arn}"
}
tag {
key = "asg:hostname_pattern"
value = "${var.hostname_prefix}-#instanceid.${var.vpc_name}.testing@${var.internal_zone_id}"
key = "asg:hostname_pattern"
value = "${var.hostname_prefix}-#instanceid.${var.vpc_name}.testing@${var.internal_zone_id}"
propagate_at_launch = true
}
}
module "autoscale_dns" {
source = "meltwater/asg-dns-handler/aws"
version = "1.1.1"
autoscale_update_name = "my_asg_handler"
source = meltwater/asg-dns-handler/aws"
version = "1.1.2"
autoscale_update_name = "my_asg_handler"
autoscale_route53zone_arn = "${var.internal_zone_id}"
vpc_name = "${var.vpc_name}"
vpc_name = "${var.vpc_name}"
}
```

## Developers Guide / Contributing

Please read through the [CONTRIBUTING.md](https://github.com/meltwater/terraform-aws-asg-dns-handler/blob/master/CHANGELOG.md) to understand how to submit pull requests to us and be sure to visit our [Code of Conduct](https://github.com/meltwater/terraform-aws-asg-dns-handler/blob/master/CODE_OF_CONDUCT.md).

## Difference between Lifecycle action
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.

Expand All @@ -126,6 +137,6 @@ If the instance is launching, CONTINUE indicates that your actions were successf

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.

## TODO
## License and Copyright

- Reverse lookup records?
This project was built at Meltwater. It is licensed under the [Apache License 2.0](LICENSE).

0 comments on commit 0a45bb7

Please sign in to comment.