inspec/test/integration/default/verify/controls/aws_iam_user.rb
Clinton Wolfe 5ab68ecf03
aws_s3_bucket with modified interface (#183)
Signed-off-by: Matthew Dromazos <dromazmj@dukes.jmu.edu>
    Signed-off-by: Aaron Lippold <lippold@gmail.com>
    Signed-off-by: Sam Cornwell <14048146+samcornwell@users.noreply.github.com>
    Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2018-01-19 11:50:08 -05:00

46 lines
1.3 KiB
Ruby

fixtures = {}
[
'iam_user_recall_hit',
'iam_user_recall_miss',
'iam_user_no_mfa_enabled',
'iam_user_has_console_password',
'iam_user_with_access_key',
].each do |fixture_name|
fixtures[fixture_name] = attribute(
fixture_name,
default: "default.#{fixture_name}",
description: 'See ../build/iam.tf',
)
end
#------------------- Recall / Miss -------------------#
describe aws_iam_user(username: fixtures['iam_user_recall_hit']) do
it { should exist }
end
describe aws_iam_user(username: fixtures['iam_user_recall_miss']) do
it { should_not exist }
end
#------------- Property - has_mfa_enabled -------------#
# TODO: fixture and test for has_mfa_enabled
describe aws_iam_user(username: fixtures['iam_user_no_mfa_enabled']) do
it { should_not have_mfa_enabled }
it { should_not have_console_password } # TODO: this is working by accident, we should have a dedicated fixture
end
#---------- Property - has_console_password -----------#
describe aws_iam_user(username: fixtures['iam_user_has_console_password']) do
it { should have_console_password }
end
#------------- Property - access_keys -------------#
aws_iam_user(username: fixtures['iam_user_with_access_key']).access_keys.each { |access_key|
describe access_key do
its('status') { should eq 'Active' }
end
}