Fix acceptance tests
- Fix default provider version not being set in the schema repository since now this is done on the enumeration side. - Fix once for all issues with GetInt that should be able to retrieve both float and int from resource attributes.main
parent
cc6e2ca87a
commit
c37003694f
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue