@@ -256,6 +256,7 @@ variables {
256256EOF
257257}
258258
259+ # Attribute validations for policy module
259260run "policy_name_match" {
260261 command = plan
261262
@@ -410,3 +411,64 @@ run "policy_tags_match" {
410411 error_message = " Tag 'another_key_name' with value 'another_value' is missing or incorrect"
411412 }
412413}
414+
415+ # Attribute validations for policy_attachment module
416+ run "policy_attachment_policy_id_match" {
417+ command = plan
418+
419+ module {
420+ source = " ./modules/policy_attachment/"
421+ }
422+
423+ variables {
424+ policy_id = " p-12345678"
425+ target_id = " r-1234"
426+ skip_destroy = true
427+ expected_policy_id = " p-12345678"
428+ }
429+
430+ assert {
431+ condition = aws_organizations_policy_attachment. this . policy_id == var. expected_policy_id
432+ error_message = " Policy ID mismatch after attachment"
433+ }
434+ }
435+
436+ run "policy_attachment_target_id_match" {
437+ command = plan
438+
439+ module {
440+ source = " ./modules/policy_attachment/"
441+ }
442+
443+ variables {
444+ policy_id = " p-12345678"
445+ target_id = " r-1234"
446+ skip_destroy = true
447+ expected_target_id = " r-1234"
448+ }
449+
450+ assert {
451+ condition = aws_organizations_policy_attachment. this . target_id == var. expected_target_id
452+ error_message = " Target ID mismatch after attachment"
453+ }
454+ }
455+
456+ run "policy_attachment_skip_destroy_match" {
457+ command = plan
458+
459+ module {
460+ source = " ./modules/policy_attachment/"
461+ }
462+
463+ variables {
464+ policy_id = " p-12345678"
465+ target_id = " r-1234"
466+ skip_destroy = true
467+ expected_skip_destroy = true
468+ }
469+
470+ assert {
471+ condition = aws_organizations_policy_attachment. this . skip_destroy == var. expected_skip_destroy
472+ error_message = " Skip destroy mismatch after attachment"
473+ }
474+ }
0 commit comments