Skip to content

Commit 744fc27

Browse files
committed
fix(tests/asg): missing attribute iam_role_policy_attachments
1 parent bf8407f commit 744fc27

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

tests/asg_unit_tests.tftest.hcl

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ run "asg_attributes_match" {
2020
create_launch_template = false
2121
launch_template_id = "lt-068f72b729example"
2222

23-
iam_role_ec2_container_service_role_arn = "arn:aws:iam::aws:policy/abcd/efgh"
23+
iam_role_policy_attachments = [
24+
"arn:aws:iam::aws:policy/abcd/efgh"
25+
]
2426

2527
instances_tags = {
2628
Example = "Tag"
@@ -129,7 +131,9 @@ run "launch_template_attributes_match" {
129131
}
130132
}
131133

132-
iam_role_ec2_container_service_role_arn = "arn:aws:iam::aws:policy/abcd/efgh"
134+
iam_role_policy_attachments = [
135+
"arn:aws:iam::aws:policy/abcd/efgh"
136+
]
133137
}
134138

135139
assert {
@@ -199,7 +203,9 @@ run "iam_policy_document_attributes_match" {
199203
}
200204
}
201205

202-
iam_role_ec2_container_service_role_arn = "arn:aws:iam::aws:policy/abcd/efgh"
206+
iam_role_policy_attachments = [
207+
"arn:aws:iam::aws:policy/abcd/efgh"
208+
]
203209
}
204210

205211
assert {
@@ -245,9 +251,11 @@ run "does_not_create_iam_role" {
245251
}
246252
}
247253

248-
create_iam_role = false
249-
iam_role_name = "example-iam-role-name"
250-
iam_role_ec2_container_service_role_arn = "arn:aws:iam::aws:policy/abcd/efgh"
254+
create_iam_role = false
255+
iam_role_name = "example-iam-role-name"
256+
iam_role_policy_attachments = [
257+
"arn:aws:iam::aws:policy/abcd/efgh"
258+
]
251259
}
252260

253261
assert {
@@ -298,7 +306,9 @@ run "iam_role_attributes_match" {
298306
iam_role_tags = {
299307
ExampleIAM = "RoleTags"
300308
}
301-
iam_role_ec2_container_service_role_arn = "arn:aws:iam::aws:policy/abcd/efgh"
309+
iam_role_policy_attachments = [
310+
"arn:aws:iam::aws:policy/abcd/efgh"
311+
]
302312
}
303313

304314
assert {
@@ -354,7 +364,9 @@ run "iam_role_policy_attachment_attributes_match" {
354364
iam_role_tags = {
355365
ExampleIAM = "RoleTags"
356366
}
357-
iam_role_ec2_container_service_role_arn = "arn:aws:iam::aws:policy/abcd/efgh"
367+
iam_role_policy_attachments = [
368+
"arn:aws:iam::aws:policy/abcd/efgh"
369+
]
358370
}
359371

360372
assert {
@@ -368,7 +380,7 @@ run "iam_role_policy_attachment_attributes_match" {
368380
}
369381

370382
assert {
371-
condition = aws_iam_role_policy_attachment.this[0].policy_arn == var.iam_role_ec2_container_service_role_arn
383+
condition = aws_iam_role_policy_attachment.this[0].policy_arn == var.iam_role_policy_attachments[0]
372384
error_message = "Policy ARN mismatch"
373385
}
374386
}
@@ -405,7 +417,9 @@ run "does_not_create_iam_instance_profile" {
405417
iam_role_tags = {
406418
ExampleIAM = "RoleTags"
407419
}
408-
iam_role_ec2_container_service_role_arn = "arn:aws:iam::aws:policy/abcd/efgh"
420+
iam_role_policy_attachments = [
421+
"arn:aws:iam::aws:policy/abcd/efgh"
422+
]
409423

410424
create_iam_instance_profile = false
411425
iam_instance_profile_name = "example-iam-instance-profile-name"
@@ -449,7 +463,9 @@ run "iam_instance_profile_attributes_match" {
449463
iam_role_tags = {
450464
ExampleIAM = "RoleTags"
451465
}
452-
iam_role_ec2_container_service_role_arn = "arn:aws:iam::aws:policy/abcd/efgh"
466+
iam_role_policy_attachments = [
467+
"arn:aws:iam::aws:policy/abcd/efgh"
468+
]
453469

454470
create_iam_instance_profile = true
455471
iam_instance_profile_name = "example-iam-instance-profile-name"

0 commit comments

Comments
 (0)