Skip to content

Update docs and example #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
]
}
}