question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow checks to run globally across all resources

See original GitHub issue

Is your feature request related to a problem? Please describe. I would like to define global checks, e.g. a Naming Convention check, that can apply globally to all resources, without me having to write out all the supported resources

Describe the solution you’d like I would like to write something like:

from checkov.terraform.checks.resource.base_check import BaseResourceCheck

class NamingCheck(BaseResourceCheck):
    def __init__(self):
        name = "Ensure naming convention is correct"
        id = "MY_GLOBAL_001"
        supported_resources = ['*']
        # ...

The registry’s get_checks could also look at the * resource, de-duplicating as necessary (maybe it could be a set?)

Describe alternatives you’ve considered Get a list of all terraform resources and put that in the list

Additional context It could also be neat to do, for example, supported_resources = ["aws_*"], or more advanced matching, but that is not necessary for my purposes right now.

“Resource names must start with a letter or underscore, and may contain only letters, digits, underscores, and dashes” (source) so anything else should be fair game for matching

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
m-wynncommented, Jan 7, 2020

I’ll try to think of a few. Some that we might look at are:

  • Avoid hard-coding resource names and ARNs
  • Add tags on resources
  • jsonencode HCL objects intead of writing heredocs with embedded json
  • check strings for common misspellings
0reactions
stale[bot]commented, Apr 6, 2021

Closing issue due to inactivity. If you feel this is in error, please re-open, or reach out to the community via slack: https://slack.bridgecrew.io Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

List and filter your resources - Amazon Elastic Compute Cloud
List and filter resources using the console; List and filter using the CLI and API; List and filter resources across Regions using Amazon...
Read more >
Elevate access to manage all Azure subscriptions and ...
Use the following basic steps to elevate access for a Global Administrator using the Azure CLI. Use the az rest command to call...
Read more >
Global Entry | U.S. Customs and Border Protection
Global Entry is a U.S. Customs and Border Protection (CBP) program that allows expedited clearance for pre-approved, low-risk travelers upon ...
Read more >
Global, regional, and zonal resources - Google Cloud
For example, global resources are accessible by resources in any region or zone, so virtual machine (VM) instances from different zones can use...
Read more >
Extending with Shared Libraries - Jenkins
All global variables defined in a Shared Library should be stateless, i.e. they should act as collections of functions. If your pipeline tried...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found