Skip to content

Commit 1dd75fa

Browse files
committed
feat(tests): cluster tests
1 parent efda283 commit 1dd75fa

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
provider "aws" {
2+
region = "ap-south-1"
3+
profile = "dev"
4+
}
5+
6+
################################################################################
7+
# Autoscaling Group
8+
################################################################################
9+
10+
run "ecs_cluster_attributes_match" {
11+
command = plan
12+
13+
module {
14+
source = "./modules/cluster"
15+
}
16+
17+
variables {
18+
name = "example-cluster-name"
19+
service_connect_namespace = "arn:aws:cloudmap:us-west-2:123456789012:namespace/ns-1234567890123456"
20+
21+
setting = [
22+
{
23+
name = "containerInsights",
24+
value = "enabled"
25+
}
26+
]
27+
28+
tags = {
29+
Example = "Tag"
30+
}
31+
}
32+
33+
assert {
34+
condition = aws_ecs_cluster.this.name == var.name
35+
error_message = "Name mismatch"
36+
}
37+
38+
assert {
39+
condition = aws_ecs_cluster.this.configuration[0].execute_command_configuration[0].logging == "NONE"
40+
error_message = "Execute command configuration logging mismatch"
41+
}
42+
43+
assert {
44+
condition = aws_ecs_cluster.this.service_connect_defaults[0].namespace == var.service_connect_namespace
45+
error_message = "Service connect namespace mismatch"
46+
}
47+
48+
assert {
49+
condition = length(aws_ecs_cluster.this.setting) == 1
50+
error_message = "Setting count mismatch"
51+
}
52+
53+
assert {
54+
condition = aws_ecs_cluster.this.setting == toset(var.setting)
55+
error_message = "Setting mismatch"
56+
}
57+
58+
assert {
59+
condition = aws_ecs_cluster.this.tags == var.tags
60+
error_message = "Tags mismatch"
61+
}
62+
}

0 commit comments

Comments
 (0)