Skip to content

Commit

Permalink
Remove labels custom_diff functions when converting yaml files (Googl…
Browse files Browse the repository at this point in the history
  • Loading branch information
zli82016 authored Jun 20, 2024
1 parent 4d6a60e commit 90c9bfa
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
1 change: 0 additions & 1 deletion mmv1/products/compute/go_Disk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ custom_code:
custom_diff:
- 'customdiff.ForceNewIfChange("size", IsDiskShrinkage)'
- 'hyperDiskIopsUpdateDiffSupress'
- 'tpgresource.SetLabelsDiff'
examples:
- name: 'disk_basic'
primary_resource_id: 'default'
Expand Down
1 change: 1 addition & 0 deletions mmv1/products/compute/go_Firewall.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ properties:
description: |
An optional description of this resource. Provide this property when
you create the resource.
send_empty_value: true
- name: 'destinationRanges'
type: Array
description: |
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/compute/go_ForwardingRule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ custom_code:
post_create: 'templates/terraform/post_create/go/labels.tmpl'
custom_diff:
- 'forwardingRuleCustomizeDiff'
- 'tpgresource.SetLabelsDiff'
legacy_long_form_project: true
examples:
- name: 'internal_http_lb_with_mig_backend'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/compute/go_RegionDisk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ custom_code:
custom_diff:
- 'customdiff.ForceNewIfChange("size", IsDiskShrinkage)'
- 'hyperDiskIopsUpdateDiffSupress'
- 'tpgresource.SetLabelsDiff'
examples:
- name: 'region_disk_basic'
primary_resource_id: 'regiondisk'
Expand Down
2 changes: 1 addition & 1 deletion mmv1/products/datafusion/go_Instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ properties:
If accelerators are enabled it is possible a permadiff will be created with the Options field.
Users will need to either manually update their state file to include these diffed options, or include the field in a [lifecycle ignore changes block](https://developer.hashicorp.com/terraform/language/meta-arguments/lifecycle#ignore_changes).
item_type:
type: NestedObject
properties:
- name: 'acceleratorType'
type: Enum
Expand All @@ -323,4 +324,3 @@ properties:
enum_values:
- 'ENABLED'
- 'DISABLED'
type: NestedObject
9 changes: 7 additions & 2 deletions mmv1/templates/terraform/yaml_conversion.erb
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,14 @@ custom_code:
test_check_destroy: '<%= object.convert_go_file( object.custom_code.test_check_destroy )%>'
<% end -%>
<% end -%>
<% unless object.custom_diff.empty? || (object.custom_diff.size == 1 && object.custom_diff.include?("tpgresource.SetLabelsDiff")) -%>
<%
custom_diff = object.custom_diff.reject {
|cdiff| cdiff == "tpgresource.SetLabelsDiff" || cdiff == "tpgresource.SetMetadataLabelsDiff" || cdiff == "tpgresource.SetAnnotationsDiff" || cdiff == "tpgresource.SetMetadataAnnotationsDiff"
}
-%>
<% unless custom_diff.empty? -%>
custom_diff:
<% object.custom_diff.each do |cdiff| -%>
<% custom_diff.each do |cdiff| -%>
- '<%= cdiff %>'
<% end -%>
<% end -%>
Expand Down

0 comments on commit 90c9bfa

Please sign in to comment.