Merge pull request #121 from cloudskiff/multiples_tfstate_support

Add support for multiples IaC sources
main
Elie 2021-01-18 17:58:56 +01:00 committed by GitHub
commit 1f66e515b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
81 changed files with 516 additions and 248 deletions

View File

@ -156,6 +156,9 @@ $ AWS_PROFILE=profile_name driftctl scan
# With state stored on a s3 backend # With state stored on a s3 backend
$ driftctl scan --from tfstate+s3://my-bucket/path/to/state.tfstate $ driftctl scan --from tfstate+s3://my-bucket/path/to/state.tfstate
# With multiples states
$ driftctl scan --from tfstate://terraform_S3.tfstate --from tfstate://terraform_VPC.tfstate
``` ```
## Contribute ## Contribute

View File

@ -3,6 +3,17 @@
Currently, driftctl only supports reading IaC from a Terraform state. Currently, driftctl only supports reading IaC from a Terraform state.
We are investigating to support the Terraform code as well, as a state does not represent an intention. We are investigating to support the Terraform code as well, as a state does not represent an intention.
Multiple states can be read by passing `--from` flags
Example:
```shell
# I want to read a local state and a state stored in an S3 bucket :
driftctl scan \
--from tfstate+s3://statebucketdriftctl/terraform.tfstate \
--from tfstate://terraform_toto.tfstate
```
## Supported IaC sources ## Supported IaC sources
* Terraform state * Terraform state

36
mocks/Supplier.go Normal file
View File

@ -0,0 +1,36 @@
// Code generated by mockery v2.3.0. DO NOT EDIT.
package mocks
import (
resource "github.com/cloudskiff/driftctl/pkg/resource"
mock "github.com/stretchr/testify/mock"
)
// Supplier is an autogenerated mock type for the Supplier type
type Supplier struct {
mock.Mock
}
// Resources provides a mock function with given fields:
func (_m *Supplier) Resources() ([]resource.Resource, error) {
ret := _m.Called()
var r0 []resource.Resource
if rf, ok := ret.Get(0).(func() []resource.Resource); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]resource.Resource)
}
}
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}

View File

@ -26,7 +26,7 @@ import (
type ScanOptions struct { type ScanOptions struct {
Coverage bool Coverage bool
Detect bool Detect bool
From config.SupplierConfig From []config.SupplierConfig
To string To string
Output output.OutputConfig Output output.OutputConfig
Filter *jmespath.JMESPath Filter *jmespath.JMESPath
@ -41,14 +41,14 @@ func NewScanCmd() *cobra.Command {
Long: "Scan", Long: "Scan",
Args: cobra.NoArgs, Args: cobra.NoArgs,
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, args []string) error {
from, _ := cmd.Flags().GetString("from") from, _ := cmd.Flags().GetStringSlice("from")
iacSource, err := parseFromFlag(from) iacSource, err := parseFromFlag(from)
if err != nil { if err != nil {
return err return err
} }
opts.From = *iacSource opts.From = iacSource
to, _ := cmd.Flags().GetString("to") to, _ := cmd.Flags().GetString("to")
if !remote.IsSupported(to) { if !remote.IsSupported(to) {
@ -100,11 +100,11 @@ func NewScanCmd() *cobra.Command {
"Output format, by default it will write to the console\n"+ "Output format, by default it will write to the console\n"+
"Accepted formats are: "+strings.Join(output.SupportedOutputsExample(), ",")+"\n", "Accepted formats are: "+strings.Join(output.SupportedOutputsExample(), ",")+"\n",
) )
fl.StringP( fl.StringSliceP(
"from", "from",
"f", "f",
"tfstate://terraform.tfstate", []string{"tfstate://terraform.tfstate"},
"IaC source, by default try to find local terraform.tfstate file\n"+ "IaC sources, by default try to find local terraform.tfstate file\n"+
"Accepted schemes are: "+strings.Join(supplier.GetSupportedSchemes(), ",")+"\n", "Accepted schemes are: "+strings.Join(supplier.GetSupportedSchemes(), ",")+"\n",
) )
supportedRemotes := remote.GetSupportedRemotes() supportedRemotes := remote.GetSupportedRemotes()
@ -144,11 +144,6 @@ func scanRun(opts *ScanOptions) error {
if err != nil { if err != nil {
return err return err
} }
logrus.WithFields(logrus.Fields{
"supplier": opts.From.Key,
"backend": opts.From.Backend,
"path": opts.From.Path,
}).Debug("Found IAC provider")
ctl := pkg.NewDriftCTL(scanner, iacSupplier, opts.Filter, alerter) ctl := pkg.NewDriftCTL(scanner, iacSupplier, opts.Filter, alerter)
go func() { go func() {
@ -166,54 +161,60 @@ func scanRun(opts *ScanOptions) error {
return out.Write(analysis) return out.Write(analysis)
} }
func parseFromFlag(from string) (*config.SupplierConfig, error) { func parseFromFlag(from []string) ([]config.SupplierConfig, error) {
schemePath := strings.Split(from, "://") configs := make([]config.SupplierConfig, 0, len(from))
if len(schemePath) != 2 || schemePath[1] == "" || schemePath[0] == "" {
return nil, fmt.Errorf(
"Unable to parse from flag: %s\nAccepted schemes are: %s",
from,
strings.Join(supplier.GetSupportedSchemes(), ","),
)
}
scheme := schemePath[0] for _, flag := range from {
path := schemePath[1] schemePath := strings.Split(flag, "://")
supplierBackend := strings.Split(scheme, "+") if len(schemePath) != 2 || schemePath[1] == "" || schemePath[0] == "" {
if len(supplierBackend) > 2 {
return nil, fmt.Errorf(
"Unable to parse from scheme: %s\nAccepted schemes are: %s",
scheme,
strings.Join(supplier.GetSupportedSchemes(), ","),
)
}
supplierKey := supplierBackend[0]
if !supplier.IsSupplierSupported(supplierKey) {
return nil, fmt.Errorf(
"Unsupported IaC source: %s\nAccepted values are: %s",
supplierKey,
strings.Join(supplier.GetSupportedSuppliers(), ","),
)
}
backendString := ""
if len(supplierBackend) == 2 {
backendString = supplierBackend[1]
if !backend.IsSupported(backendString) {
return nil, fmt.Errorf( return nil, fmt.Errorf(
"Unsupported IaC backend: %s\nAccepted values are: %s", "Unable to parse from flag: %s\nAccepted schemes are: %s",
backendString, flag,
strings.Join(backend.GetSupportedBackends(), ","), strings.Join(supplier.GetSupportedSchemes(), ","),
) )
} }
scheme := schemePath[0]
path := schemePath[1]
supplierBackend := strings.Split(scheme, "+")
if len(supplierBackend) > 2 {
return nil, fmt.Errorf(
"Unable to parse from scheme: %s\nAccepted schemes are: %s",
scheme,
strings.Join(supplier.GetSupportedSchemes(), ","),
)
}
supplierKey := supplierBackend[0]
if !supplier.IsSupplierSupported(supplierKey) {
return nil, fmt.Errorf(
"Unsupported IaC source: %s\nAccepted values are: %s",
supplierKey,
strings.Join(supplier.GetSupportedSuppliers(), ","),
)
}
backendString := ""
if len(supplierBackend) == 2 {
backendString = supplierBackend[1]
if !backend.IsSupported(backendString) {
return nil, fmt.Errorf(
"Unsupported IaC backend: %s\nAccepted values are: %s",
backendString,
strings.Join(backend.GetSupportedBackends(), ","),
)
}
}
configs = append(configs, config.SupplierConfig{
Key: supplierKey,
Backend: backendString,
Path: path,
})
} }
return &config.SupplierConfig{ return configs, nil
Key: supplierKey,
Backend: backendString,
Path: path,
}, nil
} }
func parseOutputFlag(out string) (*output.OutputConfig, error) { func parseOutputFlag(out string) (*output.OutputConfig, error) {

View File

@ -35,6 +35,7 @@ func TestScanCmd_Valid(t *testing.T) {
{args: []string{"scan", "--to", "aws+tf"}}, {args: []string{"scan", "--to", "aws+tf"}},
{args: []string{"scan", "-f", "tfstate://test"}}, {args: []string{"scan", "-f", "tfstate://test"}},
{args: []string{"scan", "--from", "tfstate://test"}}, {args: []string{"scan", "--from", "tfstate://test"}},
{args: []string{"scan", "--from", "tfstate://test", "--from", "tfstate://test2"}},
{args: []string{"scan", "-t", "aws+tf", "-f", "tfstate://test"}}, {args: []string{"scan", "-t", "aws+tf", "-f", "tfstate://test"}},
{args: []string{"scan", "--to", "aws+tf", "--from", "tfstate://test"}}, {args: []string{"scan", "--to", "aws+tf", "--from", "tfstate://test"}},
{args: []string{"scan", "--filter", "Type=='aws_s3_bucket'"}}, {args: []string{"scan", "--filter", "Type=='aws_s3_bucket'"}},
@ -73,6 +74,7 @@ func TestScanCmd_Invalid(t *testing.T) {
{args: []string{"scan", "--from", "terraform+foo+bar://test"}, expected: "Unable to parse from scheme: terraform+foo+bar\nAccepted schemes are: tfstate://,tfstate+s3://"}, {args: []string{"scan", "--from", "terraform+foo+bar://test"}, expected: "Unable to parse from scheme: terraform+foo+bar\nAccepted schemes are: tfstate://,tfstate+s3://"},
{args: []string{"scan", "--from", "unsupported://test"}, expected: "Unsupported IaC source: unsupported\nAccepted values are: tfstate"}, {args: []string{"scan", "--from", "unsupported://test"}, expected: "Unsupported IaC source: unsupported\nAccepted values are: tfstate"},
{args: []string{"scan", "--from", "tfstate+foobar://test"}, expected: "Unsupported IaC backend: foobar\nAccepted values are: s3"}, {args: []string{"scan", "--from", "tfstate+foobar://test"}, expected: "Unsupported IaC backend: foobar\nAccepted values are: s3"},
{args: []string{"scan", "--from", "tfstate:///tmp/test", "--from", "tfstate+toto://test"}, expected: "Unsupported IaC backend: toto\nAccepted values are: s3"},
{args: []string{"scan", "--filter", "Type='test'"}, expected: "unable to parse filter expression: SyntaxError: Expected tRbracket, received: tUnknown"}, {args: []string{"scan", "--filter", "Type='test'"}, expected: "unable to parse filter expression: SyntaxError: Expected tRbracket, received: tUnknown"},
} }
@ -91,23 +93,44 @@ func TestScanCmd_Invalid(t *testing.T) {
func Test_parseFromFlag(t *testing.T) { func Test_parseFromFlag(t *testing.T) {
type args struct { type args struct {
from string from []string
} }
tests := []struct { tests := []struct {
name string name string
args args args args
want *config.SupplierConfig want []config.SupplierConfig
wantErr bool wantErr bool
}{ }{
{ {
name: "test complete from parsing", name: "test complete from parsing",
args: args{ args: args{
from: "tfstate+s3://bucket/path/to/state.tfstate", from: []string{"tfstate+s3://bucket/path/to/state.tfstate"},
}, },
want: &config.SupplierConfig{ want: []config.SupplierConfig{
Key: "tfstate", {
Backend: "s3", Key: "tfstate",
Path: "bucket/path/to/state.tfstate", Backend: "s3",
Path: "bucket/path/to/state.tfstate",
},
},
wantErr: false,
},
{
name: "test complete from parsing with multiples flags",
args: args{
from: []string{"tfstate+s3://bucket/path/to/state.tfstate", "tfstate:///tmp/my-state.tfstate"},
},
want: []config.SupplierConfig{
{
Key: "tfstate",
Backend: "s3",
Path: "bucket/path/to/state.tfstate",
},
{
Key: "tfstate",
Backend: "",
Path: "/tmp/my-state.tfstate",
},
}, },
wantErr: false, wantErr: false,
}, },

View File

@ -95,7 +95,7 @@ func (d DriftCTL) Stop() {
} }
func (d DriftCTL) scan() (remoteResources []resource.Resource, resourcesFromState []resource.Resource, err error) { func (d DriftCTL) scan() (remoteResources []resource.Resource, resourcesFromState []resource.Resource, err error) {
logrus.Info("Start reading terraform state") logrus.Info("Start reading IaC")
resourcesFromState, err = d.iacSupplier.Resources() resourcesFromState, err = d.iacSupplier.Resources()
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err

View File

@ -4,6 +4,7 @@ import (
"fmt" "fmt"
"github.com/cloudskiff/driftctl/pkg/iac/terraform/state/backend" "github.com/cloudskiff/driftctl/pkg/iac/terraform/state/backend"
"github.com/sirupsen/logrus"
"github.com/cloudskiff/driftctl/pkg/iac/config" "github.com/cloudskiff/driftctl/pkg/iac/config"
@ -25,17 +26,35 @@ func IsSupplierSupported(supplierKey string) bool {
return false return false
} }
func GetIACSupplier(config config.SupplierConfig) (resource.Supplier, error) { func GetIACSupplier(configs []config.SupplierConfig) (resource.Supplier, error) {
if !IsSupplierSupported(config.Key) { chainSupplier := resource.NewChainSupplier()
return nil, fmt.Errorf("Unsupported supplier '%s'", config.Key) for _, config := range configs {
} if !IsSupplierSupported(config.Key) {
return nil, fmt.Errorf("Unsupported supplier '%s'", config.Key)
}
switch config.Key { var supplier resource.Supplier
case state.TerraformStateReaderSupplier: var err error
return state.NewReader(config) switch config.Key {
default: case state.TerraformStateReaderSupplier:
return nil, fmt.Errorf("Unsupported supplier '%s'", config.Key) supplier, err = state.NewReader(config)
default:
return nil, fmt.Errorf("Unsupported supplier '%s'", config.Key)
}
if err != nil {
return nil, err
}
logrus.WithFields(logrus.Fields{
"supplier": config.Key,
"backend": config.Backend,
"path": config.Path,
}).Debug("Found IAC supplier")
chainSupplier.AddSupplier(supplier)
} }
return chainSupplier, nil
} }
func GetSupportedSuppliers() []string { func GetSupportedSuppliers() []string {

View File

@ -10,7 +10,7 @@ import (
func TestGetIACSupplier(t *testing.T) { func TestGetIACSupplier(t *testing.T) {
type args struct { type args struct {
config config.SupplierConfig config []config.SupplierConfig
} }
tests := []struct { tests := []struct {
name string name string
@ -20,33 +20,56 @@ func TestGetIACSupplier(t *testing.T) {
{ {
name: "test unknown supplier", name: "test unknown supplier",
args: args{ args: args{
config: struct { config: []config.SupplierConfig{
Key string {
Backend string Key: "foobar",
Path string },
}{Key: "foobar"}, },
},
wantErr: fmt.Errorf("Unsupported supplier 'foobar'"),
},
{
name: "test unknown supplier in multiples states",
args: args{
config: []config.SupplierConfig{
{
Key: "foobar",
},
{
Key: "tfstate",
Backend: "",
Path: "terraform.tfstate",
},
},
}, },
wantErr: fmt.Errorf("Unsupported supplier 'foobar'"), wantErr: fmt.Errorf("Unsupported supplier 'foobar'"),
}, },
{ {
name: "test unknown backend", name: "test unknown backend",
args: args{ args: args{
config: struct { config: []config.SupplierConfig{
Key string {Key: "tfstate", Backend: "foobar"},
Backend string },
Path string
}{Key: "tfstate", Backend: "foobar"},
}, },
wantErr: fmt.Errorf("Unsupported backend 'foobar'"), wantErr: fmt.Errorf("Unsupported backend 'foobar'"),
}, },
{ {
name: "test valid tfstate://terraform.tfstate", name: "test valid tfstate://terraform.tfstate",
args: args{ args: args{
config: struct { config: []config.SupplierConfig{
Key string {Key: "tfstate", Backend: "", Path: "terraform.tfstate"},
Backend string },
Path string },
}{Key: "tfstate", Backend: "", Path: "terraform.tfstate"}, wantErr: nil,
},
{
name: "test valid multiples states",
args: args{
config: []config.SupplierConfig{
{Key: "tfstate", Backend: "", Path: "terraform.tfstate"},
{Key: "tfstate", Backend: "s3", Path: "terraform.tfstate"},
{Key: "tfstate", Backend: "", Path: "terraform2.tfstate"},
},
}, },
wantErr: nil, wantErr: nil,
}, },

View File

@ -147,7 +147,10 @@ func (r *TerraformStateReader) decode(values map[string][]cty.Value) ([]resource
typ := deserializer.HandledType().String() typ := deserializer.HandledType().String()
vals, exists := values[typ] vals, exists := values[typ]
if !exists { if !exists {
logrus.Debugf("No resource of type %s found in state", typ) logrus.WithFields(logrus.Fields{
"path": r.config.Path,
"backend": r.config.Backend,
}).Debugf("No resource of type %s found in state", typ)
continue continue
} }
decodedResources, err := deserializer.Deserialize(vals) decodedResources, err := deserializer.Deserialize(vals)
@ -157,8 +160,10 @@ func (r *TerraformStateReader) decode(values map[string][]cty.Value) ([]resource
} }
for _, res := range decodedResources { for _, res := range decodedResources {
logrus.WithFields(logrus.Fields{ logrus.WithFields(logrus.Fields{
"id": res.TerraformId(), "path": r.config.Path,
"type": res.TerraformType(), "backend": r.config.Backend,
"id": res.TerraformId(),
"type": res.TerraformType(),
}).Debug("Found IAC resource") }).Debug("Found IAC resource")
normalisable, ok := res.(resource.NormalizedResource) normalisable, ok := res.(resource.NormalizedResource)
if ok { if ok {
@ -182,6 +187,10 @@ func (r *TerraformStateReader) decode(values map[string][]cty.Value) ([]resource
} }
func (r *TerraformStateReader) Resources() ([]resource.Resource, error) { func (r *TerraformStateReader) Resources() ([]resource.Resource, error) {
logrus.WithFields(logrus.Fields{
"path": r.config.Path,
"backend": r.config.Backend,
}).Debug("Starting state reader supplier")
values, err := r.retrieve() values, err := r.retrieve()
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -1,4 +1,4 @@
package pkg package parallel
import ( import (
"context" "context"

View File

@ -1,4 +1,4 @@
package pkg package parallel
import ( import (
"context" "context"

View File

@ -1,7 +1,7 @@
package aws package aws
import ( import (
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -21,7 +21,7 @@ type DBInstanceSupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewDBInstanceSupplier(runner *pkg.ParallelRunner, client rdsiface.RDSAPI) *DBInstanceSupplier { func NewDBInstanceSupplier(runner *parallel.ParallelRunner, client rdsiface.RDSAPI) *DBInstanceSupplier {
return &DBInstanceSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewDBInstanceDeserializer(), client, terraform.NewParallelResourceReader(runner)} return &DBInstanceSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewDBInstanceDeserializer(), client, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,11 +4,11 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/cloudskiff/driftctl/test/goldenfile" "github.com/cloudskiff/driftctl/test/goldenfile"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -94,7 +94,7 @@ func TestDBInstanceSupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
mocks.NewMockAWSRDSClient(tt.instancesPages), mocks.NewMockAWSRDSClient(tt.instancesPages),
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if tt.err != err { if tt.err != err {

View File

@ -1,7 +1,7 @@
package aws package aws
import ( import (
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource/aws" "github.com/cloudskiff/driftctl/pkg/resource/aws"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
@ -24,7 +24,7 @@ type DBSubnetGroupSupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewDBSubnetGroupSupplier(runner *pkg.ParallelRunner, client rdsiface.RDSAPI) *DBSubnetGroupSupplier { func NewDBSubnetGroupSupplier(runner *parallel.ParallelRunner, client rdsiface.RDSAPI) *DBSubnetGroupSupplier {
return &DBSubnetGroupSupplier{ return &DBSubnetGroupSupplier{
terraform.Provider(terraform.AWS), terraform.Provider(terraform.AWS),
awsdeserializer.NewDBSubnetGroupDeserializer(), awsdeserializer.NewDBSubnetGroupDeserializer(),

View File

@ -4,12 +4,11 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/cloudskiff/driftctl/test/goldenfile" "github.com/cloudskiff/driftctl/test/goldenfile"
"github.com/cloudskiff/driftctl/pkg"
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/rds" "github.com/aws/aws-sdk-go/service/rds"
@ -86,7 +85,7 @@ func TestDBSubnetGroupSupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
mocks.NewMockAWSRDSSubnetGroupClient(tt.subnets), mocks.NewMockAWSRDSSubnetGroupClient(tt.subnets),
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if tt.err != err { if tt.err != err {

View File

@ -1,7 +1,7 @@
package aws package aws
import ( import (
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -22,7 +22,7 @@ type EC2AmiSupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewEC2AmiSupplier(runner *pkg.ParallelRunner, client ec2iface.EC2API) *EC2AmiSupplier { func NewEC2AmiSupplier(runner *parallel.ParallelRunner, client ec2iface.EC2API) *EC2AmiSupplier {
return &EC2AmiSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewEC2AmiDeserializer(), client, terraform.NewParallelResourceReader(runner)} return &EC2AmiSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewEC2AmiDeserializer(), client, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,11 +4,11 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/cloudskiff/driftctl/test/goldenfile" "github.com/cloudskiff/driftctl/test/goldenfile"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -56,7 +56,7 @@ func TestEC2AmiSupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
mocks.NewMockAWSEC2AmiClient(tt.amiIDs), mocks.NewMockAWSEC2AmiClient(tt.amiIDs),
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if tt.err != err { if tt.err != err {

View File

@ -1,7 +1,7 @@
package aws package aws
import ( import (
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -22,7 +22,7 @@ type EC2EbsSnapshotSupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewEC2EbsSnapshotSupplier(runner *pkg.ParallelRunner, client ec2iface.EC2API) *EC2EbsSnapshotSupplier { func NewEC2EbsSnapshotSupplier(runner *parallel.ParallelRunner, client ec2iface.EC2API) *EC2EbsSnapshotSupplier {
return &EC2EbsSnapshotSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewEC2EbsSnapshotDeserializer(), client, terraform.NewParallelResourceReader(runner)} return &EC2EbsSnapshotSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewEC2EbsSnapshotDeserializer(), client, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,11 +4,11 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/cloudskiff/driftctl/test/goldenfile" "github.com/cloudskiff/driftctl/test/goldenfile"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -83,7 +83,7 @@ func TestEC2EbsSnapshotSupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
mocks.NewMockAWSEC2EbsSnapshotClient(tt.snapshotsPages), mocks.NewMockAWSEC2EbsSnapshotClient(tt.snapshotsPages),
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if tt.err != err { if tt.err != err {

View File

@ -1,7 +1,7 @@
package aws package aws
import ( import (
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -22,7 +22,7 @@ type EC2EbsVolumeSupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewEC2EbsVolumeSupplier(runner *pkg.ParallelRunner, client ec2iface.EC2API) *EC2EbsVolumeSupplier { func NewEC2EbsVolumeSupplier(runner *parallel.ParallelRunner, client ec2iface.EC2API) *EC2EbsVolumeSupplier {
return &EC2EbsVolumeSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewEC2EbsVolumeDeserializer(), client, terraform.NewParallelResourceReader(runner)} return &EC2EbsVolumeSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewEC2EbsVolumeDeserializer(), client, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,11 +4,11 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/cloudskiff/driftctl/test/goldenfile" "github.com/cloudskiff/driftctl/test/goldenfile"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -83,7 +83,7 @@ func TestEC2EbsVolumeSupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
mocks.NewMockAWSEC2EbsVolumeClient(tt.volumesPages), mocks.NewMockAWSEC2EbsVolumeClient(tt.volumesPages),
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if tt.err != err { if tt.err != err {

View File

@ -1,7 +1,7 @@
package aws package aws
import ( import (
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -21,7 +21,7 @@ type EC2EipAssociationSupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewEC2EipAssociationSupplier(runner *pkg.ParallelRunner, client ec2iface.EC2API) *EC2EipAssociationSupplier { func NewEC2EipAssociationSupplier(runner *parallel.ParallelRunner, client ec2iface.EC2API) *EC2EipAssociationSupplier {
return &EC2EipAssociationSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewEC2EipAssociationDeserializer(), client, terraform.NewParallelResourceReader(runner)} return &EC2EipAssociationSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewEC2EipAssociationDeserializer(), client, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,11 +4,11 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/cloudskiff/driftctl/test/goldenfile" "github.com/cloudskiff/driftctl/test/goldenfile"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -61,7 +61,7 @@ func TestEC2EipAssociationSupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
mocks.NewMockAWSEC2EipClient(tt.addresses), mocks.NewMockAWSEC2EipClient(tt.addresses),
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if tt.err != err { if tt.err != err {

View File

@ -1,7 +1,7 @@
package aws package aws
import ( import (
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -22,7 +22,7 @@ type EC2EipSupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewEC2EipSupplier(runner *pkg.ParallelRunner, client ec2iface.EC2API) *EC2EipSupplier { func NewEC2EipSupplier(runner *parallel.ParallelRunner, client ec2iface.EC2API) *EC2EipSupplier {
return &EC2EipSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewEC2EipDeserializer(), client, terraform.NewParallelResourceReader(runner)} return &EC2EipSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewEC2EipDeserializer(), client, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,11 +4,11 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/cloudskiff/driftctl/test/goldenfile" "github.com/cloudskiff/driftctl/test/goldenfile"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -64,7 +64,7 @@ func TestEC2EipSupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
mocks.NewMockAWSEC2EipClient(tt.addresses), mocks.NewMockAWSEC2EipClient(tt.addresses),
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if tt.err != err { if tt.err != err {

View File

@ -1,7 +1,7 @@
package aws package aws
import ( import (
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -22,7 +22,7 @@ type EC2InstanceSupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewEC2InstanceSupplier(runner *pkg.ParallelRunner, client ec2iface.EC2API) *EC2InstanceSupplier { func NewEC2InstanceSupplier(runner *parallel.ParallelRunner, client ec2iface.EC2API) *EC2InstanceSupplier {
return &EC2InstanceSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewEC2InstanceDeserializer(), client, terraform.NewParallelResourceReader(runner)} return &EC2InstanceSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewEC2InstanceDeserializer(), client, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,11 +4,11 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/cloudskiff/driftctl/test/goldenfile" "github.com/cloudskiff/driftctl/test/goldenfile"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -115,7 +115,7 @@ func TestEC2InstanceSupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
mocks.NewMockAWSEC2InstanceClient(tt.instancesPages), mocks.NewMockAWSEC2InstanceClient(tt.instancesPages),
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if tt.err != err { if tt.err != err {

View File

@ -1,7 +1,7 @@
package aws package aws
import ( import (
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -22,7 +22,7 @@ type EC2KeyPairSupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewEC2KeyPairSupplier(runner *pkg.ParallelRunner, client ec2iface.EC2API) *EC2KeyPairSupplier { func NewEC2KeyPairSupplier(runner *parallel.ParallelRunner, client ec2iface.EC2API) *EC2KeyPairSupplier {
return &EC2KeyPairSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewEC2KeyPairDeserializer(), client, terraform.NewParallelResourceReader(runner)} return &EC2KeyPairSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewEC2KeyPairDeserializer(), client, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/cloudskiff/driftctl/test/goldenfile" "github.com/cloudskiff/driftctl/test/goldenfile"
@ -12,7 +13,6 @@ import (
"github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/awsutil"
"github.com/r3labs/diff/v2" "github.com/r3labs/diff/v2"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
@ -61,7 +61,7 @@ func TestEC2KeyPairSupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
mocks.NewMockAWSEC2KeyPairClient(tt.kpNames), mocks.NewMockAWSEC2KeyPairClient(tt.kpNames),
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if tt.err != err { if tt.err != err {

View File

@ -3,7 +3,7 @@ package aws
import ( import (
"github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam"
"github.com/aws/aws-sdk-go/service/iam/iamiface" "github.com/aws/aws-sdk-go/service/iam/iamiface"
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -21,7 +21,7 @@ type IamAccessKeySupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewIamAccessKeySupplier(runner *pkg.ParallelRunner, client iamiface.IAMAPI) *IamAccessKeySupplier { func NewIamAccessKeySupplier(runner *parallel.ParallelRunner, client iamiface.IAMAPI) *IamAccessKeySupplier {
return &IamAccessKeySupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewIamAccessKeyDeserializer(), client, terraform.NewParallelResourceReader(runner)} return &IamAccessKeySupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewIamAccessKeyDeserializer(), client, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/cloudskiff/driftctl/test/goldenfile" "github.com/cloudskiff/driftctl/test/goldenfile"
@ -17,7 +18,6 @@ import (
"github.com/cloudskiff/driftctl/mocks" "github.com/cloudskiff/driftctl/mocks"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -130,7 +130,7 @@ func TestIamAccessKeySupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
&fakeIam, &fakeIam,
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if c.err != err { if c.err != err {

View File

@ -4,7 +4,7 @@ import (
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam"
"github.com/aws/aws-sdk-go/service/iam/iamiface" "github.com/aws/aws-sdk-go/service/iam/iamiface"
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -22,7 +22,7 @@ type IamPolicySupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewIamPolicySupplier(runner *pkg.ParallelRunner, client iamiface.IAMAPI) *IamPolicySupplier { func NewIamPolicySupplier(runner *parallel.ParallelRunner, client iamiface.IAMAPI) *IamPolicySupplier {
return &IamPolicySupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewIamPolicyDeserializer(), client, terraform.NewParallelResourceReader(runner)} return &IamPolicySupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewIamPolicyDeserializer(), client, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
@ -14,7 +15,6 @@ import (
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"
"github.com/cloudskiff/driftctl/mocks" "github.com/cloudskiff/driftctl/mocks"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -89,7 +89,7 @@ func TestIamPolicySupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
&fakeIam, &fakeIam,
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if c.err != err { if c.err != err {

View File

@ -3,7 +3,7 @@ package aws
import ( import (
"github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam"
"github.com/aws/aws-sdk-go/service/iam/iamiface" "github.com/aws/aws-sdk-go/service/iam/iamiface"
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -21,7 +21,7 @@ type IamRolePolicyAttachmentSupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewIamRolePolicyAttachmentSupplier(runner *pkg.ParallelRunner, client iamiface.IAMAPI) *IamRolePolicyAttachmentSupplier { func NewIamRolePolicyAttachmentSupplier(runner *parallel.ParallelRunner, client iamiface.IAMAPI) *IamRolePolicyAttachmentSupplier {
return &IamRolePolicyAttachmentSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewIamRolePolicyAttachmentDeserializer(), client, terraform.NewParallelResourceReader(runner)} return &IamRolePolicyAttachmentSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewIamRolePolicyAttachmentDeserializer(), client, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
@ -16,7 +17,6 @@ import (
"github.com/cloudskiff/driftctl/mocks" "github.com/cloudskiff/driftctl/mocks"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -155,7 +155,7 @@ func TestIamRolePolicyAttachmentSupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
&fakeIam, &fakeIam,
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 1)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 1)),
} }
got, err := s.Resources() got, err := s.Resources()
if c.err != err { if c.err != err {

View File

@ -3,11 +3,11 @@ package aws
import ( import (
"fmt" "fmt"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam"
"github.com/aws/aws-sdk-go/service/iam/iamiface" "github.com/aws/aws-sdk-go/service/iam/iamiface"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -24,7 +24,7 @@ type IamRolePolicySupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewIamRolePolicySupplier(runner *pkg.ParallelRunner, client iamiface.IAMAPI) *IamRolePolicySupplier { func NewIamRolePolicySupplier(runner *parallel.ParallelRunner, client iamiface.IAMAPI) *IamRolePolicySupplier {
return &IamRolePolicySupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewIamRolePolicyDeserializer(), client, terraform.NewParallelResourceReader(runner)} return &IamRolePolicySupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewIamRolePolicyDeserializer(), client, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
@ -16,7 +17,6 @@ import (
"github.com/cloudskiff/driftctl/mocks" "github.com/cloudskiff/driftctl/mocks"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -146,7 +146,7 @@ func TestIamRolePolicySupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
&fakeIam, &fakeIam,
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if c.err != err { if c.err != err {

View File

@ -3,7 +3,7 @@ package aws
import ( import (
"github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam"
"github.com/aws/aws-sdk-go/service/iam/iamiface" "github.com/aws/aws-sdk-go/service/iam/iamiface"
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -30,7 +30,7 @@ type IamRoleSupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewIamRoleSupplier(runner *pkg.ParallelRunner, client iamiface.IAMAPI) *IamRoleSupplier { func NewIamRoleSupplier(runner *parallel.ParallelRunner, client iamiface.IAMAPI) *IamRoleSupplier {
return &IamRoleSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewIamRoleDeserializer(), client, terraform.NewParallelResourceReader(runner)} return &IamRoleSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewIamRoleDeserializer(), client, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
@ -14,7 +15,6 @@ import (
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"
"github.com/cloudskiff/driftctl/mocks" "github.com/cloudskiff/driftctl/mocks"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -108,7 +108,7 @@ func TestIamRoleSupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
&fakeIam, &fakeIam,
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if c.err != err { if c.err != err {

View File

@ -3,7 +3,7 @@ package aws
import ( import (
"github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam"
"github.com/aws/aws-sdk-go/service/iam/iamiface" "github.com/aws/aws-sdk-go/service/iam/iamiface"
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -21,7 +21,7 @@ type IamUserPolicyAttachmentSupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewIamUserPolicyAttachmentSupplier(runner *pkg.ParallelRunner, client iamiface.IAMAPI) *IamUserPolicyAttachmentSupplier { func NewIamUserPolicyAttachmentSupplier(runner *parallel.ParallelRunner, client iamiface.IAMAPI) *IamUserPolicyAttachmentSupplier {
return &IamUserPolicyAttachmentSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewIamUserPolicyAttachmentDeserializer(), client, terraform.NewParallelResourceReader(runner)} return &IamUserPolicyAttachmentSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewIamUserPolicyAttachmentDeserializer(), client, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
@ -16,7 +17,6 @@ import (
"github.com/cloudskiff/driftctl/mocks" "github.com/cloudskiff/driftctl/mocks"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -171,7 +171,7 @@ func TestIamUserPolicyAttachmentSupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
&fakeIam, &fakeIam,
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 1)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 1)),
} }
got, err := s.Resources() got, err := s.Resources()
if c.err != err { if c.err != err {

View File

@ -3,11 +3,11 @@ package aws
import ( import (
"fmt" "fmt"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam"
"github.com/aws/aws-sdk-go/service/iam/iamiface" "github.com/aws/aws-sdk-go/service/iam/iamiface"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -24,7 +24,7 @@ type IamUserPolicySupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewIamUserPolicySupplier(runner *pkg.ParallelRunner, client iamiface.IAMAPI) *IamUserPolicySupplier { func NewIamUserPolicySupplier(runner *parallel.ParallelRunner, client iamiface.IAMAPI) *IamUserPolicySupplier {
return &IamUserPolicySupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewIamUserPolicyDeserializer(), client, terraform.NewParallelResourceReader(runner)} return &IamUserPolicySupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewIamUserPolicyDeserializer(), client, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
@ -16,7 +17,6 @@ import (
"github.com/cloudskiff/driftctl/mocks" "github.com/cloudskiff/driftctl/mocks"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -152,7 +152,7 @@ func TestIamUserPolicySupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
&fakeIam, &fakeIam,
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if c.err != err { if c.err != err {

View File

@ -3,7 +3,7 @@ package aws
import ( import (
"github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam"
"github.com/aws/aws-sdk-go/service/iam/iamiface" "github.com/aws/aws-sdk-go/service/iam/iamiface"
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -21,7 +21,7 @@ type IamUserSupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewIamUserSupplier(runner *pkg.ParallelRunner, client iamiface.IAMAPI) *IamUserSupplier { func NewIamUserSupplier(runner *parallel.ParallelRunner, client iamiface.IAMAPI) *IamUserSupplier {
return &IamUserSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewIamUserDeserializer(), client, terraform.NewParallelResourceReader(runner)} return &IamUserSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewIamUserDeserializer(), client, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/cloudskiff/driftctl/test/goldenfile" "github.com/cloudskiff/driftctl/test/goldenfile"
@ -17,7 +18,6 @@ import (
"github.com/cloudskiff/driftctl/mocks" "github.com/cloudskiff/driftctl/mocks"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -87,7 +87,7 @@ func TestIamUserSupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
&fakeIam, &fakeIam,
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if c.err != err { if c.err != err {

View File

@ -1,7 +1,7 @@
package aws package aws
import ( import (
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -21,7 +21,7 @@ type LambdaFunctionSupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewLambdaFunctionSupplier(runner *pkg.ParallelRunner, client lambdaiface.LambdaAPI) *LambdaFunctionSupplier { func NewLambdaFunctionSupplier(runner *parallel.ParallelRunner, client lambdaiface.LambdaAPI) *LambdaFunctionSupplier {
return &LambdaFunctionSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewLambdaFunctionDeserializer(), client, terraform.NewParallelResourceReader(runner)} return &LambdaFunctionSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewLambdaFunctionDeserializer(), client, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,11 +4,11 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/cloudskiff/driftctl/test/goldenfile" "github.com/cloudskiff/driftctl/test/goldenfile"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -100,7 +100,7 @@ func TestLambdaFunctionSupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
mocks.NewMockAWSLambdaClient(tt.functionsPages), mocks.NewMockAWSLambdaClient(tt.functionsPages),
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if tt.err != err { if tt.err != err {

View File

@ -3,11 +3,11 @@ package aws
import ( import (
"strings" "strings"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
@ -26,7 +26,7 @@ type Route53RecordSupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewRoute53RecordSupplier(runner *pkg.ParallelRunner, client route53iface.Route53API) *Route53RecordSupplier { func NewRoute53RecordSupplier(runner *parallel.ParallelRunner, client route53iface.Route53API) *Route53RecordSupplier {
return &Route53RecordSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewRoute53RecordDeserializer(), client, terraform.NewParallelResourceReader(runner)} return &Route53RecordSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewRoute53RecordDeserializer(), client, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,13 +4,13 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/cloudskiff/driftctl/test/goldenfile" "github.com/cloudskiff/driftctl/test/goldenfile"
awssdk "github.com/aws/aws-sdk-go/aws" awssdk "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/route53" "github.com/aws/aws-sdk-go/service/route53"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -197,7 +197,7 @@ func TestRoute53RecordSupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
mocks.NewMockAWSRoute53RecordClient(tt.zonesPages, tt.recordsPages), mocks.NewMockAWSRoute53RecordClient(tt.zonesPages, tt.recordsPages),
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if tt.err != err { if tt.err != err {

View File

@ -3,7 +3,7 @@ package aws
import ( import (
"strings" "strings"
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -23,7 +23,7 @@ type Route53ZoneSupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewRoute53ZoneSupplier(runner *pkg.ParallelRunner, client route53iface.Route53API) *Route53ZoneSupplier { func NewRoute53ZoneSupplier(runner *parallel.ParallelRunner, client route53iface.Route53API) *Route53ZoneSupplier {
return &Route53ZoneSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewRoute53ZoneDeserializer(), client, terraform.NewParallelResourceReader(runner)} return &Route53ZoneSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewRoute53ZoneDeserializer(), client, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,11 +4,11 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/cloudskiff/driftctl/test/goldenfile" "github.com/cloudskiff/driftctl/test/goldenfile"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -108,7 +108,7 @@ func TestRoute53ZoneSupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
mocks.NewMockAWSRoute53ZoneClient(tt.zonesPages), mocks.NewMockAWSRoute53ZoneClient(tt.zonesPages),
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if tt.err != err { if tt.err != err {

View File

@ -3,7 +3,7 @@ package aws
import ( import (
"github.com/aws/aws-sdk-go/service/ec2" "github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/ec2/ec2iface" "github.com/aws/aws-sdk-go/service/ec2/ec2iface"
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/resource/aws" "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -21,7 +21,7 @@ type RouteSupplier struct {
routeRunner *terraform.ParallelResourceReader routeRunner *terraform.ParallelResourceReader
} }
func NewRouteSupplier(runner *pkg.ParallelRunner, client ec2iface.EC2API) *RouteSupplier { func NewRouteSupplier(runner *parallel.ParallelRunner, client ec2iface.EC2API) *RouteSupplier {
return &RouteSupplier{ return &RouteSupplier{
terraform.Provider(terraform.AWS), terraform.Provider(terraform.AWS),
awsdeserializer.NewRouteDeserializer(), awsdeserializer.NewRouteDeserializer(),

View File

@ -7,7 +7,7 @@ import (
awssdk "github.com/aws/aws-sdk-go/aws" awssdk "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2" "github.com/aws/aws-sdk-go/service/ec2"
"github.com/cloudskiff/driftctl/mocks" "github.com/cloudskiff/driftctl/mocks"
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
@ -148,7 +148,7 @@ func TestRouteSupplier_Resources(t *testing.T) {
provider, provider,
routeDeserializer, routeDeserializer,
&fakeEC2, &fakeEC2,
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if c.err != err { if c.err != err {

View File

@ -5,7 +5,7 @@ import (
"github.com/aws/aws-sdk-go/service/ec2" "github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/ec2/ec2iface" "github.com/aws/aws-sdk-go/service/ec2/ec2iface"
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/resource/aws" "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -25,7 +25,7 @@ type RouteTableSupplier struct {
routeTableRunner *terraform.ParallelResourceReader routeTableRunner *terraform.ParallelResourceReader
} }
func NewRouteTableSupplier(runner *pkg.ParallelRunner, client ec2iface.EC2API) *RouteTableSupplier { func NewRouteTableSupplier(runner *parallel.ParallelRunner, client ec2iface.EC2API) *RouteTableSupplier {
return &RouteTableSupplier{ return &RouteTableSupplier{
terraform.Provider(terraform.AWS), terraform.Provider(terraform.AWS),
awsdeserializer.NewDefaultRouteTableDeserializer(), awsdeserializer.NewDefaultRouteTableDeserializer(),

View File

@ -8,7 +8,7 @@ import (
awssdk "github.com/aws/aws-sdk-go/aws" awssdk "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2" "github.com/aws/aws-sdk-go/service/ec2"
"github.com/cloudskiff/driftctl/mocks" "github.com/cloudskiff/driftctl/mocks"
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
@ -101,8 +101,8 @@ func TestRouteTableSupplier_Resources(t *testing.T) {
defaultRouteTableDeserializer, defaultRouteTableDeserializer,
routeTableDeserializer, routeTableDeserializer,
&fakeEC2, &fakeEC2,
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if c.err != err { if c.err != err {

View File

@ -3,12 +3,12 @@ package aws
import ( import (
"fmt" "fmt"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
awssdk "github.com/aws/aws-sdk-go/aws" awssdk "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/s3" "github.com/aws/aws-sdk-go/service/s3"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/resource/aws" "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -24,7 +24,7 @@ type S3BucketAnalyticSupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewS3BucketAnalyticSupplier(runner *pkg.ParallelRunner, factory AwsClientFactoryInterface) *S3BucketAnalyticSupplier { func NewS3BucketAnalyticSupplier(runner *parallel.ParallelRunner, factory AwsClientFactoryInterface) *S3BucketAnalyticSupplier {
return &S3BucketAnalyticSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewS3BucketAnalyticDeserializer(), factory, terraform.NewParallelResourceReader(runner)} return &S3BucketAnalyticSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewS3BucketAnalyticDeserializer(), factory, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,11 +4,11 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/cloudskiff/driftctl/test/goldenfile" "github.com/cloudskiff/driftctl/test/goldenfile"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -79,7 +79,7 @@ func TestS3BucketAnalyticSupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
factory, factory,
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if (err != nil) != tt.wantErr { if (err != nil) != tt.wantErr {

View File

@ -3,12 +3,12 @@ package aws
import ( import (
"fmt" "fmt"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
awssdk "github.com/aws/aws-sdk-go/aws" awssdk "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/s3" "github.com/aws/aws-sdk-go/service/s3"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/resource/aws" "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -24,7 +24,7 @@ type S3BucketInventorySupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewS3BucketInventorySupplier(runner *pkg.ParallelRunner, factory AwsClientFactoryInterface) *S3BucketInventorySupplier { func NewS3BucketInventorySupplier(runner *parallel.ParallelRunner, factory AwsClientFactoryInterface) *S3BucketInventorySupplier {
return &S3BucketInventorySupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewS3BucketInventoryDeserializer(), factory, terraform.NewParallelResourceReader(runner)} return &S3BucketInventorySupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewS3BucketInventoryDeserializer(), factory, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,11 +4,11 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/cloudskiff/driftctl/test/goldenfile" "github.com/cloudskiff/driftctl/test/goldenfile"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -79,7 +79,7 @@ func TestS3BucketInventorySupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
factory, factory,
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if (err != nil) != tt.wantErr { if (err != nil) != tt.wantErr {

View File

@ -4,11 +4,11 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/cloudskiff/driftctl/test/goldenfile" "github.com/cloudskiff/driftctl/test/goldenfile"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -79,7 +79,7 @@ func TestS3BucketMetricSupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
factory, factory,
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if (err != nil) != tt.wantErr { if (err != nil) != tt.wantErr {

View File

@ -3,12 +3,12 @@ package aws
import ( import (
"fmt" "fmt"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
awssdk "github.com/aws/aws-sdk-go/aws" awssdk "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/s3" "github.com/aws/aws-sdk-go/service/s3"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/resource/aws" "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -24,7 +24,7 @@ type S3BucketMetricSupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewS3BucketMetricSupplier(runner *pkg.ParallelRunner, factory AwsClientFactoryInterface) *S3BucketMetricSupplier { func NewS3BucketMetricSupplier(runner *parallel.ParallelRunner, factory AwsClientFactoryInterface) *S3BucketMetricSupplier {
return &S3BucketMetricSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewS3BucketMetricDeserializer(), factory, terraform.NewParallelResourceReader(runner)} return &S3BucketMetricSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewS3BucketMetricDeserializer(), factory, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -2,7 +2,7 @@ package aws
import ( import (
"github.com/aws/aws-sdk-go/service/s3" "github.com/aws/aws-sdk-go/service/s3"
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/resource/aws" "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -18,7 +18,7 @@ type S3BucketNotificationSupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewS3BucketNotificationSupplier(runner *pkg.ParallelRunner, factory AwsClientFactoryInterface) *S3BucketNotificationSupplier { func NewS3BucketNotificationSupplier(runner *parallel.ParallelRunner, factory AwsClientFactoryInterface) *S3BucketNotificationSupplier {
return &S3BucketNotificationSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewS3BucketNotificationDeserializer(), factory, terraform.NewParallelResourceReader(runner)} return &S3BucketNotificationSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewS3BucketNotificationDeserializer(), factory, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,11 +4,11 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/cloudskiff/driftctl/test/goldenfile" "github.com/cloudskiff/driftctl/test/goldenfile"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -75,7 +75,7 @@ func TestS3BucketNotificationSupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
factory, factory,
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if (err != nil) != tt.wantErr { if (err != nil) != tt.wantErr {

View File

@ -2,7 +2,7 @@ package aws
import ( import (
"github.com/aws/aws-sdk-go/service/s3" "github.com/aws/aws-sdk-go/service/s3"
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/resource/aws" "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -18,7 +18,7 @@ type S3BucketPolicySupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewS3BucketPolicySupplier(runner *pkg.ParallelRunner, factory AwsClientFactoryInterface) *S3BucketPolicySupplier { func NewS3BucketPolicySupplier(runner *parallel.ParallelRunner, factory AwsClientFactoryInterface) *S3BucketPolicySupplier {
return &S3BucketPolicySupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewS3BucketPolicyDeserializer(), factory, terraform.NewParallelResourceReader(runner)} return &S3BucketPolicySupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewS3BucketPolicyDeserializer(), factory, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,11 +4,11 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/cloudskiff/driftctl/test/goldenfile" "github.com/cloudskiff/driftctl/test/goldenfile"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -75,7 +75,7 @@ func TestS3BucketPolicySupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
factory, factory,
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if (err != nil) != tt.wantErr { if (err != nil) != tt.wantErr {

View File

@ -4,7 +4,7 @@ import (
"github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/s3" "github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3iface" "github.com/aws/aws-sdk-go/service/s3/s3iface"
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/resource/aws" "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -22,7 +22,7 @@ type S3BucketSupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewS3BucketSupplier(runner *pkg.ParallelRunner, factory AwsClientFactoryInterface) *S3BucketSupplier { func NewS3BucketSupplier(runner *parallel.ParallelRunner, factory AwsClientFactoryInterface) *S3BucketSupplier {
return &S3BucketSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewS3BucketDeserializer(), factory, terraform.NewParallelResourceReader(runner)} return &S3BucketSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewS3BucketDeserializer(), factory, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,11 +4,11 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/cloudskiff/driftctl/test/goldenfile" "github.com/cloudskiff/driftctl/test/goldenfile"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -63,7 +63,7 @@ func TestS3BucketSupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
factory, factory,
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if (err != nil) != tt.wantErr { if (err != nil) != tt.wantErr {

View File

@ -3,7 +3,7 @@ package aws
import ( import (
"github.com/aws/aws-sdk-go/service/ec2" "github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/ec2/ec2iface" "github.com/aws/aws-sdk-go/service/ec2/ec2iface"
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource/aws" "github.com/cloudskiff/driftctl/pkg/resource/aws"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
@ -24,7 +24,7 @@ type SubnetSupplier struct {
subnetRunner *terraform.ParallelResourceReader subnetRunner *terraform.ParallelResourceReader
} }
func NewSubnetSupplier(runner *pkg.ParallelRunner, client ec2iface.EC2API) *SubnetSupplier { func NewSubnetSupplier(runner *parallel.ParallelRunner, client ec2iface.EC2API) *SubnetSupplier {
return &SubnetSupplier{ return &SubnetSupplier{
terraform.Provider(terraform.AWS), terraform.Provider(terraform.AWS),
awsdeserializer.NewDefaultSubnetDeserializer(), awsdeserializer.NewDefaultSubnetDeserializer(),

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
@ -17,7 +18,6 @@ import (
"github.com/cloudskiff/driftctl/mocks" "github.com/cloudskiff/driftctl/mocks"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -111,8 +111,8 @@ func TestSubnetSupplier_Resources(t *testing.T) {
defaultSubnetDeserializer, defaultSubnetDeserializer,
SubnetDeserializer, SubnetDeserializer,
&fakeEC2, &fakeEC2,
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if c.err != err { if c.err != err {

View File

@ -9,7 +9,7 @@ import (
"syscall" "syscall"
"time" "time"
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
tf "github.com/cloudskiff/driftctl/pkg/terraform" tf "github.com/cloudskiff/driftctl/pkg/terraform"
@ -61,7 +61,7 @@ type TerraformProvider struct {
grpcProviders map[string]*plugin.GRPCProvider grpcProviders map[string]*plugin.GRPCProvider
schemas map[string]providers.Schema schemas map[string]providers.Schema
defaultRegion string defaultRegion string
runner *pkg.ParallelRunner runner *parallel.ParallelRunner
} }
func NewTerraFormProvider() (*TerraformProvider, error) { func NewTerraFormProvider() (*TerraformProvider, error) {
@ -71,7 +71,7 @@ func NewTerraFormProvider() (*TerraformProvider, error) {
} }
p := TerraformProvider{ p := TerraformProvider{
providerSupplier: provider, providerSupplier: provider,
runner: pkg.NewParallelRunner(context.TODO(), 10), runner: parallel.NewParallelRunner(context.TODO(), 10),
grpcProviders: make(map[string]*plugin.GRPCProvider), grpcProviders: make(map[string]*plugin.GRPCProvider),
} }
p.initSession() p.initSession()
@ -104,7 +104,7 @@ func (p *TerraformProvider) Schema() map[string]providers.Schema {
return p.schemas return p.schemas
} }
func (p *TerraformProvider) Runner() *pkg.ParallelRunner { func (p *TerraformProvider) Runner() *parallel.ParallelRunner {
return p.runner return p.runner
} }

View File

@ -1,7 +1,7 @@
package aws package aws
import ( import (
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -28,7 +28,7 @@ type VPCSecurityGroupRuleSupplier struct {
runner *terraform.ParallelResourceReader runner *terraform.ParallelResourceReader
} }
func NewVPCSecurityGroupRuleSupplier(runner *pkg.ParallelRunner, client ec2iface.EC2API) *VPCSecurityGroupRuleSupplier { func NewVPCSecurityGroupRuleSupplier(runner *parallel.ParallelRunner, client ec2iface.EC2API) *VPCSecurityGroupRuleSupplier {
return &VPCSecurityGroupRuleSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewVPCSecurityGroupRuleDeserializer(), client, terraform.NewParallelResourceReader(runner)} return &VPCSecurityGroupRuleSupplier{terraform.Provider(terraform.AWS), awsdeserializer.NewVPCSecurityGroupRuleDeserializer(), client, terraform.NewParallelResourceReader(runner)}
} }

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/aws/aws-sdk-go/service/ec2" "github.com/aws/aws-sdk-go/service/ec2"
@ -16,7 +17,6 @@ import (
"github.com/cloudskiff/driftctl/mocks" "github.com/cloudskiff/driftctl/mocks"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -235,7 +235,7 @@ func TestVPCSecurityGroupRuleSupplier_Resources(t *testing.T) {
provider, provider,
deserializer, deserializer,
&fakeEC2, &fakeEC2,
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if c.err != err { if c.err != err {

View File

@ -1,7 +1,7 @@
package aws package aws
import ( import (
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws"
@ -24,7 +24,7 @@ type VPCSecurityGroupSupplier struct {
securityGroupRunner *terraform.ParallelResourceReader securityGroupRunner *terraform.ParallelResourceReader
} }
func NewVPCSecurityGroupSupplier(runner *pkg.ParallelRunner, client ec2iface.EC2API) *VPCSecurityGroupSupplier { func NewVPCSecurityGroupSupplier(runner *parallel.ParallelRunner, client ec2iface.EC2API) *VPCSecurityGroupSupplier {
return &VPCSecurityGroupSupplier{ return &VPCSecurityGroupSupplier{
terraform.Provider(terraform.AWS), terraform.Provider(terraform.AWS),
awsdeserializer.NewDefaultSecurityGroupDeserializer(), awsdeserializer.NewDefaultSecurityGroupDeserializer(),

View File

@ -4,23 +4,18 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/stretchr/testify/mock"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/cloudskiff/driftctl/mocks"
"github.com/cloudskiff/driftctl/test/goldenfile"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test"
mocks2 "github.com/cloudskiff/driftctl/test/mocks"
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2" "github.com/aws/aws-sdk-go/service/ec2"
"github.com/cloudskiff/driftctl/mocks"
"github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
"github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test"
"github.com/cloudskiff/driftctl/test/goldenfile"
mocks2 "github.com/cloudskiff/driftctl/test/mocks"
"github.com/stretchr/testify/mock"
) )
func TestVPCSecurityGroupSupplier_Resources(t *testing.T) { func TestVPCSecurityGroupSupplier_Resources(t *testing.T) {
@ -91,8 +86,8 @@ func TestVPCSecurityGroupSupplier_Resources(t *testing.T) {
defaultSecurityGroupDeserializer, defaultSecurityGroupDeserializer,
securityGroupDeserializer, securityGroupDeserializer,
&fakeEC2, &fakeEC2,
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if tt.err != err { if tt.err != err {

View File

@ -3,7 +3,7 @@ package aws
import ( import (
"github.com/aws/aws-sdk-go/service/ec2" "github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/ec2/ec2iface" "github.com/aws/aws-sdk-go/service/ec2/ec2iface"
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
"github.com/cloudskiff/driftctl/pkg/resource/aws" "github.com/cloudskiff/driftctl/pkg/resource/aws"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
@ -24,7 +24,7 @@ type VPCSupplier struct {
vpcRunner *terraform.ParallelResourceReader vpcRunner *terraform.ParallelResourceReader
} }
func NewVPCSupplier(runner *pkg.ParallelRunner, client ec2iface.EC2API) *VPCSupplier { func NewVPCSupplier(runner *parallel.ParallelRunner, client ec2iface.EC2API) *VPCSupplier {
return &VPCSupplier{ return &VPCSupplier{
terraform.Provider(terraform.AWS), terraform.Provider(terraform.AWS),
awsdeserializer.NewDefaultVPCDeserializer(), awsdeserializer.NewDefaultVPCDeserializer(),

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/cloudskiff/driftctl/pkg/remote/deserializer" "github.com/cloudskiff/driftctl/pkg/remote/deserializer"
awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer"
@ -17,7 +18,6 @@ import (
"github.com/cloudskiff/driftctl/mocks" "github.com/cloudskiff/driftctl/mocks"
"github.com/cloudskiff/driftctl/pkg"
"github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource"
"github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/pkg/terraform"
"github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test"
@ -102,8 +102,8 @@ func TestVPCSupplier_Resources(t *testing.T) {
defaultVPCDeserializer, defaultVPCDeserializer,
VPCDeserializer, VPCDeserializer,
&fakeEC2, &fakeEC2,
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
terraform.NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)), terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)),
} }
got, err := s.Resources() got, err := s.Resources()
if c.err != err { if c.err != err {

View File

@ -0,0 +1,57 @@
package resource
import (
"context"
"runtime"
"github.com/cloudskiff/driftctl/pkg/parallel"
)
type ChainSupplier struct {
suppliers []Supplier
runner *parallel.ParallelRunner
}
func NewChainSupplier() *ChainSupplier {
return &ChainSupplier{
runner: parallel.NewParallelRunner(context.TODO(), int64(runtime.NumCPU())),
}
}
func (r *ChainSupplier) AddSupplier(supplier Supplier) {
r.suppliers = append(r.suppliers, supplier)
}
func (r *ChainSupplier) Resources() ([]Resource, error) {
for _, supplier := range r.suppliers {
sup := supplier
r.runner.Run(func() (interface{}, error) {
return sup.Resources()
})
}
results := make([]Resource, 0)
ReadLoop:
for {
select {
case supplierResult, ok := <-r.runner.Read():
if !ok || supplierResult == nil {
break ReadLoop
}
// Type cannot be invalid as return type is enforced
// by Supplier interface
resources, _ := supplierResult.([]Resource)
results = append(results, resources...)
case <-r.runner.DoneChan():
break ReadLoop
}
}
if r.runner.Err() != nil {
return nil, r.runner.Err()
}
return results, nil
}

View File

@ -0,0 +1,91 @@
package resource_test
import (
"errors"
"testing"
"github.com/cloudskiff/driftctl/mocks"
"github.com/cloudskiff/driftctl/pkg/resource"
testresource "github.com/cloudskiff/driftctl/test/resource"
"github.com/stretchr/testify/assert"
)
func TestChainSupplier_Resources(t *testing.T) {
assert := assert.New(t)
fakeTestSupplier := mocks.Supplier{}
fakeTestSupplier.On("Resources").Return(
[]resource.Resource{
testresource.FakeResource{
Id: "fake-supplier-1_fake-resource-1",
},
testresource.FakeResource{
Id: "fake-supplier-1_fake-resource-2",
},
},
nil,
).Once()
anotherFakeTestSupplier := mocks.Supplier{}
anotherFakeTestSupplier.On("Resources").Return(
[]resource.Resource{
testresource.FakeResource{
Id: "fake-supplier-2_fake-resource-1",
},
testresource.FakeResource{
Id: "fake-supplier-2_fake-resource-2",
},
},
nil,
).Once()
chain := resource.NewChainSupplier()
chain.AddSupplier(&fakeTestSupplier)
chain.AddSupplier(&anotherFakeTestSupplier)
res, err := chain.Resources()
if err != nil {
t.Fatal(err)
}
anotherFakeTestSupplier.AssertExpectations(t)
fakeTestSupplier.AssertExpectations(t)
assert.Len(res, 4)
}
func TestChainSupplier_Resources_WithError(t *testing.T) {
assert := assert.New(t)
fakeTestSupplier := mocks.Supplier{}
fakeTestSupplier.
On("Resources").
Return([]resource.Resource{
testresource.FakeResource{
Id: "fake-supplier-1_fake-resource-1",
},
testresource.FakeResource{
Id: "fake-supplier-1_fake-resource-2",
},
},
nil,
)
anotherFakeTestSupplier := mocks.Supplier{}
anotherFakeTestSupplier.
On("Resources").
Return(nil, errors.New("error from another supplier")).
Once()
chain := resource.NewChainSupplier()
chain.AddSupplier(&fakeTestSupplier)
chain.AddSupplier(&anotherFakeTestSupplier)
res, err := chain.Resources()
anotherFakeTestSupplier.AssertExpectations(t)
assert.Nil(res)
assert.Equal("error from another supplier", err.Error())
}

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"fmt" "fmt"
"github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/cloudskiff/driftctl/pkg/alerter" "github.com/cloudskiff/driftctl/pkg/alerter"
@ -12,14 +13,14 @@ import (
type Scanner struct { type Scanner struct {
resourceSuppliers []resource.Supplier resourceSuppliers []resource.Supplier
runner *ParallelRunner runner *parallel.ParallelRunner
alerter *alerter.Alerter alerter *alerter.Alerter
} }
func NewScanner(resourceSuppliers []resource.Supplier, alerter *alerter.Alerter) *Scanner { func NewScanner(resourceSuppliers []resource.Supplier, alerter *alerter.Alerter) *Scanner {
return &Scanner{ return &Scanner{
resourceSuppliers: resourceSuppliers, resourceSuppliers: resourceSuppliers,
runner: NewParallelRunner(context.TODO(), 10), runner: parallel.NewParallelRunner(context.TODO(), 10),
alerter: alerter, alerter: alerter,
} }
} }

View File

@ -1,16 +1,16 @@
package terraform package terraform
import ( import (
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty"
) )
type ParallelResourceReader struct { type ParallelResourceReader struct {
runner *pkg.ParallelRunner runner *parallel.ParallelRunner
} }
func NewParallelResourceReader(runner *pkg.ParallelRunner) *ParallelResourceReader { func NewParallelResourceReader(runner *parallel.ParallelRunner) *ParallelResourceReader {
return &ParallelResourceReader{ return &ParallelResourceReader{
runner: runner, runner: runner,
} }

View File

@ -6,7 +6,7 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/cloudskiff/driftctl/pkg" "github.com/cloudskiff/driftctl/pkg/parallel"
"github.com/r3labs/diff/v2" "github.com/r3labs/diff/v2"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
@ -55,7 +55,7 @@ func TestParallelResourceReader_Wait(t *testing.T) {
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
p := NewParallelResourceReader(pkg.NewParallelRunner(context.TODO(), 10)) p := NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10))
for _, fun := range tt.execs { for _, fun := range tt.execs {
p.Run(fun) p.Run(fun)