refactor: build repositories once
parent
f8914f1c82
commit
e8d2b2bf70
|
@ -18,11 +18,11 @@ type CloudfrontDistributionSupplier struct {
|
||||||
runner *terraform.ParallelResourceReader
|
runner *terraform.ParallelResourceReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewCloudfrontDistributionSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer) *CloudfrontDistributionSupplier {
|
func NewCloudfrontDistributionSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, repo repository.CloudfrontRepository) *CloudfrontDistributionSupplier {
|
||||||
return &CloudfrontDistributionSupplier{
|
return &CloudfrontDistributionSupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewCloudfrontClient(provider.session),
|
repo,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
|
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
||||||
testresource "github.com/cloudskiff/driftctl/test/resource"
|
testresource "github.com/cloudskiff/driftctl/test/resource"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/service/cloudfront"
|
"github.com/aws/aws-sdk-go/service/cloudfront"
|
||||||
|
@ -75,7 +76,7 @@ func TestCloudfrontDistributionSupplier_Resources(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
supplierLibrary.AddSupplier(NewCloudfrontDistributionSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewCloudfrontDistributionSupplier(provider, deserializer, , repository.NewCloudfrontClient(provider.session)))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(c.test, func(tt *testing.T) {
|
t.Run(c.test, func(tt *testing.T) {
|
||||||
|
|
|
@ -18,11 +18,11 @@ type DBInstanceSupplier struct {
|
||||||
runner *terraform.ParallelResourceReader
|
runner *terraform.ParallelResourceReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDBInstanceSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer) *DBInstanceSupplier {
|
func NewDBInstanceSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, repo repository.RDSRepository) *DBInstanceSupplier {
|
||||||
return &DBInstanceSupplier{
|
return &DBInstanceSupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewRDSRepository(provider.session),
|
repo,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ func TestDBInstanceSupplier_Resources(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
supplierLibrary.AddSupplier(NewDBInstanceSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewDBInstanceSupplier(provider, deserializer, repository.NewRDSRepository(provider.session)))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(tt.test, func(t *testing.T) {
|
t.Run(tt.test, func(t *testing.T) {
|
||||||
|
|
|
@ -22,11 +22,11 @@ type DBSubnetGroupSupplier struct {
|
||||||
runner *terraform.ParallelResourceReader
|
runner *terraform.ParallelResourceReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDBSubnetGroupSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer) *DBSubnetGroupSupplier {
|
func NewDBSubnetGroupSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, repo repository.RDSRepository) *DBSubnetGroupSupplier {
|
||||||
return &DBSubnetGroupSupplier{
|
return &DBSubnetGroupSupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewRDSRepository(provider.session),
|
repo,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ func TestDBSubnetGroupSupplier_Resources(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
supplierLibrary.AddSupplier(NewDBInstanceSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewDBInstanceSupplier(provider, deserializer, repository.NewRDSRepository(provider.session)))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(tt.test, func(t *testing.T) {
|
t.Run(tt.test, func(t *testing.T) {
|
||||||
|
|
|
@ -19,11 +19,11 @@ type DynamoDBTableSupplier struct {
|
||||||
runner *terraform.ParallelResourceReader
|
runner *terraform.ParallelResourceReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDynamoDBTableSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer) *DynamoDBTableSupplier {
|
func NewDynamoDBTableSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, repo repository.DynamoDBRepository) *DynamoDBTableSupplier {
|
||||||
return &DynamoDBTableSupplier{
|
return &DynamoDBTableSupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewDynamoDBRepository(provider.session),
|
repo,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
|
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
||||||
testresource "github.com/cloudskiff/driftctl/test/resource"
|
testresource "github.com/cloudskiff/driftctl/test/resource"
|
||||||
|
|
||||||
remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error"
|
remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error"
|
||||||
|
@ -81,7 +82,7 @@ func TestDynamoDBTableSupplier_Resources(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
supplierLibrary.AddSupplier(NewDynamoDBTableSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewDynamoDBTableSupplier(provider, deserializer, repository.NewDynamoDBRepository(provider.session)))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(c.test, func(tt *testing.T) {
|
t.Run(c.test, func(tt *testing.T) {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package aws
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
||||||
"github.com/cloudskiff/driftctl/pkg/remote/cache"
|
|
||||||
remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error"
|
remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error"
|
||||||
|
|
||||||
"github.com/cloudskiff/driftctl/pkg/resource"
|
"github.com/cloudskiff/driftctl/pkg/resource"
|
||||||
|
@ -22,11 +21,11 @@ type EC2AmiSupplier struct {
|
||||||
runner *terraform.ParallelResourceReader
|
runner *terraform.ParallelResourceReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewEC2AmiSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, c cache.Cache) *EC2AmiSupplier {
|
func NewEC2AmiSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, repo repository.EC2Repository) *EC2AmiSupplier {
|
||||||
return &EC2AmiSupplier{
|
return &EC2AmiSupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewEC2Repository(provider.session, c),
|
repo,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ func TestEC2AmiSupplier_Resources(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
supplierLibrary.AddSupplier(NewEC2AmiSupplier(provider, deserializer, cache.New(0)))
|
supplierLibrary.AddSupplier(NewEC2AmiSupplier(provider, deserializer, repository.NewEC2Repository(provider.session, cache.New(0))))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(tt.test, func(t *testing.T) {
|
t.Run(tt.test, func(t *testing.T) {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package aws
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
||||||
"github.com/cloudskiff/driftctl/pkg/remote/cache"
|
|
||||||
remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error"
|
remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error"
|
||||||
|
|
||||||
"github.com/cloudskiff/driftctl/pkg/resource"
|
"github.com/cloudskiff/driftctl/pkg/resource"
|
||||||
|
@ -23,11 +22,11 @@ type EC2EbsSnapshotSupplier struct {
|
||||||
runner *terraform.ParallelResourceReader
|
runner *terraform.ParallelResourceReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewEC2EbsSnapshotSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, c cache.Cache) *EC2EbsSnapshotSupplier {
|
func NewEC2EbsSnapshotSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, repo repository.EC2Repository) *EC2EbsSnapshotSupplier {
|
||||||
return &EC2EbsSnapshotSupplier{
|
return &EC2EbsSnapshotSupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewEC2Repository(provider.session, c),
|
repo,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ func TestEC2EbsSnapshotSupplier_Resources(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
supplierLibrary.AddSupplier(NewEC2EbsSnapshotSupplier(provider, deserializer, cache.New(0)))
|
supplierLibrary.AddSupplier(NewEC2EbsSnapshotSupplier(provider, deserializer, repository.NewEC2Repository(provider.session, cache.New(0))))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(tt.test, func(t *testing.T) {
|
t.Run(tt.test, func(t *testing.T) {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package aws
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
||||||
"github.com/cloudskiff/driftctl/pkg/remote/cache"
|
|
||||||
remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error"
|
remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error"
|
||||||
|
|
||||||
"github.com/cloudskiff/driftctl/pkg/resource"
|
"github.com/cloudskiff/driftctl/pkg/resource"
|
||||||
|
@ -23,11 +22,11 @@ type EC2EbsVolumeSupplier struct {
|
||||||
runner *terraform.ParallelResourceReader
|
runner *terraform.ParallelResourceReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewEC2EbsVolumeSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, c cache.Cache) *EC2EbsVolumeSupplier {
|
func NewEC2EbsVolumeSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, repo repository.EC2Repository) *EC2EbsVolumeSupplier {
|
||||||
return &EC2EbsVolumeSupplier{
|
return &EC2EbsVolumeSupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewEC2Repository(provider.session, c),
|
repo,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ func TestEC2EbsVolumeSupplier_Resources(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
supplierLibrary.AddSupplier(NewEC2EbsVolumeSupplier(provider, deserializer, cache.New(0))
|
supplierLibrary.AddSupplier(NewEC2EbsVolumeSupplier(provider, deserializer, repository.NewEC2Repository(provider.session, cache.New(0)))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(tt.test, func(t *testing.T) {
|
t.Run(tt.test, func(t *testing.T) {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package aws
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
||||||
"github.com/cloudskiff/driftctl/pkg/remote/cache"
|
|
||||||
remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error"
|
remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error"
|
||||||
|
|
||||||
"github.com/cloudskiff/driftctl/pkg/resource"
|
"github.com/cloudskiff/driftctl/pkg/resource"
|
||||||
|
@ -21,11 +20,11 @@ type EC2EipAssociationSupplier struct {
|
||||||
runner *terraform.ParallelResourceReader
|
runner *terraform.ParallelResourceReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewEC2EipAssociationSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, c cache.Cache) *EC2EipAssociationSupplier {
|
func NewEC2EipAssociationSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, repo repository.EC2Repository) *EC2EipAssociationSupplier {
|
||||||
return &EC2EipAssociationSupplier{
|
return &EC2EipAssociationSupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewEC2Repository(provider.session, c),
|
repo,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner())}
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner())}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ func TestEC2EipAssociationSupplier_Resources(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
supplierLibrary.AddSupplier(NewEC2EipAssociationSupplier(provider, deserializer, cache.New(0)))
|
supplierLibrary.AddSupplier(NewEC2EipAssociationSupplier(provider, deserializer, repository.NewEC2Repository(provider.session, cache.New(0))))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(tt.test, func(t *testing.T) {
|
t.Run(tt.test, func(t *testing.T) {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package aws
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
||||||
"github.com/cloudskiff/driftctl/pkg/remote/cache"
|
|
||||||
remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error"
|
remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error"
|
||||||
|
|
||||||
"github.com/cloudskiff/driftctl/pkg/resource"
|
"github.com/cloudskiff/driftctl/pkg/resource"
|
||||||
|
@ -23,11 +22,11 @@ type EC2EipSupplier struct {
|
||||||
runner *terraform.ParallelResourceReader
|
runner *terraform.ParallelResourceReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewEC2EipSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, c cache.Cache) *EC2EipSupplier {
|
func NewEC2EipSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, repo repository.EC2Repository) *EC2EipSupplier {
|
||||||
return &EC2EipSupplier{
|
return &EC2EipSupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewEC2Repository(provider.session, c),
|
repo,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ func TestEC2EipSupplier_Resources(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
supplierLibrary.AddSupplier(NewEC2EipSupplier(provider, deserializer, cache.New(0)))
|
supplierLibrary.AddSupplier(NewEC2EipSupplier(provider, deserializer, repository.NewEC2Repository(provider.session, cache.New(0))))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(tt.test, func(t *testing.T) {
|
t.Run(tt.test, func(t *testing.T) {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package aws
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
||||||
"github.com/cloudskiff/driftctl/pkg/remote/cache"
|
|
||||||
remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error"
|
remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error"
|
||||||
|
|
||||||
"github.com/cloudskiff/driftctl/pkg/resource"
|
"github.com/cloudskiff/driftctl/pkg/resource"
|
||||||
|
@ -22,11 +21,11 @@ type EC2InstanceSupplier struct {
|
||||||
runner *terraform.ParallelResourceReader
|
runner *terraform.ParallelResourceReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewEC2InstanceSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, c cache.Cache) *EC2InstanceSupplier {
|
func NewEC2InstanceSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, repo repository.EC2Repository) *EC2InstanceSupplier {
|
||||||
return &EC2InstanceSupplier{
|
return &EC2InstanceSupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewEC2Repository(provider.session, c),
|
repo,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ func TestEC2InstanceSupplier_Resources(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
supplierLibrary.AddSupplier(NewEC2InstanceSupplier(provider, deserializer, cache.New(0))
|
supplierLibrary.AddSupplier(NewEC2InstanceSupplier(provider, deserializer, repository.NewEC2Repository(provider.session, cache.New(0)))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(tt.test, func(t *testing.T) {
|
t.Run(tt.test, func(t *testing.T) {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package aws
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
||||||
"github.com/cloudskiff/driftctl/pkg/remote/cache"
|
|
||||||
remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error"
|
remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error"
|
||||||
|
|
||||||
"github.com/cloudskiff/driftctl/pkg/resource"
|
"github.com/cloudskiff/driftctl/pkg/resource"
|
||||||
|
@ -22,11 +21,11 @@ type EC2KeyPairSupplier struct {
|
||||||
runner *terraform.ParallelResourceReader
|
runner *terraform.ParallelResourceReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewEC2KeyPairSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, c cache.Cache) *EC2KeyPairSupplier {
|
func NewEC2KeyPairSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, repo repository.EC2Repository) *EC2KeyPairSupplier {
|
||||||
return &EC2KeyPairSupplier{
|
return &EC2KeyPairSupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewEC2Repository(provider.session, c),
|
repo,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ func TestEC2KeyPairSupplier_Resources(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
supplierLibrary.AddSupplier(NewEC2KeyPairSupplier(provider, deserializer, cache.New(0)))
|
supplierLibrary.AddSupplier(NewEC2KeyPairSupplier(provider, deserializer, repository.NewEC2Repository(provider.session, cache.New(0))))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(tt.test, func(t *testing.T) {
|
t.Run(tt.test, func(t *testing.T) {
|
||||||
|
|
|
@ -19,11 +19,11 @@ type ECRRepositorySupplier struct {
|
||||||
runner *terraform.ParallelResourceReader
|
runner *terraform.ParallelResourceReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewECRRepositorySupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer) *ECRRepositorySupplier {
|
func NewECRRepositorySupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, repo repository.ECRRepository) *ECRRepositorySupplier {
|
||||||
return &ECRRepositorySupplier{
|
return &ECRRepositorySupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewECRRepository(provider.session),
|
repo,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ func TestEcrRepositorySupplier_Resources(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
supplierLibrary.AddSupplier(NewECRRepositorySupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewECRRepositorySupplier(provider, deserializer, repository.NewECRRepository(provider.session)))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(c.test, func(tt *testing.T) {
|
t.Run(c.test, func(tt *testing.T) {
|
||||||
|
|
|
@ -37,27 +37,38 @@ func Init(alerter *alerter.Alerter,
|
||||||
repositoryCache := cache.New(100)
|
repositoryCache := cache.New(100)
|
||||||
|
|
||||||
s3Repository := repository.NewS3Repository(client.NewAWSClientFactory(provider.session))
|
s3Repository := repository.NewS3Repository(client.NewAWSClientFactory(provider.session))
|
||||||
|
ec2repository := repository.NewEC2Repository(provider.session, repositoryCache)
|
||||||
|
route53repository := repository.NewRoute53Repository(provider.session)
|
||||||
|
lambdaRepository := repository.NewLambdaRepository(provider.session)
|
||||||
|
rdsRepository := repository.NewRDSRepository(provider.session)
|
||||||
|
sqsRepository := repository.NewSQSClient(provider.session)
|
||||||
|
snsRepository := repository.NewSNSClient(provider.session)
|
||||||
|
dynamoDBRepository := repository.NewDynamoDBRepository(provider.session)
|
||||||
|
cloudfrontRepository := repository.NewCloudfrontClient(provider.session)
|
||||||
|
kmsRepository := repository.NewKMSRepository(provider.session)
|
||||||
|
ecrRepository := repository.NewECRRepository(provider.session)
|
||||||
|
|
||||||
deserializer := resource.NewDeserializer(factory)
|
deserializer := resource.NewDeserializer(factory)
|
||||||
providerLibrary.AddProvider(terraform.AWS, provider)
|
providerLibrary.AddProvider(terraform.AWS, provider)
|
||||||
|
|
||||||
supplierLibrary.AddSupplier(NewS3BucketSupplier(provider, s3Repository, deserializer))
|
supplierLibrary.AddSupplier(NewS3BucketSupplier(provider, deserializer, s3Repository))
|
||||||
supplierLibrary.AddSupplier(NewS3BucketAnalyticSupplier(provider, s3Repository, deserializer))
|
supplierLibrary.AddSupplier(NewS3BucketAnalyticSupplier(provider, deserializer, s3Repository))
|
||||||
supplierLibrary.AddSupplier(NewS3BucketInventorySupplier(provider, s3Repository, deserializer))
|
supplierLibrary.AddSupplier(NewS3BucketInventorySupplier(provider, deserializer, s3Repository))
|
||||||
supplierLibrary.AddSupplier(NewS3BucketMetricSupplier(provider, s3Repository, deserializer))
|
supplierLibrary.AddSupplier(NewS3BucketMetricSupplier(provider, deserializer, s3Repository))
|
||||||
supplierLibrary.AddSupplier(NewS3BucketNotificationSupplier(provider, s3Repository, deserializer))
|
supplierLibrary.AddSupplier(NewS3BucketNotificationSupplier(provider, deserializer, s3Repository))
|
||||||
supplierLibrary.AddSupplier(NewS3BucketPolicySupplier(provider, s3Repository, deserializer))
|
supplierLibrary.AddSupplier(NewS3BucketPolicySupplier(provider, deserializer, s3Repository))
|
||||||
supplierLibrary.AddSupplier(NewEC2EipSupplier(provider, deserializer, repositoryCache))
|
supplierLibrary.AddSupplier(NewEC2EipSupplier(provider, deserializer, ec2repository))
|
||||||
supplierLibrary.AddSupplier(NewEC2EipAssociationSupplier(provider, deserializer, repositoryCache))
|
supplierLibrary.AddSupplier(NewEC2EipAssociationSupplier(provider, deserializer, ec2repository))
|
||||||
supplierLibrary.AddSupplier(NewEC2EbsVolumeSupplier(provider, deserializer, repositoryCache))
|
supplierLibrary.AddSupplier(NewEC2EbsVolumeSupplier(provider, deserializer, ec2repository))
|
||||||
supplierLibrary.AddSupplier(NewEC2EbsSnapshotSupplier(provider, deserializer, repositoryCache))
|
supplierLibrary.AddSupplier(NewEC2EbsSnapshotSupplier(provider, deserializer, ec2repository))
|
||||||
supplierLibrary.AddSupplier(NewRoute53ZoneSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewRoute53ZoneSupplier(provider, deserializer, route53repository))
|
||||||
supplierLibrary.AddSupplier(NewRoute53RecordSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewRoute53RecordSupplier(provider, deserializer, route53repository))
|
||||||
supplierLibrary.AddSupplier(NewEC2InstanceSupplier(provider, deserializer, repositoryCache))
|
supplierLibrary.AddSupplier(NewEC2InstanceSupplier(provider, deserializer, ec2repository))
|
||||||
supplierLibrary.AddSupplier(NewEC2AmiSupplier(provider, deserializer, repositoryCache))
|
supplierLibrary.AddSupplier(NewEC2AmiSupplier(provider, deserializer, ec2repository))
|
||||||
supplierLibrary.AddSupplier(NewEC2KeyPairSupplier(provider, deserializer, repositoryCache))
|
supplierLibrary.AddSupplier(NewEC2KeyPairSupplier(provider, deserializer, ec2repository))
|
||||||
supplierLibrary.AddSupplier(NewLambdaFunctionSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewLambdaFunctionSupplier(provider, deserializer, lambdaRepository))
|
||||||
supplierLibrary.AddSupplier(NewDBSubnetGroupSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewDBSubnetGroupSupplier(provider, deserializer, rdsRepository))
|
||||||
supplierLibrary.AddSupplier(NewDBInstanceSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewDBInstanceSupplier(provider, deserializer, rdsRepository))
|
||||||
supplierLibrary.AddSupplier(NewVPCSecurityGroupSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewVPCSecurityGroupSupplier(provider, deserializer))
|
||||||
supplierLibrary.AddSupplier(NewIamUserSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewIamUserSupplier(provider, deserializer))
|
||||||
supplierLibrary.AddSupplier(NewIamUserPolicySupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewIamUserPolicySupplier(provider, deserializer))
|
||||||
|
@ -75,18 +86,18 @@ func Init(alerter *alerter.Alerter,
|
||||||
supplierLibrary.AddSupplier(NewRouteTableAssociationSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewRouteTableAssociationSupplier(provider, deserializer))
|
||||||
supplierLibrary.AddSupplier(NewNatGatewaySupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewNatGatewaySupplier(provider, deserializer))
|
||||||
supplierLibrary.AddSupplier(NewInternetGatewaySupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewInternetGatewaySupplier(provider, deserializer))
|
||||||
supplierLibrary.AddSupplier(NewSqsQueueSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewSqsQueueSupplier(provider, deserializer, sqsRepository))
|
||||||
supplierLibrary.AddSupplier(NewSqsQueuePolicySupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewSqsQueuePolicySupplier(provider, deserializer, sqsRepository))
|
||||||
supplierLibrary.AddSupplier(NewSNSTopicSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewSNSTopicSupplier(provider, deserializer, snsRepository))
|
||||||
supplierLibrary.AddSupplier(NewSNSTopicPolicySupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewSNSTopicPolicySupplier(provider, deserializer, snsRepository))
|
||||||
supplierLibrary.AddSupplier(NewSNSTopicSubscriptionSupplier(provider, alerter, deserializer))
|
supplierLibrary.AddSupplier(NewSNSTopicSubscriptionSupplier(provider, alerter, deserializer, snsRepository))
|
||||||
supplierLibrary.AddSupplier(NewDynamoDBTableSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewDynamoDBTableSupplier(provider, deserializer, dynamoDBRepository))
|
||||||
supplierLibrary.AddSupplier(NewRoute53HealthCheckSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewRoute53HealthCheckSupplier(provider, deserializer, route53repository))
|
||||||
supplierLibrary.AddSupplier(NewCloudfrontDistributionSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewCloudfrontDistributionSupplier(provider, deserializer, cloudfrontRepository))
|
||||||
supplierLibrary.AddSupplier(NewECRRepositorySupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewECRRepositorySupplier(provider, deserializer, ecrRepository))
|
||||||
supplierLibrary.AddSupplier(NewKMSKeySupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewKMSKeySupplier(provider, deserializer, kmsRepository))
|
||||||
supplierLibrary.AddSupplier(NewKMSAliasSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewKMSAliasSupplier(provider, deserializer, kmsRepository))
|
||||||
supplierLibrary.AddSupplier(NewLambdaEventSourceMappingSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewLambdaEventSourceMappingSupplier(provider, deserializer, lambdaRepository))
|
||||||
|
|
||||||
resourceSchemaRepository.Init(provider.Schema())
|
resourceSchemaRepository.Init(provider.Schema())
|
||||||
aws.InitResourcesMetadata(resourceSchemaRepository)
|
aws.InitResourcesMetadata(resourceSchemaRepository)
|
||||||
|
|
|
@ -20,11 +20,11 @@ type KMSAliasSupplier struct {
|
||||||
runner *terraform.ParallelResourceReader
|
runner *terraform.ParallelResourceReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewKMSAliasSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer) *KMSAliasSupplier {
|
func NewKMSAliasSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, repo repository.KMSRepository) *KMSAliasSupplier {
|
||||||
return &KMSAliasSupplier{
|
return &KMSAliasSupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewKMSRepository(provider.session),
|
repo,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ func TestKMSAliasSupplier_Resources(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
supplierLibrary.AddSupplier(NewKMSAliasSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewKMSAliasSupplier(provider, deserializer, repository.NewKMSRepository(provider.session)))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(c.test, func(tt *testing.T) {
|
t.Run(c.test, func(tt *testing.T) {
|
||||||
|
|
|
@ -20,11 +20,11 @@ type KMSKeySupplier struct {
|
||||||
runner *terraform.ParallelResourceReader
|
runner *terraform.ParallelResourceReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewKMSKeySupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer) *KMSKeySupplier {
|
func NewKMSKeySupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, repo repository.KMSRepository) *KMSKeySupplier {
|
||||||
return &KMSKeySupplier{
|
return &KMSKeySupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewKMSRepository(provider.session),
|
repo,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ func TestKMSKeySupplier_Resources(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
supplierLibrary.AddSupplier(NewKMSKeySupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewKMSKeySupplier(provider, deserializer, repository.NewKMSRepository(provider.session)))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(c.test, func(tt *testing.T) {
|
t.Run(c.test, func(tt *testing.T) {
|
||||||
|
|
|
@ -19,11 +19,11 @@ type LambdaEventSourceMappingSupplier struct {
|
||||||
runner *terraform.ParallelResourceReader
|
runner *terraform.ParallelResourceReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewLambdaEventSourceMappingSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer) *LambdaEventSourceMappingSupplier {
|
func NewLambdaEventSourceMappingSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, repo repository.LambdaRepository) *LambdaEventSourceMappingSupplier {
|
||||||
return &LambdaEventSourceMappingSupplier{
|
return &LambdaEventSourceMappingSupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewLambdaRepository(provider.session),
|
repo,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ func TestEventLambdaSourceMappingSupplier_Resources(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
supplierLibrary.AddSupplier(NewLambdaEventSourceMappingSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewLambdaEventSourceMappingSupplier(provider, deserializer, repository.NewLambdaRepository(provider.session)))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(tt.test, func(t *testing.T) {
|
t.Run(tt.test, func(t *testing.T) {
|
||||||
|
|
|
@ -19,11 +19,11 @@ type LambdaFunctionSupplier struct {
|
||||||
runner *terraform.ParallelResourceReader
|
runner *terraform.ParallelResourceReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewLambdaFunctionSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer) *LambdaFunctionSupplier {
|
func NewLambdaFunctionSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, repo repository.LambdaRepository) *LambdaFunctionSupplier {
|
||||||
return &LambdaFunctionSupplier{
|
return &LambdaFunctionSupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewLambdaRepository(provider.session),
|
repo,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ func TestLambdaFunctionSupplier_Resources(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
supplierLibrary.AddSupplier(NewLambdaFunctionSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewLambdaFunctionSupplier(provider, deserializer, repository.NewLambdaRepository(provider.session)))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(tt.test, func(t *testing.T) {
|
t.Run(tt.test, func(t *testing.T) {
|
||||||
|
|
|
@ -20,11 +20,11 @@ type Route53HealthCheckSupplier struct {
|
||||||
runner *terraform.ParallelResourceReader
|
runner *terraform.ParallelResourceReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRoute53HealthCheckSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer) *Route53HealthCheckSupplier {
|
func NewRoute53HealthCheckSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, repo repository.Route53Repository) *Route53HealthCheckSupplier {
|
||||||
return &Route53HealthCheckSupplier{
|
return &Route53HealthCheckSupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewRoute53Repository(provider.session),
|
repo,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ func TestRoute53HealthCheckSupplier_Resources(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
supplierLibrary.AddSupplier(NewRoute53HealthCheckSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewRoute53HealthCheckSupplier(provider, deserializer, repository.NewRoute53Repository(provider.session)))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(c.test, func(tt *testing.T) {
|
t.Run(c.test, func(tt *testing.T) {
|
||||||
|
|
|
@ -21,11 +21,11 @@ type Route53RecordSupplier struct {
|
||||||
runner *terraform.ParallelResourceReader
|
runner *terraform.ParallelResourceReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRoute53RecordSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer) *Route53RecordSupplier {
|
func NewRoute53RecordSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, repo repository.Route53Repository) *Route53RecordSupplier {
|
||||||
return &Route53RecordSupplier{
|
return &Route53RecordSupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewRoute53Repository(provider.session),
|
repo,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner())}
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner())}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ func TestRoute53RecordSupplier_Resources(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
supplierLibrary.AddSupplier(NewRoute53RecordSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewRoute53RecordSupplier(provider, deserializer, repository.NewRoute53Repository(provider.session)))
|
||||||
}
|
}
|
||||||
|
|
||||||
provider := testmocks.NewMockedGoldenTFProvider(tt.dirName, providerLibrary.Provider(terraform.AWS), shouldUpdate)
|
provider := testmocks.NewMockedGoldenTFProvider(tt.dirName, providerLibrary.Provider(terraform.AWS), shouldUpdate)
|
||||||
|
|
|
@ -24,11 +24,11 @@ type Route53ZoneSupplier struct {
|
||||||
runner *terraform.ParallelResourceReader
|
runner *terraform.ParallelResourceReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRoute53ZoneSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer) *Route53ZoneSupplier {
|
func NewRoute53ZoneSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, repo repository.Route53Repository) *Route53ZoneSupplier {
|
||||||
return &Route53ZoneSupplier{
|
return &Route53ZoneSupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewRoute53Repository(provider.session),
|
repo,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ func TestRoute53ZoneSupplier_Resources(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
supplierLibrary.AddSupplier(NewRoute53ZoneSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewRoute53ZoneSupplier(provider, deserializer, repository.NewRoute53Repository(provider.session)))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(tt.test, func(t *testing.T) {
|
t.Run(tt.test, func(t *testing.T) {
|
||||||
|
|
|
@ -20,11 +20,11 @@ type SNSTopicPolicySupplier struct {
|
||||||
runner *terraform.ParallelResourceReader
|
runner *terraform.ParallelResourceReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSNSTopicPolicySupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer) *SNSTopicPolicySupplier {
|
func NewSNSTopicPolicySupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, repo repository.SNSRepository) *SNSTopicPolicySupplier {
|
||||||
return &SNSTopicPolicySupplier{
|
return &SNSTopicPolicySupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewSNSClient(provider.session),
|
repo,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
testresource "github.com/cloudskiff/driftctl/test/resource"
|
testresource "github.com/cloudskiff/driftctl/test/resource"
|
||||||
|
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/service/sns"
|
"github.com/aws/aws-sdk-go/service/sns"
|
||||||
|
|
||||||
|
@ -80,7 +81,7 @@ func TestSNSTopicPolicySupplier_Resources(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
supplierLibrary.AddSupplier(NewSNSTopicSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewSNSTopicSupplier(provider, deserializer, repository.NewSNSClient(provider.session)))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(c.test, func(tt *testing.T) {
|
t.Run(c.test, func(tt *testing.T) {
|
||||||
|
|
|
@ -40,11 +40,11 @@ type SNSTopicSubscriptionSupplier struct {
|
||||||
alerter alerter.AlerterInterface
|
alerter alerter.AlerterInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSNSTopicSubscriptionSupplier(provider *AWSTerraformProvider, a alerter.AlerterInterface, deserializer *resource.Deserializer) *SNSTopicSubscriptionSupplier {
|
func NewSNSTopicSubscriptionSupplier(provider *AWSTerraformProvider, a alerter.AlerterInterface, deserializer *resource.Deserializer, client repository.SNSRepository) *SNSTopicSubscriptionSupplier {
|
||||||
return &SNSTopicSubscriptionSupplier{
|
return &SNSTopicSubscriptionSupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewSNSClient(provider.session),
|
client,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
||||||
a,
|
a,
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
testresource "github.com/cloudskiff/driftctl/test/resource"
|
testresource "github.com/cloudskiff/driftctl/test/resource"
|
||||||
|
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/service/sns"
|
"github.com/aws/aws-sdk-go/service/sns"
|
||||||
|
|
||||||
|
@ -100,7 +101,7 @@ func TestSNSTopicSubscriptionSupplier_Resources(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
supplierLibrary.AddSupplier(NewSNSTopicSubscriptionSupplier(provider, a, deserializer))
|
supplierLibrary.AddSupplier(NewSNSTopicSubscriptionSupplier(provider, a, deserializer, repository.NewSNSClient(provider.session)))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(c.test, func(tt *testing.T) {
|
t.Run(c.test, func(tt *testing.T) {
|
||||||
|
|
|
@ -20,11 +20,11 @@ type SNSTopicSupplier struct {
|
||||||
runner *terraform.ParallelResourceReader
|
runner *terraform.ParallelResourceReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSNSTopicSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer) *SNSTopicSupplier {
|
func NewSNSTopicSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, client repository.SNSRepository) *SNSTopicSupplier {
|
||||||
return &SNSTopicSupplier{
|
return &SNSTopicSupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewSNSClient(provider.session),
|
client,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
testresource "github.com/cloudskiff/driftctl/test/resource"
|
testresource "github.com/cloudskiff/driftctl/test/resource"
|
||||||
|
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/service/sns"
|
"github.com/aws/aws-sdk-go/service/sns"
|
||||||
|
|
||||||
|
@ -81,7 +82,7 @@ func TestSNSTopicSupplier_Resources(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
supplierLibrary.AddSupplier(NewSNSTopicSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewSNSTopicSupplier(provider, deserializer, repository.NewSNSClient(provider.session)))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(c.test, func(tt *testing.T) {
|
t.Run(c.test, func(tt *testing.T) {
|
||||||
|
|
|
@ -18,11 +18,11 @@ type SqsQueuePolicySupplier struct {
|
||||||
runner *terraform.ParallelResourceReader
|
runner *terraform.ParallelResourceReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSqsQueuePolicySupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer) *SqsQueuePolicySupplier {
|
func NewSqsQueuePolicySupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, client repository.SQSRepository) *SqsQueuePolicySupplier {
|
||||||
return &SqsQueuePolicySupplier{
|
return &SqsQueuePolicySupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewSQSClient(provider.session),
|
client,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||||
|
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
||||||
remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error"
|
remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error"
|
||||||
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
|
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
|
||||||
testresource "github.com/cloudskiff/driftctl/test/resource"
|
testresource "github.com/cloudskiff/driftctl/test/resource"
|
||||||
|
@ -76,7 +77,7 @@ func TestSqsQueuePolicySupplier_Resources(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
supplierLibrary.AddSupplier(NewSqsQueuePolicySupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewSqsQueuePolicySupplier(provider, deserializer, repository.NewSQSClient(provider.session)))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(c.test, func(tt *testing.T) {
|
t.Run(c.test, func(tt *testing.T) {
|
||||||
|
|
|
@ -18,11 +18,11 @@ type SqsQueueSupplier struct {
|
||||||
runner *terraform.ParallelResourceReader
|
runner *terraform.ParallelResourceReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSqsQueueSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer) *SqsQueueSupplier {
|
func NewSqsQueueSupplier(provider *AWSTerraformProvider, deserializer *resource.Deserializer, client repository.SQSRepository) *SqsQueueSupplier {
|
||||||
return &SqsQueueSupplier{
|
return &SqsQueueSupplier{
|
||||||
provider,
|
provider,
|
||||||
deserializer,
|
deserializer,
|
||||||
repository.NewSQSClient(provider.session),
|
client,
|
||||||
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
terraform.NewParallelResourceReader(provider.Runner().SubRunner()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
awssdk "github.com/aws/aws-sdk-go/aws"
|
awssdk "github.com/aws/aws-sdk-go/aws"
|
||||||
|
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
||||||
testresource "github.com/cloudskiff/driftctl/test/resource"
|
testresource "github.com/cloudskiff/driftctl/test/resource"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||||
|
@ -73,7 +74,7 @@ func TestSqsQueueSupplier_Resources(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
supplierLibrary.AddSupplier(NewSqsQueueSupplier(provider, deserializer))
|
supplierLibrary.AddSupplier(NewSqsQueueSupplier(provider, deserializer, repository.NewSQSClient(provider.session)))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(c.test, func(tt *testing.T) {
|
t.Run(c.test, func(tt *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue