-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support unordered lists in Terraform. (#351)
Merged PR #351.
- Loading branch information
1 parent
06937fd
commit 882606c
Showing
6 changed files
with
61 additions
and
2 deletions.
There are no files selected for viewing
Submodule terraform
updated
from 97e421 to aa20a0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
CustomizeDiff: customdiff.All( | ||
customdiff.ForceNewIfChange("ip_cidr_range", isShrinkageIpCidr), | ||
customdiff.ForceNewIfChange("ip_cidr_range", isShrinkageIpCidr), | ||
resourceComputeSubnetworkSecondaryIpRangeSetStyleDiff, | ||
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
keys := diff.GetChangedKeysPrefix(<%= go_literal(Google::StringUtils.underscore(prop.name)) -%>) | ||
if len(keys) == 0 { | ||
return nil | ||
} | ||
oldCount, newCount := diff.GetChange("<%= Google::StringUtils.underscore(prop.name) -%>.#") | ||
var count int | ||
// There could be duplicates - worth continuing even if the counts are unequal. | ||
if oldCount.(int) < newCount.(int) { | ||
count = newCount.(int) | ||
} else { | ||
count = oldCount.(int) | ||
} | ||
|
||
if count < 1 { | ||
return nil | ||
} | ||
old := make([]interface{}, count) | ||
new := make([]interface{}, count) | ||
for i := 0; i < count; i++ { | ||
o, n := diff.GetChange(fmt.Sprintf("<%= Google::StringUtils.underscore(prop.name) -%>.%d", i)) | ||
|
||
if o != nil { | ||
old = append(old, o) | ||
} | ||
if n != nil { | ||
new = append(new, n) | ||
} | ||
} | ||
|
||
oldSet := schema.NewSet(schema.HashResource(resource<%= resource_name -%>().Schema[<%= go_literal(Google::StringUtils.underscore(prop.name)) -%>].Elem.(*schema.Resource)), old) | ||
newSet := schema.NewSet(schema.HashResource(resource<%= resource_name -%>().Schema[<%= go_literal(Google::StringUtils.underscore(prop.name)) -%>].Elem.(*schema.Resource)), new) | ||
|
||
if oldSet.Equal(newSet) { | ||
if err := diff.Clear(<%= go_literal(Google::StringUtils.underscore(prop.name)) -%>); err != nil { | ||
return err | ||
} | ||
} | ||
|
||
return nil |