Skip to content
Open
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
10 changes: 8 additions & 2 deletions mmv1/products/storage/AnywhereCache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ async:
resource_inside_response: true
autogen_async: false
custom_code:
constants: templates/terraform/constants/storage_anywhere_cache.go.tmpl
custom_create: templates/terraform/custom_create/storage_anywhere_cache.go.tmpl
custom_update: templates/terraform/custom_update/storage_anywhere_cache.go.tmpl
samples:
Expand Down Expand Up @@ -71,11 +72,16 @@ properties:
description: The zone in which the cache instance needs to be created. For example, `us-central1-a.`
- name: admissionPolicy
type: Enum
default_value: admit-on-first-miss
deprecation_message: '`admit-on-second-miss` is deprecated and will be removed in a future major release. The backend will ignore this attribute and treat it as `admit-on-first-miss`.'
description: |
The cache admission policy dictates whether a block should be inserted upon a cache miss.
Note: "admit-on-second-miss" is deprecated and will fallback to "admit-on-first-miss".
enum_values:
- admit-on-first-miss
- admit-on-second-miss
default_value: admit-on-first-miss
description: The cache admission policy dictates whether a block should be inserted upon a cache miss.
diff_suppress_func: StorageAnywhereCacheAdmissionPolicyDiffSuppress
custom_expand: templates/terraform/custom_expand/storage_anywhere_cache_admission_policy.go.tmpl
- name: ttl
type: String
default_value: 86400s
Expand Down
21 changes: 21 additions & 0 deletions mmv1/templates/terraform/constants/storage_anywhere_cache.go.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{/*
The license inside this block applies to this file
Copyright 2026 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/ -}}
// Suppresses diffs for Anywhere Cache admission policy where "admit-on-second-miss"
// is deprecated and falls back to "admit-on-first-miss".
func StorageAnywhereCacheAdmissionPolicyDiffSuppress(_, old, new string, _ *schema.ResourceData) bool {
if old == new {
return true
}
return (old == "admit-on-first-miss" && new == "admit-on-second-miss") ||
(old == "admit-on-second-miss" && new == "admit-on-first-miss")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{/*
The license inside this block applies to this file
Copyright 2026 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/ -}}
func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
if v == nil {
return nil, nil
}
s := v.(string)
if s == "admit-on-second-miss" {
return "admit-on-first-miss", nil
}
return s, nil
}