chore: Allow to set provider version in tests
Different AWS terraform state reader resource tests can use different provider versions.main
parent
8a16e8689a
commit
93292f577f
|
@ -99,6 +99,7 @@ func TestTerraformStateReader_AWS_Resources(t *testing.T) {
|
||||||
name string
|
name string
|
||||||
dirName string
|
dirName string
|
||||||
wantErr bool
|
wantErr bool
|
||||||
|
providerVersion string
|
||||||
}{
|
}{
|
||||||
{name: "IAM user module", dirName: "module.iam_iam-user", wantErr: false},
|
{name: "IAM user module", dirName: "module.iam_iam-user", wantErr: false},
|
||||||
{name: "Data source", dirName: "data_source", wantErr: false},
|
{name: "Data source", dirName: "data_source", wantErr: false},
|
||||||
|
@ -212,10 +213,13 @@ func TestTerraformStateReader_AWS_Resources(t *testing.T) {
|
||||||
shouldUpdate := tt.dirName == *goldenfile.Update
|
shouldUpdate := tt.dirName == *goldenfile.Update
|
||||||
|
|
||||||
var realProvider *aws.AWSTerraformProvider
|
var realProvider *aws.AWSTerraformProvider
|
||||||
|
if tt.providerVersion == "" {
|
||||||
|
tt.providerVersion = "3.19.0"
|
||||||
|
}
|
||||||
|
|
||||||
if shouldUpdate {
|
if shouldUpdate {
|
||||||
var err error
|
var err error
|
||||||
realProvider, err = aws.NewAWSTerraformProvider("3.19.0", progress, os.TempDir())
|
realProvider, err = aws.NewAWSTerraformProvider(tt.providerVersion, progress, os.TempDir())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -229,7 +233,7 @@ func TestTerraformStateReader_AWS_Resources(t *testing.T) {
|
||||||
library := terraform.NewProviderLibrary()
|
library := terraform.NewProviderLibrary()
|
||||||
library.AddProvider(terraform.AWS, provider)
|
library.AddProvider(terraform.AWS, provider)
|
||||||
|
|
||||||
repo := testresource.InitFakeSchemaRepository(terraform.AWS, "3.19.0")
|
repo := testresource.InitFakeSchemaRepository(terraform.AWS, tt.providerVersion)
|
||||||
resourceaws.InitResourcesMetadata(repo)
|
resourceaws.InitResourcesMetadata(repo)
|
||||||
|
|
||||||
factory := terraform.NewTerraformResourceFactory(repo)
|
factory := terraform.NewTerraformResourceFactory(repo)
|
||||||
|
|
Loading…
Reference in New Issue