{% set config = merged_configs.get('google_composer_environment', {}) %}
# Compliance: {{ compliance_comments.get('google_composer_environment', []) | join(', ') }}
resource "google_composer_environment" "main" {
  name    = "{{ config.get('name', '${var.project_id}-composer') }}"
  project = var.project_id
  region  = var.region

  config {
    software_config {
      image_version = "{{ config.get('image_version', 'composer-2-airflow-2') }}"
    }

    node_config {
      service_account = "{{ config.get('service_account', '') }}"
    }

    environment_size = "{{ config.get('environment_size', 'ENVIRONMENT_SIZE_SMALL') }}"

    private_environment_config {
      enable_private_endpoint = {{ config.get('enable_private_endpoint', true) | lower }}
    }
{% if config.get('kms_key_name') %}

    encryption_config {
      kms_key_name = {{ config.get('kms_key_name') }}
    }
{% endif %}
  }
}
