Skip to content

Instantly share code, notes, and snippets.

@dragonde
Last active September 1, 2022 14:11
Show Gist options
  • Save dragonde/fa1ea11be40a048a58cf17cc2dfcf31b to your computer and use it in GitHub Desktop.
Save dragonde/fa1ea11be40a048a58cf17cc2dfcf31b to your computer and use it in GitHub Desktop.
terraform resource config from GCP

resource config for terraform

gcloud beta resource-config bulk-export --project unique-voice-156214 --resource-types SQLInstance --resource-format terraform

resource "google_sql_database_instance" "daisho_yexir_dup" {
  database_version = "MYSQL_5_7"
  name             = "daisho-yexir-dup"
  project          = "unique-voice-156214"
  region           = "europe-west1"
  settings {
    activation_policy = "ALWAYS"
    availability_type = "ZONAL"
    backup_configuration {
      backup_retention_settings {
        retained_backups = 7
        retention_unit   = "COUNT"
      }
      start_time                     = "18:00"
      transaction_log_retention_days = 7
    }
    database_flags {
      name  = "log_output"
      value = "FILE"
    }
    database_flags {
      name  = "long_query_time"
      value = "10"
    }
    database_flags {
      name  = "slow_query_log"
      value = "on"
    }
    database_flags {
      name  = "wait_timeout"
      value = "40000"
    }
    database_flags {
      name  = "interactive_timeout"
      value = "40000"
    }
    database_flags {
      name  = "max_allowed_packet"
      value = "63554432"
    }
    database_flags {
      name  = "tmp_table_size"
      value = "67108864"
    }
    database_flags {
      name  = "max_heap_table_size"
      value = "67108864"
    }
    disk_autoresize       = false
    disk_autoresize_limit = 0
    disk_size             = 10
    disk_type             = "PD_SSD"
    ip_configuration {
      ipv4_enabled = true
    }
    location_preference {
      zone = "europe-west1-d"
    }
    maintenance_window {
      day  = 7
      hour = 2
    }
    pricing_plan = "PER_USE"
    tier         = "db-f1-micro"
    user_labels = {
      vanta-contains-user-data = "false"
      vanta-description        = "main-database"
      vanta-non-prod           = "true"
      vanta-owner              = "alberto_dot_banon"
    }
  }
}

gcloud beta resource-config bulk-export --project $PROJECT_ID --resource-types ContainerCluster,ContainerNodePool --resource-format terraform

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment