Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix acceptance tests #1581

Merged
merged 1 commit into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions enumeration/resource/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,18 @@ func (a *Attributes) GetBool(path string) *bool {
}

func (a *Attributes) GetInt(path string) *int {
// This is a nonsense, if we want to retrieve an int this is gonna fail
// We were doing that because all numbers fields from cty are float64 but sometimes we want to retrieve an int
// TODO Change this to be compatible with both int and float64 underlying type
val := a.GetFloat64(path)
val, exist := (*a)[path]
if !exist {
return nil
}
if v, isInt := val.(int); isInt {
return &v
}
floatVal := a.GetFloat64(path)
if val == nil {
return nil
}
v := int(*val)
v := int(*floatVal)
return &v
}

Expand Down
16 changes: 16 additions & 0 deletions pkg/resource/schemas/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,22 @@ func (r *SchemaRepository) fetchNestedBlocks(root string, metadata map[string]re
}

func (r *SchemaRepository) Init(providerName, providerVersion string, schema map[string]providers.Schema) error {

if providerVersion == "" {
switch providerName {
case "aws":
providerVersion = "3.19.0"
case "github":
providerVersion = "4.4.0"
case "google":
providerVersion = "3.78.0"
case "azurerm":
providerVersion = "2.71.0"
default:
return errors.Errorf("unsupported remote '%s'", providerName)
}
}

v, err := version.NewVersion(providerVersion)
if err != nil {
return err
Expand Down