Skip to content

Commit 498537e

Browse files
authored
Merge pull request #39 from meltwater/ateam11172-update-docs
Update docs and example
2 parents c08fb91 + 859e67b commit 498537e

File tree

3 files changed

+34
-33
lines changed

3 files changed

+34
-33
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ Create an ASG and set the `asg:hostname_pattern` tag for example like this:
2121
asg-test-#instanceid.asg-handler-vpc.testing@Z3QP9GZSRL8IVA
2222
```
2323

24-
Could be interpolated in Terraform like this:
24+
`#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.
25+
26+
This could be interpolated in Terraform like this:
2527

2628
```hcl
2729
tag {

example/asg-dns-agent/main.tf

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -61,36 +61,17 @@ resource "aws_autoscaling_group" "test" {
6161

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

69-
resource "aws_security_group" "test" {
70-
vpc_id = module.vpc.vpc_id
71-
name = "asg-handler-vpc-test-agent"
70+
resource "aws_route53_zone" "test" {
71+
name = "asg-handler-vpc.testing"
72+
force_destroy = true
7273

73-
tags = {
74-
Name = "asg-handler"
74+
vpc {
75+
vpc_id = module.vpc.vpc_id
7576
}
76-
77-
# allow traffic within security group
78-
ingress {
79-
from_port = 0
80-
to_port = 0
81-
protocol = "-1"
82-
83-
cidr_blocks = module.vpc.private_subnets_cidr_blocks
84-
}
85-
86-
egress {
87-
from_port = 0
88-
to_port = 0
89-
protocol = "-1"
90-
91-
cidr_blocks = [
92-
"0.0.0.0/0",
93-
]
94-
}
95-
}
96-
77+
}

example/asg-dns-agent/vpc.tf

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,30 @@ module "vpc" {
1818
enable_vpn_gateway = true
1919
}
2020

21-
resource "aws_route53_zone" "test" {
22-
name = "asg-handler-vpc.testing"
23-
force_destroy = true
21+
resource "aws_security_group" "test" {
22+
vpc_id = module.vpc.vpc_id
23+
name = "asg-handler-vpc-test-agent"
2424

25-
vpc {
26-
vpc_id = module.vpc.vpc_id
25+
tags = {
26+
Name = "asg-handler"
27+
}
28+
29+
# allow traffic within security group
30+
ingress {
31+
from_port = 0
32+
to_port = 0
33+
protocol = "-1"
34+
35+
cidr_blocks = module.vpc.private_subnets_cidr_blocks
2736
}
28-
}
2937

38+
egress {
39+
from_port = 0
40+
to_port = 0
41+
protocol = "-1"
42+
43+
cidr_blocks = [
44+
"0.0.0.0/0",
45+
]
46+
}
47+
}

0 commit comments

Comments
 (0)