Can we Enable notifications preferences on CloudSQL by terraform? - google-cloud-platform

enter image description here
i can see there is only option to enable from google cloud console.
is it possible to set the notifications by terraform modules for cloud sql in GCP?
if possible could you please share me the module i will add into my scripts..
tried some testing by adding alerting module into the sql but it's not working.

Related

IAM Permission Denied - Google Cloud Create metric

Currently I am trying to create a custom metric to be tracked in the Google Cloud Monitoring dashboard.
Although the admin of the system has given me Monitoring Editor, Monitoring Writer, and Monitoring Admin roles, this error is still occurring.
permission based error
Which permission settings do I need to create a custom / log based metric?
I have tried creating a metric on the Google Cloud Monitoring dashboard with the following roles: Monitoring Editor, Monitoring Writer, and Monitoring Admin. Even with these roles in my IAM permission settings, the red alert error still shows up when creating a metric.
It's confusing.
Although Log-based metrics produce Cloud Monitoring metrics, they are functionality of the Cloud Logging API (and so they require Logging-specific roles/permissions).
Here's the list of permissions: https://cloud.google.com/iam/docs/permissions-reference
Search it (!) for logging.logMetrics.create and you'll get:
Owner (roles/owner)
Editor (roles/editor)
App Engine flexible environment Service Agent (roles/appengineflex.serviceAgent)
Cloud Composer API Service Agent (roles/composer.serviceAgent)
Cloud Dataflow Service Agent (roles/dataflow.serviceAgent)
Logging Admin (roles/logging.admin)
Logs Configuration Writer (roles/logging.configWriter)
Serverless VPC Access Service Agent (roles/vpcaccess.serviceAgent)
Get roles/logging.admin or roles/logging.confgWriter bound to your identity and try again.

Can I see the log of ElasticCloud in Stackdriver Logging?

My service is currently deployed on GCP, and all the monitoring & alerts are aggregated to Google Cloud Logging.
Recently I'm planning to introduce full text search feature to my service, and ElasticCloud is an option to achieve it because it supports deployment on GCP.
However, as far as I know, the documentation says that it supports import logs from Google Cloud Logging, but there is no description how to export the logs to Google Cloud Logging.
Is there a good way to export logs from ElasticCloud to Google Cloud Logging?

How do you deploy Cloud Identity or Organisation Policies in GCP via Terraform?

New to GCP and use IAC for our Terraform. I've managed to build most of the initial organisation config in Terraform no problem with the exception of Cloud Identity and Organisation Policies. I'm using gcloud provided login credentials. Whenever I try to build for those two services I get this:
Error creating Group: googleapi: Error 403: Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the cloudidentity.googleapis.com. We recommend configuring the billing/quota_project setting in gcloud or using a service account through the auth/impersonate_service_account setting. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/. If you are getting this error with curl or similar tools, you may need to specify 'X-Goog-User-Project' HTTP header for quota and billing purposes. For more information regarding 'X-Goog-User-Project' header, please check https://cloud.google.com/apis/docs/system-parameters.
So in this case i'm using the Google Cloud SDK, so the error makes sense. However, the two options it presents don't work:
Setting a quota project makes no difference
I can't create a service account at the organisational level (and when I create one within a project it can't configure these organisational level constructs)
So how do I go about Terraforming these services?
Thanks.

Monitor Cloud Composer Airflow UI

How to alert if cloud composer airflow UI is throwing server error?
Note: Airflow UI is hosted in Google tenant. I tried with uptime check but how to configure authentication for it. We are having multi factor authentication enabled in our accounts.
Can we use log based metrics? Please share steps for both ways.
Yes, log based metric can be used to track the health of the web server.
Actually, Cloud Composer creates one automatically for each Composer environment. Its name is logging.googleapis.com/user/$ENVIRONMENT_NAME-$ENVIRONMENT_LOCATION-web-health. Naturally, you can setup an alert for it. Its expected value is >= 0.1 entries/s.

Monitoring Performance metrics more than one GCP environment

My requirement is to monitor performance metrics of GCP Environments. We have to monitor more than one GCP environment (Service Account). Now Problem is how can I set the all service Accounts JSON files in Environment variable "GOOGLE_APPLICATION_CREDENTIALS".
creating MetricServiceClient like below after setting JSON file in an environment variable
MetricServiceClient client = MetricServiceClient.create()
Is there another way to create MetricServiceClient using credentials.
I suggest you use the StackDriver Workspace and add all the GCP Project you want to monitor to that workspace. Here is the detailed guide https://cloud.google.com/monitoring/workspaces/guide.
By using a single Workspace for all GCP Project, you will have all the Metrics/Logging data in a single place and then you can use one set of credentials to access all GCP Project Monitoring data.
If the Single workspace is not a feasible option, then you can create a single GCP Service account and add StackDriver related permission from all the projects. Then you can use this service account to interact with Stackdriver metrics.
Note: Always try to use the principle of least privilege
Hope this helps.