BOM - GCP Redis
- Query id: bc75ce52-a60a-4660-b533-bce837a5019b
- Query name: BOM - GCP Redis
- Platform: Terraform
- Severity: Trace
- Category: Bill Of Materials
- URL: Github
Description¶
A list of Redis Instance resources found. Memorystore for Redis is a fully managed Redis service for Google Cloud. Applications running on Google Cloud can achieve extreme performance by leveraging the highly scalable, available, secure Redis service without the burden of managing complex Redis deployments.
Documentation
Code samples¶
Code samples with security vulnerabilities¶
Postitive test num. 1 - tf file
resource "google_redis_instance" "cache" {
name = "memory-cache"
memory_size_gb = 1
}
resource "google_compute_global_address" "service_range" {
name = "address"
purpose = "VPC_PEERING"
address_type = "INTERNAL"
prefix_length = 16
network = data.google_compute_network.redis-network.id
}
resource "google_service_networking_connection" "private_service_connection" {
network = data.google_compute_network.redis-network.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.service_range.name]
}
resource "google_redis_instance" "cache2" {
name = "private-cache"
tier = "STANDARD_HA"
memory_size_gb = 1
location_id = "us-central1-a"
alternative_location_id = "us-central1-f"
authorized_network = data.google_compute_network.redis-network.id
connect_mode = "PRIVATE_SERVICE_ACCESS"
redis_version = "REDIS_4_0"
display_name = "Terraform Test Instance"
depends_on = [google_service_networking_connection.private_service_connection]
}
resource "google_compute_firewall" "positive1" {
name = "test-firewall"
network = google_compute_network.redis-network.name
direction = "INGRESS"
source_ranges = ["0.0.0.0/0"]
allow {
protocol = "icmp"
}
allow {
protocol = "tcp"
ports = ["22", "80", "3389", "8080", "1000-2000"]
}
source_tags = ["web"]
}
Code samples without security vulnerabilities¶
Negative test num. 1 - tf file
# negative sample
resource "google_bigquery_dataset" "negative1" {
dataset_id = "example_dataset"
friendly_name = "test"
description = "This is a test description"
location = "EU"
default_table_expiration_ms = 3600000
labels = {
env = "default"
}
access {
role = "OWNER"
user_by_email = google_service_account.bqowner.email
}
access {
role = "READER"
domain = "hashicorp.com"
}
}