Skip to content

TaitoUnited/terraform-google-events

Repository files navigation

Google Cloud events

TODO: move implementations from here to the other modules (databases and monitoring)

Provides some custom jobs and notifications for your infrastructure:

  • Cloud SQL long-term backups
  • Cloud Build slack notifications

Example usage:

provider "google" {
  project      = "my-infrastructure"
  region       = "europe-west1"
  zone         = "europe-west1-b"
}

# Enable Google APIs

resource "google_project_service" "compute" {
  service      = "compute.googleapis.com"
}

resource "google_project_service" "cloudfunctions" {
  service      = "cloudfunctions.googleapis.com"
}

resource "google_project_service" "cloudscheduler" {
  service      = "cloudscheduler.googleapis.com"
}

resource "google_project_service" "pubsub" {
  service      = "pubsub.googleapis.com"
}

resource "google_project_service" "sqladmin" {
  service      = "sqladmin.googleapis.com"
}

# Events

module "events" {
  source           = "TaitoUnited/events/google"
  version          = "1.0.0"
  depends_on       = [
    google_project_service.compute,
    google_project_service.cloudfunctions,
    google_project_service.cloudscheduler,
    google_project_service.pubsub,
    google_project_service.sqladmin,
  ]

  cloud_build_notify_enabled = true
  cloud_sql_backups_enabled  = true

  functions_bucket           = "my-functions-bucket"
  functions_region           = "europe-west1"
  cloud_sql_backup_bucket    = "my-sql-backup-bucket"
  cloud_sql_backup_path      = "/backups"
  slack_webhook_url          = "https://hooks.slack.com/services/T00000000/B0000..."
  slack_builds_channel       = "builds"

  postgresql_clusters = yamldecode(file("${path.root}/../infra.yaml"))["postgresqlClusters"]
  mysql_clusters      = yamldecode(file("${path.root}/../infra.yaml"))["mysqlClusters"]
}

Example YAML:

postgresqlClusters:
  - name: my-common-postgres
    storageBackupSchedule: 0 0 * * 0

mysqlClusters:
  - name: my-common-mysql
    storageBackupSchedule: 0 0 * * 0

Combine with the following modules to get a complete infrastructure defined by YAML:

TIP: Similar modules are also available for AWS, Azure, and DigitalOcean. All modules are used by infrastructure templates of Taito CLI. See also Google Cloud project resources, Full Stack Helm Chart, and full-stack-template.

Contributions are welcome!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published