Skip to content

Commit

Permalink
Merge pull request #39 from meltwater/ateam11172-update-docs
Browse files Browse the repository at this point in the history
Update docs and example
  • Loading branch information
cmckeen committed Sep 2, 2021
2 parents c08fb91 + 859e67b commit 498537e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 33 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ Create an ASG and set the `asg:hostname_pattern` tag for example like this:
asg-test-#instanceid.asg-handler-vpc.testing@Z3QP9GZSRL8IVA
```

Could be interpolated in Terraform like this:
`#instanceid` is converted by a Lambda function within this module to the actual AWS instance_id that corresponds to the launched instance. The `@` symbol is used to split the FQDN from the Route 53 zone_id.

This could be interpolated in Terraform like this:

```hcl
tag {
Expand Down
33 changes: 7 additions & 26 deletions example/asg-dns-agent/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,36 +61,17 @@ resource "aws_autoscaling_group" "test" {

tag {
key = "asg:hostname_pattern"
# Ensure that the value you choose here contains a fully qualified domain name for the zone before the @ symbol
value = "asg-test-#instanceid.asg-handler-vpc.testing@${aws_route53_zone.test.id}"
propagate_at_launch = true
}
}

resource "aws_security_group" "test" {
vpc_id = module.vpc.vpc_id
name = "asg-handler-vpc-test-agent"
resource "aws_route53_zone" "test" {
name = "asg-handler-vpc.testing"
force_destroy = true

tags = {
Name = "asg-handler"
vpc {
vpc_id = module.vpc.vpc_id
}

# allow traffic within security group
ingress {
from_port = 0
to_port = 0
protocol = "-1"

cidr_blocks = module.vpc.private_subnets_cidr_blocks
}

egress {
from_port = 0
to_port = 0
protocol = "-1"

cidr_blocks = [
"0.0.0.0/0",
]
}
}

}
30 changes: 24 additions & 6 deletions example/asg-dns-agent/vpc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,30 @@ module "vpc" {
enable_vpn_gateway = true
}

resource "aws_route53_zone" "test" {
name = "asg-handler-vpc.testing"
force_destroy = true
resource "aws_security_group" "test" {
vpc_id = module.vpc.vpc_id
name = "asg-handler-vpc-test-agent"

vpc {
vpc_id = module.vpc.vpc_id
tags = {
Name = "asg-handler"
}

# allow traffic within security group
ingress {
from_port = 0
to_port = 0
protocol = "-1"

cidr_blocks = module.vpc.private_subnets_cidr_blocks
}
}

egress {
from_port = 0
to_port = 0
protocol = "-1"

cidr_blocks = [
"0.0.0.0/0",
]
}
}

0 comments on commit 498537e

Please sign in to comment.