// Suppress unremovable default scope values from GCP.
// If the default service account would not otherwise have it, the `monitoring.write` scope
// is added to a GKE cluster's scopes regardless of what the user provided.
// monitoring.write is inherited from monitoring (rw) and cloud-platform, so it won't always
// be present.
// Enabling Stackdriver features through logging_service and monitoring_service may enable
// monitoring or logging.write. We've chosen not to suppress in those cases because they're
// removable by disabling those features.
Suppress unremovable default scope values from GCP.
If the default service account would not otherwise have it, the `monitoring.write` scope
is added to a GKE cluster's scopes regardless of what the user provided.
monitoring.write is inherited from monitoring (rw) and cloud-platform, so it won't always
be present.
Enabling Stackdriver features through logging_service and monitoring_service may enable
monitoring or logging.write. We've chosen not to suppress in those cases because they're
removable by disabling those features.
// Suppress unremovable default scope values from GCP . // If the default service account would not otherwise have it the ` monitoring . write ` scope // is added to a GKE cluster ' s scopes regardless of what the user provided . // monitoring . write is inherited from monitoring ( rw ) and cloud - platform so it won ' t always // be present . // Enabling Stackdriver features through logging_service and monitoring_service may enable // monitoring or logging . write . We ' ve chosen not to suppress in those cases because they ' re // removable by disabling those features .
func containerClusterAddedScopesSuppress(k, old, new string, d *schema.ResourceData) bool {
	o, n := d.GetChange("cluster_autoscaling.0.auto_provisioning_defaults.0.oauth_scopes")
	if o == nil || n == nil {
		return false
	}
	addedScopes := []string{
		"https://www.googleapis.com/auth/monitoring.write",
	}
	m := golangSetFromStringSlice(append(addedScopes, convertStringArr(n.([]interface{}))...))
	combined := stringSliceFromGolangSet(m)
	if len(combined) != len(convertStringArr(o.([]interface{}))) {
		return false
	}
	for _, i := range combined {
		if stringInSlice(convertStringArr(o.([]interface{})), i) {
			continue
		}
		return false
	}
	return true
}
func containerClusterAddedScopesSuppress ( k , old , new string , d * schema . ResourceData ) bool { o , n := d . GetChange ( " " ) if o == nil || n == nil { return false } addedScopes := [ ] string { " " , } m := golangSetFromStringSlice ( append ( addedScopes , convertStringArr ( n . ( [ ] interface { } ) ) ... ) ) combined := stringSliceFromGolangSet ( m ) if len ( combined ) != len ( convertStringArr ( o . ( [ ] interface { } ) ) ) { return false } for _ , i := range combined { if stringInSlice ( convertStringArr ( o . ( [ ] interface { } ) ) , i ) { continue } return false } return true }
Suppress unremovable default scope values from GCP.
Suppress unremovable default scope values from GCP .
// combine what the default scopes are with what was passed // compare if the combined new scopes and default scopes differ from the old scopes