-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: list(map) terraform output test doesn't work with regular expression #525
Comments
Hi @aaron-lane, after looking into the test results, I think there might be another bug/limitation with kitchen terraform output test. Does it support list and/or list(map/object) as the output results? with the example above, the actual terraform output is:
However, in the test results, the 2nd "expected" line below only shows the very first map object in the list which should be the full list of all 3 map objects. Could you please advise if it's the case and if I need to open another bug or feature request ticket? Thanks.
|
Hi @luckeyca 👋🏼 Thank you for the bug report! I would expect for the "NOT working example" that your test case would look like this instead: describe 'terraform output dmz_all_subnet_flowlogs' do
subject do
attribute('output_dmz_all_subnet_flowlogs')
end
it {
is_expected.to include(including(
'display_name' => match(/dmz-(app|firewall|proxy)-subnet-flowlog/)
'flowlog_id' => match(/^id+*$/)
'retention_duration' => 90
))
}
end Note that the outer
I will look at adding some additional test coverage to verify if |
Hi @aaron-lane, I did try the way you suggested. It's not working which was why I asked if the kitchen terraform output supports list(object), map and/or list type terraform output because even with your latest example, there is still no looping. The workaround, in the meantime, I come up with(still testing, tenant has some other unrelated issues now), are to use native rspec syntax which can do loop easily:
|
Hi @aaron-lane, just to let you know I believe map is supported because I have been using it without any issue, just need to confirm if list and list(object) type terraform outputs are supported by kitchen terraform output test. Thanks
|
I've updated the output tests on this branch: https://github.com/newcontext-oss/kitchen-terraform/compare/aaron-lane/output-tests It appears that support for outputs that are lists of objects (maps) is intact 🕵🏼 |
Hi @aaron-lane Thanks. the changes look good. Which release were they put in as I couldn't find any related changes mentioned in release notes? |
Sorry, to clarify, that branch only contains test updates which verify that Kitchen-Terraform does correctly parse list-of-objects Terraform outputs. I will add a specific check around the regular expression logic. |
When the terraform output is list(map), the regular expressions in the tests don't work. When the terraform output is a simple map, regular expression works.
working example:
terraform output
test case:
NOT working example:
terraform output:
Test Case Format 1:
Test Case format 2:
The text was updated successfully, but these errors were encountered: