Skip to content

Commit

Permalink
Check if versionConfigPath, auto gen provider versions if the config …
Browse files Browse the repository at this point in the history
…path existing.
  • Loading branch information
Zheng Qin committed Sep 6, 2024
1 parent 4b72db6 commit a64ad37
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
4 changes: 2 additions & 2 deletions cli/bpmetadata/int-test/goldens/golden-metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ spec:
- compute.googleapis.com
- serviceusage.googleapis.com
providerVersions:
- source: hashicorp/google
version: ">= 4.42, < 5.0"
- source: hashicorp/random
version: ">= 2.1"
- source: hashicorp/google
version: ">= 4.42, < 5.0"
37 changes: 22 additions & 15 deletions cli/bpmetadata/tfconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,23 +310,30 @@ func getBlueprintRequirements(rolesConfigPath, servicesConfigPath, versionsConfi
return nil, err
}

//parse blueprint provider versions
versionsFile, diags := p.ParseHCLFile(versionsConfigPath)
err = hasHclErrors(diags)
if err != nil {
return nil, err
}
if versionsConfigPath != "" {
//parse blueprint provider versions
versionsFile, diags := p.ParseHCLFile(versionsConfigPath)
err = hasHclErrors(diags)
if err != nil {
return nil, err
}

v, err := parseBlueprintProviderVersions(versionsFile)
if err != nil {
return nil, err
}
v, err := parseBlueprintProviderVersions(versionsFile)
if err != nil {
return nil, err
}

return &BlueprintRequirements{
Roles: r,
Services: s,
ProviderVersions: v,
}, nil
return &BlueprintRequirements{
Roles: r,
Services: s,
ProviderVersions: v,
}, nil
} else {
return &BlueprintRequirements{
Roles: r,
Services: s,
}, nil
}
}

// parseBlueprintRoles gets the roles required for the blueprint to be provisioned
Expand Down

0 comments on commit a64ad37

Please sign in to comment.