Sample Terraform script that can be used to enable the required APIs at each project level for Google Cloud monitoring

Sample Terraform script that can be used to enable the required APIs at each project level for Google Cloud monitoring

Use this sample Terraform script to enable the required APIs for each project. This Terraform script helps you enable all the required APIs for multiple projects in a single deployment.
  1. Main.tf
  2. provider "google" {
  3. project = "base project id"
  4. } module "project-services" {
  5. source = "terraform-google-modules/project-factory/google//modules/project_services"
  6. for_each=var.project_id_map
  7. project_id = "${each.value.project_id}"
  8. activate_apis = [
  9. "compute.googleapis.com",
  10. "cloudfunctions.googleapis.com",
  11. "dataproc.googleapis.com",
  12. "redis.googleapis.com",
  13. "container.googleapis.com",
  14. "spanner.googleapis.com",
  15. "appengine.googleapis.com",
  16. "pubsub.googleapis.com",
  17. "composer.googleapis.com",
  18. "monitoring.googleapis.com",
  19. "compute.googleapis.com",
  20. "dataflow.googleapis.com",
  21. "run.googleapis.com",
  22. "file.googleapis.com",
  23. "cloudkms.googleapis.com",
  24. "dns.googleapis.com",
  25. "cloudbilling.googleapis.com",
  26. "cloudresourcemanager.googleapis.com",
  27. "cloudasset.googleapis.com",
  28. "servicenetworking.googleapis.com",
  29. "appengine.googleapis.com",
  30. "container.googleapis.com",
  31. "sqladmin.googleapis.com",
  32. "cloudkms.googleapis.com"
  33. ]
  34. }

  35. variables.tf
  36. variable "project_id_map" {
  37. type = map(object({
  38. project_id = string
  39. }))
  40. default = {
  41. "Projectid_1" = {
  42. project_id = "project_1_id"
  43. }
  44. "Projectid_2" = {
  45. project_id = "project_2_id"
  46. }
  47. }
  48. }

    • Related Articles

    • Exclude Site24x7 monitoring traffic from Google Analytics

      You can exclude traffic from the Site24x7 Web Transaction (Browser) monitor and Webpage Speed (Browser) traffic from Google Analytics in two ways. To exclude traffic for the Web Defacement monitor, you can follow the first method. 1. Creating a ...
    • Troubleshooting false positive alerts in monitoring

      Problem False positive alerts are being generated. Possible cause The monitoring system is down in some locations. The Website monitor might be configured for one location, such as Seattle, but may appear down when accessed from another location, ...
    • Difference between website monitoring and REST API monitoring

      Website monitoring allows you to monitor your websites and web applications to ensure that they are up and running. Website monitor verifies the availability of specified, addressable, standard HTTP and HTTPS URLs from over 100+ global locations and ...
    • Exclude the selective SSH algorithms in On-Premise Poller during SFTP Transfer monitoring

      By excluding SSH algorithms, you can restrict Site24x7 SSH Client from using the excluded algorithm while connecting to the SSH server during SFTP Transfer monitoring. Follow the steps mentioned below for SSH algorithm exclusion in On-Premise Poller ...
    • Compare our various methodologies for Website Monitoring

      Get to know Site24x7 monitors better and choose the one that best fits your monitoring needs. Compare the functionality of the following monitors: Website Monitoring Webpage Speed (Browser) Web Transaction Monitoring Web Transaction (Browser) SSL/TLS ...