Skip to content

Commit

Permalink
Ensure that resource group naming is deterministic (#1041)
Browse files Browse the repository at this point in the history
  • Loading branch information
iwahbe authored Apr 27, 2023
1 parent e78b8af commit 59cb763
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/tf2pulumi/convert/tf12_names.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,15 @@ func assignNames(files []*file) {
name := nt.pulumiName(n.name)
resourceGroups[name] = append(resourceGroups[name], n)
}
for name, group := range resourceGroups {

keys := make([]string, 0, len(resourceGroups))
for k := range resourceGroups {
keys = append(keys, k)
}
sort.Strings(keys)

for _, name := range keys {
group := resourceGroups[name]
if len(group) == 1 {
// If there is only one resource in this group, allow disambiguation to happen normally.
nt.assignResource(group[0])
Expand Down

0 comments on commit 59cb763

Please sign in to comment.