Skip to content

Commit

Permalink
chore(test): add output tests
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz-makandra committed Sep 4, 2024
1 parent 18bea00 commit 2a71afa
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/module_outputs.tftest.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
mock_provider "aws" {}

run "module" {
module {
source = "./examples/simple"
}

assert {
condition = length(module.cis_alarms.alarm_arns) == 14
error_message = "there sould be 14 alarms"
}

assert {
condition = module.cis_alarms.alarm_arns[0] == "wyJROOO"
error_message = "there should be an ARN in the output"
}
}
24 changes: 24 additions & 0 deletions tests/rule_override.tftest.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
mock_provider "aws" {}

run "rule_override" {
variables {
alarm_action_arns = ["arn:aws:sns:us-east-2:123456789012:MyTopic"]
log_group_name = "cloud-trail-logs"

rule_overrides = {
FancyRule = {
pattern ="{$.errorCode = \"Fancy\"}"
description = "My fancy rule"
}
}
}

assert {
condition = local.rules_merged["FancyRule"].description == "My fancy rule"
error_message = "FancyRule should be merged and have description 'My fancy rule'"
}
assert {
condition = local.rules_merged["NoMFAConsoleSignin"].period == 300
error_message = "NoMFAConsoleSignin should have period of 300"
}
}

0 comments on commit 2a71afa

Please sign in to comment.