{% set config = merged_configs.get('google_storage_bucket', {}) %}
# Compliance: {{ compliance_comments.get('google_storage_bucket', []) | join(', ') }}
resource "google_storage_bucket" "main" {
  name                        = "{{ config.get('name', '${var.project_id}-main') }}"
  project                     = var.project_id
  location                    = "{{ config.get('location', 'US') }}"
  storage_class               = "{{ config.get('storage_class', 'STANDARD') }}"
  uniform_bucket_level_access = {{ config.get('uniform_bucket_level_access', true) | lower }}
  public_access_prevention    = "{{ config.get('public_access_prevention', 'enforced') }}"
  force_destroy               = {{ config.get('force_destroy', false) | lower }}

  versioning {
    enabled = {{ config.get('versioning_enabled', true) | lower }}
  }
{% if config.get('encryption_key') %}

  encryption {
    default_kms_key_name = {{ config.get('encryption_key') }}
  }
{% endif %}
}
