driftctl/test/terraform/provider.go

34 lines
1022 B
Go
Raw Normal View History

2021-06-28 09:00:59 +00:00
package terraform
import (
"os"
"github.com/cloudskiff/driftctl/pkg/output"
"github.com/cloudskiff/driftctl/pkg/remote/aws"
2021-06-30 18:42:02 +00:00
"github.com/cloudskiff/driftctl/pkg/remote/github"
2021-06-28 09:00:59 +00:00
"github.com/cloudskiff/driftctl/pkg/terraform"
)
func InitTestAwsProvider(providerLibrary *terraform.ProviderLibrary, version string) (*aws.AWSTerraformProvider, error) {
progress := &output.MockProgress{}
progress.On("Inc").Maybe().Return()
provider, err := aws.NewAWSTerraformProvider(version, progress, os.TempDir())
if err != nil {
return nil, err
}
providerLibrary.AddProvider(terraform.AWS, provider)
return provider, nil
}
2021-06-30 18:42:02 +00:00
func InitTestGithubProvider(providerLibrary *terraform.ProviderLibrary, version string) (*github.GithubTerraformProvider, error) {
progress := &output.MockProgress{}
progress.On("Inc").Maybe().Return()
provider, err := github.NewGithubTerraformProvider(version, progress, "")
if err != nil {
return nil, err
}
providerLibrary.AddProvider(terraform.GITHUB, provider)
return provider, nil
}