You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Write up some terraform with an iam policy resource and a data resource for the policy as described above.
run cnspec scan terraform against it
Expected behavior
most likely, it should have an additional exception for when the value is a simple string - because in addition to data sources it's not uncommon to use file() or templatefile() functions here.
There should probably be another check here that looks for: terraform.datasources.where(nameLabel == "aws_iam_policy_document") and runs similar checks. Perhaps file() could do something similar, but templatefile probably isn't something you can work with outside of a plan.
Desktop (please complete the following information):
! Error: Ensure IAM policy do not use wildcards and instead apply the principle of least privilege
Message: 1 error occurred:
* 1 error occurred:
* cannot find function '[]' for type 'stringslice'
The text was updated successfully, but these errors were encountered:
Describe the bug
cnspec's policy fails to account for using a data source for policy like this:
To Reproduce
Steps to reproduce the behavior:
run cnspec scan terraform
against itExpected behavior
most likely, it should have an additional exception for when the value is a simple string - because in addition to data sources it's not uncommon to use
file()
ortemplatefile()
functions here.There should probably be another check here that looks for:
terraform.datasources.where(nameLabel == "aws_iam_policy_document")
and runs similar checks. Perhapsfile()
could do something similar, but templatefile probably isn't something you can work with outside of a plan.Desktop (please complete the following information):
Additional context
The check defined here has this query:
This assumes that the policy will be inline - but if you're using a datasource it'll look like this instead:
This results in an error like this:
The text was updated successfully, but these errors were encountered: