Config Connector

repository·master·Indexed 22 days ago

https://github.com/googlecloudplatform/k8s-config-connector

A Kubernetes add-on that enables declarative management of Google Cloud Platform resources using Kubernetes-style configuration and APIs. The project includes a CLI for exporting and previewing resources, a controller builder for generating Go types and mappers, and an AI-assisted development workflow using Gemini to automate resource implementation.

Tokens
1M
Snippets
2.6K
Records
3.9K
Agent score
77%

What's inside k8s-config-connector

  1. Overview of MockGCP

    master

    MockGCP provides stub implementations of Google Cloud Platform (GCP) APIs specifically for testing Config Connector.

    Key Characteristics:

    • No Backend: The mocks do not launch actual resources (e.g., creating a mock VM does not launch a real VM).
    • Goal: To provide consistent CRUD (Create, Read, Update, Delete) operations that are "good enough" to validate Config Connector providers.
    • Implementation Pattern: Most services are implemented using standard GCP protos and grpc-gateway to enable HTTP/gRPC interoperability. This allows injecting HTTP handlers directly into serving paths without needing to listen on a real network port.
  2. Overview of patch-proto

    master
    patch-proto is a utility tool designed to manipulate .proto files. Its primary use case within this repository is to patch missing fields into public googleapis protos as a stopgap measure until the official public protos are updated. The tool leverages the treesitter library for parsing and inspecting proto and Go files, providing a robust foundation for complex file manipulation and inspection.
  3. Manage Google Cloud Armor Network Edge Security Service

    master

    The google_compute_network_edge_security_service resource allows you to manage Google Cloud Armor network edge security services.

    Warning: This resource is in beta. You must use the terraform-provider-google-beta provider to manage it.

    resource "google_compute_network_edge_security_service" "default" {
      provider     = google-beta  
    
      name         = "my-edge-security-service"
      region       = "us-east1"
      description  = "My basic resource"
    }
  4. Manage Google Compute Region Disks with Terraform

    master

    The google_compute_region_disk resource allows you to create and manage regional persistent disks in Google Compute Engine. Regional persistent disks provide data redundancy by replicating data across two zones within a single region, ensuring high availability. They can be used as standard HDD or SSD (pd-ssd) and can be detached from instances to preserve data.

    resource "google_compute_region_disk" "example" {
      name = "my-region-disk"
      type = "pd-ssd"
      region = "us-central1"
      replica_zones = ["us-central1-a", "us-central1-f"]
    }
  5. Manage Google Cloud Deployment Manager deployments with Terraform

    master

    The google_deployment_manager_deployment resource allows you to manage a collection of GCP resources that are deployed and managed together using a configuration file.

    Warning: Deployment Manager and Terraform both manage GCP resource lifecycles and state. Do not attempt to manage the individual resources inside a Deployment Manager deployment using Terraform as well; this will cause ownership conflicts between the two tools. Use this resource only to manage the Deployment itself.

    resource "google_deployment_manager_deployment" "deployment" {
      name = "my-deployment"
    
      target {
        config {
          content = file("path/to/config.yml")
        }
      }
    }
  6. Manage Google Cloud Healthcare HL7v2 Stores with Terraform

    master

    The google_healthcare_hl7_v2_store resource allows you to create and manage an HL7v2 datastore within a Google Cloud Healthcare dataset. This datastore conforms to the HL7 v2 standard for healthcare information exchange.

    Important Note: Changing the name property may recreate the HL7v2 store, which results in the removal of all existing data.

    resource "google_healthcare_hl7_v2_store" "store" {
      name    = "example-hl7-v2-store"
      dataset = google_healthcare_dataset.dataset.id
    
      notification_configs {
        pubsub_topic = google_pubsub_topic.topic.id
      }
    
      labels = {
        label1 = "labelvalue1"
      }
    }
  7. Manage Cloud DNS record sets with google_dns_record_set

    master

    The google_dns_record_set resource manages a set of DNS records within Google Cloud DNS.

    Important Behavior:

    • Authoritative: This resource is treated as an authoritative record set. Creating this resource will overwrite existing records (including default records) for the specified type in the zone.
    • NS Records: The Google Cloud DNS API requires NS records to be present at all times. Terraform will not actually remove NS records during a destroy operation, although it will report that it did.
  8. Manage Google Project Organization Policies with `google_project_organization_policy`

    master

    The google_project_organization_policy resource allows you to manage Organization Policies for a specific Google Cloud Project.

    Warning: This resource is superseded by google_org_policy_policy. The newer resource uses Organization Policy API V2 and supports additional features like tags and conditions. Use google_project_organization_policy only if you specifically require Cloud Resource Manager API V1.

    To manage a policy, you must specify the project ID and the constraint name (e.g., serviceuser.services). You must define exactly one of boolean_policy, list_policy, or restore_policy. If none are defined, the constraint will be effectively unset (marked as 'Inherited' in the Google Cloud Console).

    resource "google_project_organization_policy" "example" {
      project    = "your-project-id"
      constraint = "compute.disableSerialPortAccess"
    
      boolean_policy {
        enforced = true
      }
    }
  9. Manage Persistent Disk Snapshots with google_compute_snapshot

    master

    The google_compute_snapshot resource allows you to create incremental backups of Google Cloud Persistent Disks. Snapshots are more cost-effective than full images because they only store the changes made since the last snapshot. You can create snapshots even while disks are attached to running instances.

    Key Features:

    • Incremental Backups: Reduces storage costs and creation time.
    • Encryption: Supports both Google-managed keys and customer-supplied encryption keys (CSEK).
    • Custom Chains: Advanced users can use chain_name for specialized tracking (e.g., chargeback).
    resource "google_compute_snapshot" "snapshot" {
      name        = "my-snapshot"
      source_disk = google_compute_disk.persistent.id
      zone        = "us-central1-a"
      labels = {
        my_label = "value"
      }
      storage_locations = ["us-central1"]
    }
  10. Manage EdgeCacheKeyset with Terraform

    master

    The google_network_services_edge_cache_keyset resource represents a collection of public keys used for validating signed requests in Google Cloud Network Services. You can use either Ed25519 public keys or shared secret keys (via Secret Manager) to validate requests.

    Key Requirements:

    • You must specify at least public_key or validation_shared_keys (or both).
    • If using public_key, you can specify between 1 and 3 keys. You may specify at most one Google-managed key (managed = true).
    • If using validation_shared_keys, the secrets must be at least 16 bytes large (20 bytes recommended for HMAC-SHA1, 32 bytes for HMAC-SHA256).
    resource "google_network_services_edge_cache_keyset" "default" {
      name                 = "my-keyset"
      description          = "The default keyset"
      public_key {
        id = "my-public-key"
        value = "FHsTyFHNmvNpw4o7-rp-M1yqMyBF8vXSBRkZtkQ0RKY"
      }
      public_key {
        id = "my-public-key-2"
        value = "hzd03llxB1u5FOLKFkZ6_wCJqC7jtN0bg7xlBqS6WVM"
      }
    }
  11. Manage billing account level logging bucket configs

    master

    The google_logging_billing_account_bucket_config resource manages the configuration of logging buckets at the billing account level.

    Important Behavior Notes:

    • Automatic Creation: Logging buckets (specifically _Default and _Required) are automatically created for a given billing account and cannot be deleted.
    • Resource Acquisition: Creating this resource will acquire and update the existing resource at the specified location rather than creating a new one.
    • Deletion Behavior: Deleting this Terraform resource will remove the configuration from your Terraform state, but the actual logging bucket in Google Cloud will remain unchanged and will not be deleted.
    resource "google_logging_billing_account_bucket_config" "basic" {
    	billing_account    = data.google_billing_account.default.billing_account
    	location  = "global"
    	retention_days = 30
    	bucket_id = "_Default"
    }