driftctl/test/resource/resource.go

23 lines
550 B
Go
Raw Normal View History

package resource
2021-03-25 11:13:52 +00:00
import (
2021-03-26 08:44:55 +00:00
"github.com/hashicorp/terraform/providers"
2021-12-06 13:29:39 +00:00
"github.com/snyk/driftctl/pkg/resource"
"github.com/snyk/driftctl/test/schemas"
2021-03-25 11:13:52 +00:00
)
2021-03-26 08:44:55 +00:00
func InitFakeSchemaRepository(provider, version string) resource.SchemaRepositoryInterface {
repo := resource.NewSchemaRepository()
schema := make(map[string]providers.Schema)
if provider != "" {
s, err := schemas.ReadTestSchema(provider, version)
if err != nil {
// TODO HANDLER ERROR PROPERLY
panic(err)
}
schema = s
}
2021-07-29 09:50:35 +00:00
_ = repo.Init("Fake", "1.0.0", schema)
2021-03-26 08:44:55 +00:00
return repo
}