driftctl/pkg/remote/github/init.go

37 lines
1.1 KiB
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-03-01 12:39:00 +00:00
supplierLibrary.AddSupplier(NewGithubTeamMembershipSupplier(provider, repository))
2021-02-26 11:12:36 +00:00
supplierLibrary.AddSupplier(NewGithubBranchProtectionSupplier(provider, repository))
2021-02-15 13:24:20 +00:00
return nil
}