google_monitoring_alert_policy, google_monitoring_dashboard, google_logging_metric when using for each cycle always requests changes for TF apply/plan #10118
I am working on creating of universal approach for creating multiply monitoring resources (alarms, log-based metrics, dashboards) for different GCP resources (GKE, LB, etc). Currently facing that GCP terrraform resources:google_monitoring_alert_policy, google_monitoring_dashboard, google_logging_metric always requests changes for TF apply/plan when using for each cycle.
Please find the code and extra info below:
Terrafrom version = 1.0.7, 0.13 (Tested on both, with same result)
GCP provider version = 3.74.0, 3.71.0 (Tested on both, with same result)
State file location = gcs, local (Tested on both, with same result)
Terraform module for alarms (alerts conditions creating via MQL):
After creating of resources described above I am again run TF apply/plan and see output for changes requested in resources (changing alarm condition trigger, notification channels, dashboard position, and other) Output:
The expected result after implementation of sets of alarms for multiply cluster that there shouldn't be any changes.
But i get result:
0 to add, 15 to change, 0 to destroy.
1) Is this GCP terraform issue (because for other terraform providers e.g AWS no such issue);
2) Is there any way to implement such an approach in a different way ?
Hello, community.
I am working on creating of universal approach for creating multiply monitoring resources (alarms, log-based metrics, dashboards) for different GCP resources (GKE, LB, etc). Currently facing that GCP terrraform resources:
google_monitoring_alert_policy, google_monitoring_dashboard, google_logging_metric always
requests changes for TF apply/plan when using for each cycle.Please find the code and extra info below:
Terrafrom version = 1.0.7, 0.13 (Tested on both, with same result) GCP provider version = 3.74.0, 3.71.0 (Tested on both, with same result) State file location = gcs, local (Tested on both, with same result)
Terraform module for alarms (alerts conditions creating via MQL):
variables.tf
.tfvars example:
That code should implement a similar alarms set (e.g CPU, RAM, Volume, Traffic, Errors, etc.) for multiple clusters.
The same approach used for dashboards and log base metrics, modules:
Module for log-based metrics:
Module for dashboards:
After creating of resources described above I am again run TF apply/plan and see output for changes requested in resources (changing alarm condition trigger, notification channels, dashboard position, and other) Output:
The expected result after implementation of sets of alarms for multiply cluster that there shouldn't be any changes.
But i get result:
0 to add, 15 to change, 0 to destroy.
For alerts:
For dashboard:
Please elaborate:
1) Is this GCP terraform issue (because for other terraform providers e.g AWS no such issue); 2) Is there any way to implement such an approach in a different way ?
Thank you.
b/275102303
Affected Resource(s)