Skip to content

Instantly share code, notes, and snippets.

@anderseknert
Last active May 25, 2024 08:47
Show Gist options
  • Save anderseknert/623ccd082f2c4ed69fa552ea23a10222 to your computer and use it in GitHub Desktop.
Save anderseknert/623ccd082f2c4ed69fa552ea23a10222 to your computer and use it in GitHub Desktop.
Terrascan DB settings policy
package accurics
import rego.v1
violations contains db_instance.id if {
some db_instance in input.google_sql_database_instance
some setting in db_instance.config.settings
invalid_db_instance_setting(setting)
}
invalid_db_instance_setting(setting) if not setting.ip_configuration
invalid_db_instance_setting(setting) if invalid_ip_configuration(setting.ip_configuration[_])
invalid_ip_configuration(ip_configuration) if not ip_configuration.require_ssl
invalid_ip_configuration(ip_configuration) if ip_configuration.authorized_networks[_].value == "0.0.0.0"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment