File tree Expand file tree Collapse file tree 3 files changed +34
-33
lines changed Expand file tree Collapse file tree 3 files changed +34
-33
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,9 @@ Create an ASG and set the `asg:hostname_pattern` tag for example like this:
21
21
asg-test-#instanceid.asg-handler-vpc.testing@Z3QP9GZSRL8IVA
22
22
```
23
23
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:
25
27
26
28
``` hcl
27
29
tag {
Original file line number Diff line number Diff line change @@ -61,36 +61,17 @@ resource "aws_autoscaling_group" "test" {
61
61
62
62
tag {
63
63
key = " asg:hostname_pattern"
64
+ # Ensure that the value you choose here contains a fully qualified domain name for the zone before the @ symbol
64
65
value = " asg-test-#instanceid.asg-handler-vpc.testing@${ aws_route53_zone . test . id } "
65
66
propagate_at_launch = true
66
67
}
67
68
}
68
69
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
72
73
73
- tags = {
74
- Name = " asg-handler "
74
+ vpc {
75
+ vpc_id = module . vpc . vpc_id
75
76
}
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
+ }
Original file line number Diff line number Diff line change @@ -18,12 +18,30 @@ module "vpc" {
18
18
enable_vpn_gateway = true
19
19
}
20
20
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 "
24
24
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
27
36
}
28
- }
29
37
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
+ }
You can’t perform that action at this time.
0 commit comments