driftctl/pkg/remote/github/init.go

35 lines
969 B
Go
Raw Normal View History

2021-02-15 13:24:20 +00:00
package github
import (
"github.com/cloudskiff/driftctl/pkg/alerter"
"github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform"
)
const RemoteGithubTerraform = "github+tf"
/**
* Initialize remote (configure credentials, launch tf providers and start gRPC clients)
* Required to use Scanner
*/
func Init(alerter *alerter.Alerter, providerLibrary *terraform.ProviderLibrary, supplierLibrary *resource.SupplierLibrary) error {
provider, err := NewGithubTerraformProvider()
if err != nil {
return err
}
err = provider.Init()
if err != nil {
return err
}
repository := NewGithubRepository(provider.GetConfig())
providerLibrary.AddProvider(terraform.GITHUB, provider)
supplierLibrary.AddSupplier(NewGithubRepositorySupplier(provider, repository))
2021-02-24 12:55:26 +00:00
supplierLibrary.AddSupplier(NewGithubTeamSupplier(provider, repository))
2021-02-26 15:12:27 +00:00
supplierLibrary.AddSupplier(NewGithubMembershipSupplier(provider, repository))
2021-02-15 13:24:20 +00:00
return nil
}