Skip to content

Commit d9035d0

Browse files
committed
feat(tests): route-53-record sub-module unit tests
1 parent 833a717 commit d9035d0

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
provider "aws" {
2+
region = "ap-south-1"
3+
}
4+
5+
################################################################################
6+
# Route53 Record
7+
################################################################################
8+
9+
run "route53_record_attributes_match" {
10+
command = plan
11+
12+
module {
13+
source = "./modules/route-53-record"
14+
}
15+
16+
variables {
17+
zone_id = "ExampleZoneId"
18+
domain = "example.com"
19+
alb_dns_name = "example-alb-123456789.ap-south-1.elb.amazonaws.com"
20+
alb_zone_id = "Z123456789EXAMPLE"
21+
}
22+
23+
assert {
24+
condition = aws_route53_record.this.name == var.domain
25+
error_message = "Domain name mismatch"
26+
}
27+
28+
assert {
29+
condition = aws_route53_record.this.type == "A"
30+
error_message = "Record type mismatch"
31+
}
32+
33+
assert {
34+
condition = aws_route53_record.this.alias[0].name == var.alb_dns_name
35+
error_message = "ALB DNS name mismatch"
36+
}
37+
38+
assert {
39+
condition = aws_route53_record.this.alias[0].zone_id == var.alb_zone_id
40+
error_message = "ALB zone ID mismatch"
41+
}
42+
43+
assert {
44+
condition = aws_route53_record.this.alias[0].evaluate_target_health == true
45+
error_message = "Evaluate target health mismatch"
46+
}
47+
}

0 commit comments

Comments
 (0)