driftctl/pkg/remote/remote.go

49 lines
1.4 KiB
Go
Raw Normal View History

package remote
import (
2020-12-16 12:02:02 +00:00
"github.com/cloudskiff/driftctl/pkg/alerter"
"github.com/cloudskiff/driftctl/pkg/output"
"github.com/cloudskiff/driftctl/pkg/remote/aws"
2021-06-11 15:10:06 +00:00
"github.com/cloudskiff/driftctl/pkg/remote/common"
2021-02-15 13:24:20 +00:00
"github.com/cloudskiff/driftctl/pkg/remote/github"
"github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform"
2021-02-09 18:43:39 +00:00
"github.com/pkg/errors"
)
var supportedRemotes = []string{
aws.RemoteAWSTerraform,
2021-02-15 13:24:20 +00:00
github.RemoteGithubTerraform,
}
func IsSupported(remote string) bool {
for _, r := range supportedRemotes {
if r == remote {
return true
}
}
return false
}
func Activate(remote, version string, alerter *alerter.Alerter,
2021-05-21 14:09:45 +00:00
providerLibrary *terraform.ProviderLibrary,
supplierLibrary *resource.SupplierLibrary,
2021-06-11 15:10:06 +00:00
remoteLibrary *common.RemoteLibrary,
2021-05-21 14:09:45 +00:00
progress output.Progress,
resourceSchemaRepository *resource.SchemaRepository,
factory resource.ResourceFactory,
configDir string) error {
switch remote {
case aws.RemoteAWSTerraform:
2021-06-11 15:10:06 +00:00
return aws.Init(version, alerter, providerLibrary, supplierLibrary, remoteLibrary, progress, resourceSchemaRepository, factory, configDir)
2021-02-15 13:24:20 +00:00
case github.RemoteGithubTerraform:
2021-06-11 15:10:06 +00:00
return github.Init(version, alerter, providerLibrary, supplierLibrary, remoteLibrary, progress, resourceSchemaRepository, factory, configDir)
default:
2021-02-10 13:37:59 +00:00
return errors.Errorf("unsupported remote '%s'", remote)
}
}
func GetSupportedRemotes() []string {
return supportedRemotes
}