Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mmv1/products/backupdr/product.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ versions:
- name: 'ga'
base_url: 'https://backupdr.googleapis.com/v1/'
- name: 'beta'
base_url: 'https://backupdr.googleapis.com/v1/'
base_url: 'https://backupdr.googleapis.com/v1beta/'
scopes:
- 'https://www.googleapis.com/auth/cloud-platform'
async:
Expand Down
2 changes: 0 additions & 2 deletions mmv1/products/networkservices/AuthzExtension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ examples:
test_env_vars:
project: 'PROJECT_NAME'
- name: 'network_services_authz_extension_iap'
skip_docs: true # temporary b/484137930
skip_test: true # temporary b/484137930
primary_resource_id: 'default'
vars:
resource_name: 'my-authz-ext'
Expand Down
11 changes: 11 additions & 0 deletions mmv1/templates/terraform/constants/cloud_run_service.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ func revisionNameCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, v i

var cloudRunGoogleProvidedTemplateAnnotations = regexp.MustCompile(`template\.0\.metadata\.0\.annotations\.run\.googleapis\.com/sandbox`)
var cloudRunGoogleProvidedTemplateAnnotations_autoscaling_maxscale = regexp.MustCompile(`template\.0\.metadata\.0\.annotations\.autoscaling\.knative\.dev/maxScale`)
var cloudRunGoogleProvidedTemplateAnnotations_gpu_zonal_redundancy_disabled = regexp.MustCompile(`template\.0\.metadata\.0\.annotations\.run\.googleapis\.com/gpu-zonal-redundancy-disabled`)

func cloudrunTemplateAnnotationDiffSuppress(k, old, new string, d *schema.ResourceData) bool {
// Suppress diffs for the annotations provided by API
Expand All @@ -21,6 +22,16 @@ func cloudrunTemplateAnnotationDiffSuppress(k, old, new string, d *schema.Resour
return true
}

if cloudRunGoogleProvidedTemplateAnnotations_gpu_zonal_redundancy_disabled.MatchString(k) && new == "" {
if limitsRaw, ok := d.GetOk("template.0.spec.0.containers.0.resources.0.limits"); ok {
if limits, ok := limitsRaw.(map[string]interface{}); ok {
if _, hasGpu := limits["nvidia.com/gpu"]; hasGpu {
return true
}
}
}
}

// For other keys, don't suppress diff.
return false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ resource "google_network_services_authz_extension" "{{$.PrimaryResourceId}}" {

service = "iap.googleapis.com"
timeout = "0.1s"
metadata = {
"iapPolicyVersion" = "V1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ resource "google_cloud_run_service" "{{$.PrimaryResourceId}}" {
name = "{{index $.ResourceIdVars "cloud_run_service_name"}}"
location = "us-central1"

metadata {
annotations = {
"run.googleapis.com/launch-stage" = "BETA"
}
}

template {
metadata {
annotations = {
"autoscaling.knative.dev/maxScale": "1"
"run.googleapis.com/cpu-throttling": "false"
# Explicitly disable zonal redundancy to bypass quota limits in the HashiCorp test project.
# Alternatively, if quota is granted to the test project, this annotation can be removed
# to properly test the DiffSuppressFunc.
"run.googleapis.com/gpu-zonal-redundancy-disabled": "true"
}
}
spec {
Expand Down
Loading
Loading