Skip to content

Commit

Permalink
Simplify provider version data assigment logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Zheng Qin committed Sep 6, 2024
1 parent 375c7a4 commit 4b72db6
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions cli/bpmetadata/tfconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,22 +203,18 @@ func parseBlueprintProviderVersions(versionsFile *hcl.File) ([]*ProviderVersion,
}

for _, providerData := range hclModule.RequiredProviders {
providerVersion := &ProviderVersion{}

source := providerData.Source
if source == "" {
if providerData.Source == "" {
Log.Info("Not found source in provider settings\n")
continue
}
providerVersion.Source = source

version := strings.Join(providerData.VersionConstraints, ", ")
if version == "" {
if len(providerData.VersionConstraints) == 0 {
Log.Info("Not found version in provider settings\n")
continue
}
providerVersion.Version = version
v = append(v, providerVersion)
v = append(v, &ProviderVersion{
Source: providerData.Source,
Version: strings.Join(providerData.VersionConstraints, ", "),
})
}
return v, nil
}
Expand Down

0 comments on commit 4b72db6

Please sign in to comment.