From 460ac9f7675bd1da25bd67971683d0ba87277de4 Mon Sep 17 00:00:00 2001 From: sundowndev Date: Wed, 17 Mar 2021 17:23:36 +0100 Subject: [PATCH 01/17] fix: filter out s3 buckets from different regions --- pkg/remote/aws/s3_bucket_supplier.go | 3 ++- pkg/remote/aws/s3_bucket_supplier_test.go | 3 ++- pkg/remote/terraform/provider.go | 8 ++++++++ test/mocks/MockGoldenTerraformProvider.go | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pkg/remote/aws/s3_bucket_supplier.go b/pkg/remote/aws/s3_bucket_supplier.go index 4b78612f..26bf28b1 100644 --- a/pkg/remote/aws/s3_bucket_supplier.go +++ b/pkg/remote/aws/s3_bucket_supplier.go @@ -2,6 +2,8 @@ package aws import ( "github.com/aws/aws-sdk-go/service/s3" + "github.com/zclconf/go-cty/cty" + "github.com/cloudskiff/driftctl/pkg/remote/aws/repository" "github.com/cloudskiff/driftctl/pkg/remote/deserializer" remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error" @@ -9,7 +11,6 @@ import ( "github.com/cloudskiff/driftctl/pkg/resource/aws" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" "github.com/cloudskiff/driftctl/pkg/terraform" - "github.com/zclconf/go-cty/cty" ) type S3BucketSupplier struct { diff --git a/pkg/remote/aws/s3_bucket_supplier_test.go b/pkg/remote/aws/s3_bucket_supplier_test.go index edbb44e3..861ebab3 100644 --- a/pkg/remote/aws/s3_bucket_supplier_test.go +++ b/pkg/remote/aws/s3_bucket_supplier_test.go @@ -7,6 +7,8 @@ import ( awssdk "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/s3" + "github.com/stretchr/testify/assert" + "github.com/cloudskiff/driftctl/pkg/parallel" "github.com/cloudskiff/driftctl/pkg/remote/aws/client" "github.com/cloudskiff/driftctl/pkg/remote/aws/repository" @@ -18,7 +20,6 @@ import ( "github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test/goldenfile" "github.com/cloudskiff/driftctl/test/mocks" - "github.com/stretchr/testify/assert" ) func TestS3BucketSupplier_Resources(t *testing.T) { diff --git a/pkg/remote/terraform/provider.go b/pkg/remote/terraform/provider.go index 0be95b61..e6b485f5 100644 --- a/pkg/remote/terraform/provider.go +++ b/pkg/remote/terraform/provider.go @@ -157,6 +157,10 @@ func (p *TerraformProvider) ReadResource(args tf.ReadResourceArgs) (*cty.Value, delete(args.Attributes, "alias") } + if alias != p.Config.DefaultAlias { + return &cty.NilVal, nil + } + p.lock.Lock() if p.grpcProviders[alias] == nil { err := p.configure(alias) @@ -217,3 +221,7 @@ func (p *TerraformProvider) Cleanup() { client.Close() } } + +func (p *TerraformProvider) GetConfig() TerraformProviderConfig { + return p.Config +} diff --git a/test/mocks/MockGoldenTerraformProvider.go b/test/mocks/MockGoldenTerraformProvider.go index e683b6c9..fd6b806c 100644 --- a/test/mocks/MockGoldenTerraformProvider.go +++ b/test/mocks/MockGoldenTerraformProvider.go @@ -6,9 +6,9 @@ import ( "fmt" "sort" + "github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/test/goldenfile" - "github.com/cloudskiff/driftctl/pkg/terraform" "github.com/hashicorp/terraform/providers" "github.com/zclconf/go-cty/cty" ctyjson "github.com/zclconf/go-cty/cty/json" From 1b4d21d598da1a3cddeb2c4a0b833bdf4614ae50 Mon Sep 17 00:00:00 2001 From: sundowndev Date: Wed, 17 Mar 2021 17:35:01 +0100 Subject: [PATCH 02/17] refactor: remove unused GetConfig method --- pkg/remote/terraform/provider.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pkg/remote/terraform/provider.go b/pkg/remote/terraform/provider.go index e6b485f5..8a8a6647 100644 --- a/pkg/remote/terraform/provider.go +++ b/pkg/remote/terraform/provider.go @@ -221,7 +221,3 @@ func (p *TerraformProvider) Cleanup() { client.Close() } } - -func (p *TerraformProvider) GetConfig() TerraformProviderConfig { - return p.Config -} From 23d739f75a69e548156a2774123e6b03bd920aac Mon Sep 17 00:00:00 2001 From: sundowndev Date: Wed, 17 Mar 2021 18:18:34 +0100 Subject: [PATCH 03/17] refactor: revert ordering imports --- pkg/remote/aws/s3_bucket_supplier.go | 2 +- pkg/remote/aws/s3_bucket_supplier_test.go | 2 +- test/mocks/MockGoldenTerraformProvider.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/remote/aws/s3_bucket_supplier.go b/pkg/remote/aws/s3_bucket_supplier.go index 26bf28b1..90b3fb33 100644 --- a/pkg/remote/aws/s3_bucket_supplier.go +++ b/pkg/remote/aws/s3_bucket_supplier.go @@ -2,7 +2,6 @@ package aws import ( "github.com/aws/aws-sdk-go/service/s3" - "github.com/zclconf/go-cty/cty" "github.com/cloudskiff/driftctl/pkg/remote/aws/repository" "github.com/cloudskiff/driftctl/pkg/remote/deserializer" @@ -11,6 +10,7 @@ import ( "github.com/cloudskiff/driftctl/pkg/resource/aws" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" "github.com/cloudskiff/driftctl/pkg/terraform" + "github.com/zclconf/go-cty/cty" ) type S3BucketSupplier struct { diff --git a/pkg/remote/aws/s3_bucket_supplier_test.go b/pkg/remote/aws/s3_bucket_supplier_test.go index 861ebab3..b7bc4335 100644 --- a/pkg/remote/aws/s3_bucket_supplier_test.go +++ b/pkg/remote/aws/s3_bucket_supplier_test.go @@ -7,7 +7,6 @@ import ( awssdk "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/s3" - "github.com/stretchr/testify/assert" "github.com/cloudskiff/driftctl/pkg/parallel" "github.com/cloudskiff/driftctl/pkg/remote/aws/client" @@ -20,6 +19,7 @@ import ( "github.com/cloudskiff/driftctl/test" "github.com/cloudskiff/driftctl/test/goldenfile" "github.com/cloudskiff/driftctl/test/mocks" + "github.com/stretchr/testify/assert" ) func TestS3BucketSupplier_Resources(t *testing.T) { diff --git a/test/mocks/MockGoldenTerraformProvider.go b/test/mocks/MockGoldenTerraformProvider.go index fd6b806c..e683b6c9 100644 --- a/test/mocks/MockGoldenTerraformProvider.go +++ b/test/mocks/MockGoldenTerraformProvider.go @@ -6,9 +6,9 @@ import ( "fmt" "sort" - "github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/test/goldenfile" + "github.com/cloudskiff/driftctl/pkg/terraform" "github.com/hashicorp/terraform/providers" "github.com/zclconf/go-cty/cty" ctyjson "github.com/zclconf/go-cty/cty/json" From 59118f5100bf9785a82fc6b837e8c29e178c8b11 Mon Sep 17 00:00:00 2001 From: sundowndev Date: Wed, 17 Mar 2021 19:38:58 +0100 Subject: [PATCH 04/17] refactor: filter buckets before reading resource --- pkg/remote/aws/s3_bucket_supplier.go | 16 ++++++++++------ pkg/remote/aws/s3_bucket_supplier_test.go | 5 +++++ pkg/remote/terraform/provider.go | 4 ---- test/mocks/MockGoldenTerraformProvider.go | 5 +++-- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/pkg/remote/aws/s3_bucket_supplier.go b/pkg/remote/aws/s3_bucket_supplier.go index 90b3fb33..547681a8 100644 --- a/pkg/remote/aws/s3_bucket_supplier.go +++ b/pkg/remote/aws/s3_bucket_supplier.go @@ -3,21 +3,24 @@ package aws import ( "github.com/aws/aws-sdk-go/service/s3" + "github.com/zclconf/go-cty/cty" + "github.com/cloudskiff/driftctl/pkg/remote/aws/repository" "github.com/cloudskiff/driftctl/pkg/remote/deserializer" remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error" + tf "github.com/cloudskiff/driftctl/pkg/remote/terraform" "github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource/aws" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" "github.com/cloudskiff/driftctl/pkg/terraform" - "github.com/zclconf/go-cty/cty" ) type S3BucketSupplier struct { - reader terraform.ResourceReader - deserializer deserializer.CTYDeserializer - repository repository.S3Repository - runner *terraform.ParallelResourceReader + reader terraform.ResourceReader + deserializer deserializer.CTYDeserializer + repository repository.S3Repository + runner *terraform.ParallelResourceReader + providerConfig tf.TerraformProviderConfig } func NewS3BucketSupplier(provider *AWSTerraformProvider, repository repository.S3Repository) *S3BucketSupplier { @@ -26,6 +29,7 @@ func NewS3BucketSupplier(provider *AWSTerraformProvider, repository repository.S awsdeserializer.NewS3BucketDeserializer(), repository, terraform.NewParallelResourceReader(provider.Runner().SubRunner()), + provider.Config, } } @@ -54,7 +58,7 @@ func (s *S3BucketSupplier) readBucket(bucket s3.Bucket) (cty.Value, error) { if err != nil { return cty.NilVal, err } - if region == "" { + if region == "" || region != s.providerConfig.DefaultAlias { return cty.NilVal, nil } diff --git a/pkg/remote/aws/s3_bucket_supplier_test.go b/pkg/remote/aws/s3_bucket_supplier_test.go index b7bc4335..0ea1bd30 100644 --- a/pkg/remote/aws/s3_bucket_supplier_test.go +++ b/pkg/remote/aws/s3_bucket_supplier_test.go @@ -12,6 +12,7 @@ import ( "github.com/cloudskiff/driftctl/pkg/remote/aws/client" "github.com/cloudskiff/driftctl/pkg/remote/aws/repository" remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error" + tf "github.com/cloudskiff/driftctl/pkg/remote/terraform" "github.com/cloudskiff/driftctl/pkg/resource" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" @@ -101,6 +102,10 @@ func TestS3BucketSupplier_Resources(t *testing.T) { deserializer, &mock, terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)), + tf.TerraformProviderConfig{ + Name: "test", + DefaultAlias: "eu-west-1", + }, } got, err := s.Resources() assert.Equal(t, err, tt.wantErr) diff --git a/pkg/remote/terraform/provider.go b/pkg/remote/terraform/provider.go index 8a8a6647..0be95b61 100644 --- a/pkg/remote/terraform/provider.go +++ b/pkg/remote/terraform/provider.go @@ -157,10 +157,6 @@ func (p *TerraformProvider) ReadResource(args tf.ReadResourceArgs) (*cty.Value, delete(args.Attributes, "alias") } - if alias != p.Config.DefaultAlias { - return &cty.NilVal, nil - } - p.lock.Lock() if p.grpcProviders[alias] == nil { err := p.configure(alias) diff --git a/test/mocks/MockGoldenTerraformProvider.go b/test/mocks/MockGoldenTerraformProvider.go index e683b6c9..651ea179 100644 --- a/test/mocks/MockGoldenTerraformProvider.go +++ b/test/mocks/MockGoldenTerraformProvider.go @@ -8,10 +8,11 @@ import ( "github.com/cloudskiff/driftctl/test/goldenfile" - "github.com/cloudskiff/driftctl/pkg/terraform" "github.com/hashicorp/terraform/providers" "github.com/zclconf/go-cty/cty" ctyjson "github.com/zclconf/go-cty/cty/json" + + "github.com/cloudskiff/driftctl/pkg/terraform" ) type MockedGoldenTFProvider struct { @@ -166,4 +167,4 @@ func getFileNameSuffix(args terraform.ReadResourceArgs) string { return suffix } -func (p MockedGoldenTFProvider) Cleanup() {} +func (m MockedGoldenTFProvider) Cleanup() {} From 2c2a9281d9da921f85d5495dd06087fa28f1ce2a Mon Sep 17 00:00:00 2001 From: sundowndev Date: Wed, 17 Mar 2021 19:52:04 +0100 Subject: [PATCH 05/17] test: update s3 bucket golden result --- pkg/remote/aws/s3_bucket_supplier_test.go | 11 +- ...-bucket-martin-test-drift3.res.golden.json | 5 - .../s3_bucket_multiple/results.golden.json | 160 +++++++----------- 3 files changed, 74 insertions(+), 102 deletions(-) delete mode 100755 pkg/remote/aws/test/s3_bucket_multiple/aws_s3_bucket-bucket-martin-test-drift3.res.golden.json diff --git a/pkg/remote/aws/s3_bucket_supplier_test.go b/pkg/remote/aws/s3_bucket_supplier_test.go index 0ea1bd30..353755dc 100644 --- a/pkg/remote/aws/s3_bucket_supplier_test.go +++ b/pkg/remote/aws/s3_bucket_supplier_test.go @@ -40,6 +40,7 @@ func TestS3BucketSupplier_Resources(t *testing.T) { {Name: awssdk.String("bucket-martin-test-drift")}, {Name: awssdk.String("bucket-martin-test-drift2")}, {Name: awssdk.String("bucket-martin-test-drift3")}, + {Name: awssdk.String("bucket-martin-test-drift4")}, }, nil) repository.On( @@ -52,7 +53,7 @@ func TestS3BucketSupplier_Resources(t *testing.T) { repository.On( "GetBucketLocation", - &s3.Bucket{Name: awssdk.String("bucket-martin-test-drift2")}, + &s3.Bucket{Name: awssdk.String("bucket-martin-test-drift4")}, ).Return( "eu-west-3", nil, @@ -65,6 +66,14 @@ func TestS3BucketSupplier_Resources(t *testing.T) { "ap-northeast-1", nil, ) + + repository.On( + "GetBucketLocation", + &s3.Bucket{Name: awssdk.String("bucket-martin-test-drift2")}, + ).Return( + "eu-west-1", + nil, + ) }, }, { diff --git a/pkg/remote/aws/test/s3_bucket_multiple/aws_s3_bucket-bucket-martin-test-drift3.res.golden.json b/pkg/remote/aws/test/s3_bucket_multiple/aws_s3_bucket-bucket-martin-test-drift3.res.golden.json deleted file mode 100755 index e9076839..00000000 --- a/pkg/remote/aws/test/s3_bucket_multiple/aws_s3_bucket-bucket-martin-test-drift3.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYWNjZWxlcmF0aW9uX3N0YXR1cyI6InN0cmluZyIsImFjbCI6InN0cmluZyIsImFybiI6InN0cmluZyIsImJ1Y2tldCI6InN0cmluZyIsImJ1Y2tldF9kb21haW5fbmFtZSI6InN0cmluZyIsImJ1Y2tldF9wcmVmaXgiOiJzdHJpbmciLCJidWNrZXRfcmVnaW9uYWxfZG9tYWluX25hbWUiOiJzdHJpbmciLCJjb3JzX3J1bGUiOlsibGlzdCIsWyJvYmplY3QiLHsiYWxsb3dlZF9oZWFkZXJzIjpbImxpc3QiLCJzdHJpbmciXSwiYWxsb3dlZF9tZXRob2RzIjpbImxpc3QiLCJzdHJpbmciXSwiYWxsb3dlZF9vcmlnaW5zIjpbImxpc3QiLCJzdHJpbmciXSwiZXhwb3NlX2hlYWRlcnMiOlsibGlzdCIsInN0cmluZyJdLCJtYXhfYWdlX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lZF96b25lX2lkIjoiWjJNNEVIVVIyNlA3WlciLCJpZCI6ImJ1Y2tldC1tYXJ0aW4tdGVzdC1kcmlmdDMiLCJsaWZlY3ljbGVfcnVsZSI6W10sImxvZ2dpbmciOltdLCJvYmplY3RfbG9ja19jb25maWd1cmF0aW9uIjpbXSwicG9saWN5IjpudWxsLCJyZWdpb24iOiJhcC1ub3J0aGVhc3QtMSIsInJlcGxpY2F0aW9uX2NvbmZpZ3VyYXRpb24iOltdLCJyZXF1ZXN0X3BheWVyIjoiQnVja2V0T3duZXIiLCJzZXJ2ZXJfc2lkZV9lbmNyeXB0aW9uX2NvbmZpZ3VyYXRpb24iOltdLCJ0YWdzIjp7fSwidmVyc2lvbmluZyI6W3siZW5hYmxlZCI6ZmFsc2UsIm1mYV9kZWxldGUiOmZhbHNlfV0sIndlYnNpdGUiOltdLCJ3ZWJzaXRlX2RvbWFpbiI6bnVsbCwid2Vic2l0ZV9lbmRwb2ludCI6bnVsbH0=", - "Err": null -} \ No newline at end of file diff --git a/pkg/remote/aws/test/s3_bucket_multiple/results.golden.json b/pkg/remote/aws/test/s3_bucket_multiple/results.golden.json index 13c2d23a..2cf90d40 100755 --- a/pkg/remote/aws/test/s3_bucket_multiple/results.golden.json +++ b/pkg/remote/aws/test/s3_bucket_multiple/results.golden.json @@ -1,98 +1,66 @@ [ - { - "acceleration_status": "", - "acl": null, - "arn": "arn:aws:s3:::bucket-martin-test-drift2", - "bucket": "bucket-martin-test-drift2", - "bucket_domain_name": "bucket-martin-test-drift2.s3.amazonaws.com", - "bucket_prefix": null, - "bucket_regional_domain_name": "bucket-martin-test-drift2.s3.eu-west-3.amazonaws.com", - "cors_rule": [], - "force_destroy": null, - "grant": [], - "hosted_zone_id": "Z3R1K369G5AVDG", - "id": "bucket-martin-test-drift2", - "lifecycle_rule": [], - "logging": [], - "object_lock_configuration": [], - "policy": null, - "region": "eu-west-3", - "replication_configuration": [], - "request_payer": "BucketOwner", - "server_side_encryption_configuration": [], - "tags": {}, - "versioning": [ - { - "enabled": false, - "mfa_delete": false - } - ], - "website": [], - "website_domain": null, - "website_endpoint": null - }, - { - "acceleration_status": "", - "acl": null, - "arn": "arn:aws:s3:::bucket-martin-test-drift", - "bucket": "bucket-martin-test-drift", - "bucket_domain_name": "bucket-martin-test-drift.s3.amazonaws.com", - "bucket_prefix": null, - "bucket_regional_domain_name": "bucket-martin-test-drift.s3.eu-west-1.amazonaws.com", - "cors_rule": [], - "force_destroy": null, - "grant": [], - "hosted_zone_id": "Z1BKCTXD74EZPE", - "id": "bucket-martin-test-drift", - "lifecycle_rule": [], - "logging": [], - "object_lock_configuration": [], - "policy": null, - "region": "eu-west-1", - "replication_configuration": [], - "request_payer": "BucketOwner", - "server_side_encryption_configuration": [], - "tags": {}, - "versioning": [ - { - "enabled": false, - "mfa_delete": false - } - ], - "website": [], - "website_domain": null, - "website_endpoint": null - }, - { - "acceleration_status": "", - "acl": null, - "arn": "arn:aws:s3:::bucket-martin-test-drift3", - "bucket": "bucket-martin-test-drift3", - "bucket_domain_name": "bucket-martin-test-drift3.s3.amazonaws.com", - "bucket_prefix": null, - "bucket_regional_domain_name": "bucket-martin-test-drift3.s3.ap-northeast-1.amazonaws.com", - "cors_rule": [], - "force_destroy": null, - "grant": [], - "hosted_zone_id": "Z2M4EHUR26P7ZW", - "id": "bucket-martin-test-drift3", - "lifecycle_rule": [], - "logging": [], - "object_lock_configuration": [], - "policy": null, - "region": "ap-northeast-1", - "replication_configuration": [], - "request_payer": "BucketOwner", - "server_side_encryption_configuration": [], - "tags": {}, - "versioning": [ - { - "enabled": false, - "mfa_delete": false - } - ], - "website": [], - "website_domain": null, - "website_endpoint": null - } + { + "acceleration_status": "", + "acl": null, + "arn": "arn:aws:s3:::bucket-martin-test-drift", + "bucket": "bucket-martin-test-drift", + "bucket_domain_name": "bucket-martin-test-drift.s3.amazonaws.com", + "bucket_prefix": null, + "bucket_regional_domain_name": "bucket-martin-test-drift.s3.eu-west-1.amazonaws.com", + "cors_rule": [], + "force_destroy": null, + "grant": [], + "hosted_zone_id": "Z1BKCTXD74EZPE", + "id": "bucket-martin-test-drift", + "lifecycle_rule": [], + "logging": [], + "object_lock_configuration": [], + "policy": null, + "region": "eu-west-1", + "replication_configuration": [], + "request_payer": "BucketOwner", + "server_side_encryption_configuration": [], + "tags": {}, + "versioning": [ + { + "enabled": false, + "mfa_delete": false + } + ], + "website": [], + "website_domain": null, + "website_endpoint": null + }, + { + "acceleration_status": "", + "acl": null, + "arn": "arn:aws:s3:::bucket-martin-test-drift2", + "bucket": "bucket-martin-test-drift2", + "bucket_domain_name": "bucket-martin-test-drift2.s3.amazonaws.com", + "bucket_prefix": null, + "bucket_regional_domain_name": "bucket-martin-test-drift2.s3.eu-west-3.amazonaws.com", + "cors_rule": [], + "force_destroy": null, + "grant": [], + "hosted_zone_id": "Z3R1K369G5AVDG", + "id": "bucket-martin-test-drift2", + "lifecycle_rule": [], + "logging": [], + "object_lock_configuration": [], + "policy": null, + "region": "eu-west-3", + "replication_configuration": [], + "request_payer": "BucketOwner", + "server_side_encryption_configuration": [], + "tags": {}, + "versioning": [ + { + "enabled": false, + "mfa_delete": false + } + ], + "website": [], + "website_domain": null, + "website_endpoint": null + } ] \ No newline at end of file From 2d469ca5d95376c44b4d872bddea7783841808a1 Mon Sep 17 00:00:00 2001 From: sundowndev Date: Thu, 18 Mar 2021 11:09:36 +0100 Subject: [PATCH 06/17] test: aws s3 bucket supplier --- pkg/remote/aws/s3_bucket_supplier_test.go | 13 ++------ .../s3_bucket_multiple/results.golden.json | 32 ------------------- 2 files changed, 2 insertions(+), 43 deletions(-) diff --git a/pkg/remote/aws/s3_bucket_supplier_test.go b/pkg/remote/aws/s3_bucket_supplier_test.go index 353755dc..051c040a 100644 --- a/pkg/remote/aws/s3_bucket_supplier_test.go +++ b/pkg/remote/aws/s3_bucket_supplier_test.go @@ -40,7 +40,6 @@ func TestS3BucketSupplier_Resources(t *testing.T) { {Name: awssdk.String("bucket-martin-test-drift")}, {Name: awssdk.String("bucket-martin-test-drift2")}, {Name: awssdk.String("bucket-martin-test-drift3")}, - {Name: awssdk.String("bucket-martin-test-drift4")}, }, nil) repository.On( @@ -53,7 +52,7 @@ func TestS3BucketSupplier_Resources(t *testing.T) { repository.On( "GetBucketLocation", - &s3.Bucket{Name: awssdk.String("bucket-martin-test-drift4")}, + &s3.Bucket{Name: awssdk.String("bucket-martin-test-drift2")}, ).Return( "eu-west-3", nil, @@ -66,14 +65,6 @@ func TestS3BucketSupplier_Resources(t *testing.T) { "ap-northeast-1", nil, ) - - repository.On( - "GetBucketLocation", - &s3.Bucket{Name: awssdk.String("bucket-martin-test-drift2")}, - ).Return( - "eu-west-1", - nil, - ) }, }, { @@ -113,7 +104,7 @@ func TestS3BucketSupplier_Resources(t *testing.T) { terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)), tf.TerraformProviderConfig{ Name: "test", - DefaultAlias: "eu-west-1", + DefaultAlias: "eu-west-3", }, } got, err := s.Resources() diff --git a/pkg/remote/aws/test/s3_bucket_multiple/results.golden.json b/pkg/remote/aws/test/s3_bucket_multiple/results.golden.json index 2cf90d40..cfe61717 100755 --- a/pkg/remote/aws/test/s3_bucket_multiple/results.golden.json +++ b/pkg/remote/aws/test/s3_bucket_multiple/results.golden.json @@ -1,36 +1,4 @@ [ - { - "acceleration_status": "", - "acl": null, - "arn": "arn:aws:s3:::bucket-martin-test-drift", - "bucket": "bucket-martin-test-drift", - "bucket_domain_name": "bucket-martin-test-drift.s3.amazonaws.com", - "bucket_prefix": null, - "bucket_regional_domain_name": "bucket-martin-test-drift.s3.eu-west-1.amazonaws.com", - "cors_rule": [], - "force_destroy": null, - "grant": [], - "hosted_zone_id": "Z1BKCTXD74EZPE", - "id": "bucket-martin-test-drift", - "lifecycle_rule": [], - "logging": [], - "object_lock_configuration": [], - "policy": null, - "region": "eu-west-1", - "replication_configuration": [], - "request_payer": "BucketOwner", - "server_side_encryption_configuration": [], - "tags": {}, - "versioning": [ - { - "enabled": false, - "mfa_delete": false - } - ], - "website": [], - "website_domain": null, - "website_endpoint": null - }, { "acceleration_status": "", "acl": null, From caf26b57478d49a395b4956350a2198c17a65050 Mon Sep 17 00:00:00 2001 From: sundowndev Date: Thu, 18 Mar 2021 11:55:44 +0100 Subject: [PATCH 07/17] refactor: MockGoldenTerraformProvider revert changes to the golden terraform provider mock --- test/mocks/MockGoldenTerraformProvider.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/mocks/MockGoldenTerraformProvider.go b/test/mocks/MockGoldenTerraformProvider.go index 651ea179..fd6b806c 100644 --- a/test/mocks/MockGoldenTerraformProvider.go +++ b/test/mocks/MockGoldenTerraformProvider.go @@ -6,13 +6,12 @@ import ( "fmt" "sort" + "github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/test/goldenfile" "github.com/hashicorp/terraform/providers" "github.com/zclconf/go-cty/cty" ctyjson "github.com/zclconf/go-cty/cty/json" - - "github.com/cloudskiff/driftctl/pkg/terraform" ) type MockedGoldenTFProvider struct { @@ -167,4 +166,4 @@ func getFileNameSuffix(args terraform.ReadResourceArgs) string { return suffix } -func (m MockedGoldenTFProvider) Cleanup() {} +func (p MockedGoldenTFProvider) Cleanup() {} From 95bc5220fb19f6df1f7dcb6b9754b16448548c97 Mon Sep 17 00:00:00 2001 From: sundowndev Date: Thu, 18 Mar 2021 11:59:52 +0100 Subject: [PATCH 08/17] fix(remote): aws s3 bucket policy supplier Add filter on resources based on region --- pkg/remote/aws/s3_bucket_policy_supplier.go | 13 ++++++++----- pkg/remote/aws/s3_bucket_policy_supplier_test.go | 5 +++++ .../s3_bucket_policies_multiple/results.golden.json | 10 ---------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/pkg/remote/aws/s3_bucket_policy_supplier.go b/pkg/remote/aws/s3_bucket_policy_supplier.go index 3142be55..73af424d 100644 --- a/pkg/remote/aws/s3_bucket_policy_supplier.go +++ b/pkg/remote/aws/s3_bucket_policy_supplier.go @@ -4,6 +4,7 @@ import ( "github.com/cloudskiff/driftctl/pkg/remote/aws/repository" "github.com/cloudskiff/driftctl/pkg/remote/deserializer" remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error" + tf "github.com/cloudskiff/driftctl/pkg/remote/terraform" "github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource/aws" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" @@ -12,10 +13,11 @@ import ( ) type S3BucketPolicySupplier struct { - reader terraform.ResourceReader - deserializer deserializer.CTYDeserializer - repository repository.S3Repository - runner *terraform.ParallelResourceReader + reader terraform.ResourceReader + deserializer deserializer.CTYDeserializer + repository repository.S3Repository + runner *terraform.ParallelResourceReader + providerConfig tf.TerraformProviderConfig } func NewS3BucketPolicySupplier(provider *AWSTerraformProvider, repository repository.S3Repository) *S3BucketPolicySupplier { @@ -24,6 +26,7 @@ func NewS3BucketPolicySupplier(provider *AWSTerraformProvider, repository reposi awsdeserializer.NewS3BucketPolicyDeserializer(), repository, terraform.NewParallelResourceReader(provider.Runner().SubRunner()), + provider.Config, } } @@ -39,7 +42,7 @@ func (s *S3BucketPolicySupplier) Resources() ([]resource.Resource, error) { if err != nil { return nil, err } - if region == "" { + if region == "" || region != s.providerConfig.DefaultAlias { continue } s.runner.Run(func() (cty.Value, error) { diff --git a/pkg/remote/aws/s3_bucket_policy_supplier_test.go b/pkg/remote/aws/s3_bucket_policy_supplier_test.go index 9611935f..c8bcc5d4 100644 --- a/pkg/remote/aws/s3_bucket_policy_supplier_test.go +++ b/pkg/remote/aws/s3_bucket_policy_supplier_test.go @@ -11,6 +11,7 @@ import ( "github.com/cloudskiff/driftctl/pkg/remote/aws/client" "github.com/cloudskiff/driftctl/pkg/remote/aws/repository" remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error" + tf "github.com/cloudskiff/driftctl/pkg/remote/terraform" "github.com/cloudskiff/driftctl/pkg/resource" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" @@ -120,6 +121,10 @@ func TestS3BucketPolicySupplier_Resources(t *testing.T) { deserializer, &mock, terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)), + tf.TerraformProviderConfig{ + Name: "test", + DefaultAlias: "eu-west-3", + }, } got, err := s.Resources() assert.Equal(t, err, tt.wantErr) diff --git a/pkg/remote/aws/test/s3_bucket_policies_multiple/results.golden.json b/pkg/remote/aws/test/s3_bucket_policies_multiple/results.golden.json index a6a2f3bb..5be24470 100755 --- a/pkg/remote/aws/test/s3_bucket_policies_multiple/results.golden.json +++ b/pkg/remote/aws/test/s3_bucket_policies_multiple/results.golden.json @@ -3,15 +3,5 @@ "bucket": "bucket-martin-test-drift2", "id": "bucket-martin-test-drift2", "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"PublicReadGetObject\",\"Effect\":\"Allow\",\"Principal\":\"*\",\"Action\":\"s3:GetObject\",\"Resource\":\"arn:aws:s3:::bucket-martin-test-drift2/*\"}]}" - }, - { - "bucket": "bucket-martin-test-drift3", - "id": "bucket-martin-test-drift3", - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"PublicReadGetObject\",\"Effect\":\"Allow\",\"Principal\":\"*\",\"Action\":\"s3:GetObject\",\"Resource\":\"arn:aws:s3:::bucket-martin-test-drift3/*\"}]}" - }, - { - "bucket": "bucket-martin-test-drift", - "id": "bucket-martin-test-drift", - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"PublicReadGetObject\",\"Effect\":\"Allow\",\"Principal\":\"*\",\"Action\":\"s3:GetObject\",\"Resource\":\"arn:aws:s3:::bucket-martin-test-drift/*\"}]}" } ] \ No newline at end of file From 7e52ef5c767ab4e36d54900c2eb775a44d21300a Mon Sep 17 00:00:00 2001 From: sundowndev Date: Thu, 18 Mar 2021 12:04:58 +0100 Subject: [PATCH 09/17] fix(remote): aws s3 bucket inventory supplier Add filter on resources based on region --- .../aws/s3_bucket_inventory_supplier.go | 13 ++- .../aws/s3_bucket_inventory_supplier_test.go | 10 +- .../results.golden.json | 108 ------------------ 3 files changed, 15 insertions(+), 116 deletions(-) diff --git a/pkg/remote/aws/s3_bucket_inventory_supplier.go b/pkg/remote/aws/s3_bucket_inventory_supplier.go index 113d8446..74e3101e 100644 --- a/pkg/remote/aws/s3_bucket_inventory_supplier.go +++ b/pkg/remote/aws/s3_bucket_inventory_supplier.go @@ -7,6 +7,7 @@ import ( "github.com/cloudskiff/driftctl/pkg/remote/aws/repository" "github.com/cloudskiff/driftctl/pkg/remote/deserializer" remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error" + tf "github.com/cloudskiff/driftctl/pkg/remote/terraform" "github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource/aws" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" @@ -15,10 +16,11 @@ import ( ) type S3BucketInventorySupplier struct { - reader terraform.ResourceReader - deserializer deserializer.CTYDeserializer - repository repository.S3Repository - runner *terraform.ParallelResourceReader + reader terraform.ResourceReader + deserializer deserializer.CTYDeserializer + repository repository.S3Repository + runner *terraform.ParallelResourceReader + providerConfig tf.TerraformProviderConfig } func NewS3BucketInventorySupplier(provider *AWSTerraformProvider, repository repository.S3Repository) *S3BucketInventorySupplier { @@ -27,6 +29,7 @@ func NewS3BucketInventorySupplier(provider *AWSTerraformProvider, repository rep awsdeserializer.NewS3BucketInventoryDeserializer(), repository, terraform.NewParallelResourceReader(provider.Runner().SubRunner()), + provider.Config, } } @@ -42,7 +45,7 @@ func (s *S3BucketInventorySupplier) Resources() ([]resource.Resource, error) { if err != nil { return nil, err } - if region == "" { + if region == "" || region != s.providerConfig.DefaultAlias { continue } if err := s.listBucketInventoryConfiguration(&bucket, region); err != nil { diff --git a/pkg/remote/aws/s3_bucket_inventory_supplier_test.go b/pkg/remote/aws/s3_bucket_inventory_supplier_test.go index 4c087920..9d3604de 100644 --- a/pkg/remote/aws/s3_bucket_inventory_supplier_test.go +++ b/pkg/remote/aws/s3_bucket_inventory_supplier_test.go @@ -11,6 +11,7 @@ import ( "github.com/cloudskiff/driftctl/pkg/remote/aws/client" "github.com/cloudskiff/driftctl/pkg/remote/aws/repository" remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error" + tf "github.com/cloudskiff/driftctl/pkg/remote/terraform" "github.com/cloudskiff/driftctl/pkg/resource" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" @@ -121,18 +122,17 @@ func TestS3BucketInventorySupplier_Resources(t *testing.T) { "GetBucketLocation", &s3.Bucket{Name: awssdk.String("bucket-martin-test-drift")}, ).Return( - "eu-west-1", + "eu-west-3", nil, ) repository.On( "ListBucketInventoryConfigurations", &s3.Bucket{Name: awssdk.String("bucket-martin-test-drift")}, - "eu-west-1", + "eu-west-3", ).Return( nil, awserr.NewRequestFailure(nil, 403, ""), ) - }, wantErr: remoteerror.NewResourceEnumerationError(awserr.NewRequestFailure(nil, 403, ""), resourceaws.AwsS3BucketInventoryResourceType), }, @@ -165,6 +165,10 @@ func TestS3BucketInventorySupplier_Resources(t *testing.T) { deserializer, &mock, terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)), + tf.TerraformProviderConfig{ + Name: "test", + DefaultAlias: "eu-west-3", + }, } got, err := s.Resources() assert.Equal(t, err, tt.wantErr) diff --git a/pkg/remote/aws/test/s3_bucket_inventories_multiple/results.golden.json b/pkg/remote/aws/test/s3_bucket_inventories_multiple/results.golden.json index 8bca25c8..d737dedb 100755 --- a/pkg/remote/aws/test/s3_bucket_inventories_multiple/results.golden.json +++ b/pkg/remote/aws/test/s3_bucket_inventories_multiple/results.golden.json @@ -52,113 +52,5 @@ "frequency": "Daily" } ] - }, - { - "bucket": "bucket-martin-test-drift", - "destination": [ - { - "bucket": [ - { - "account_id": "", - "bucket_arn": "arn:aws:s3:::bucket-martin-test-drift", - "encryption": [], - "format": "ORC", - "prefix": "" - } - ] - } - ], - "enabled": true, - "filter": [], - "id": "bucket-martin-test-drift:Inventory2_Bucket1", - "included_object_versions": "All", - "name": "Inventory2_Bucket1", - "optional_fields": [], - "schedule": [ - { - "frequency": "Daily" - } - ] - }, - { - "bucket": "bucket-martin-test-drift", - "destination": [ - { - "bucket": [ - { - "account_id": "", - "bucket_arn": "arn:aws:s3:::bucket-martin-test-drift", - "encryption": [], - "format": "ORC", - "prefix": "" - } - ] - } - ], - "enabled": true, - "filter": [], - "id": "bucket-martin-test-drift:Inventory_Bucket1", - "included_object_versions": "All", - "name": "Inventory_Bucket1", - "optional_fields": [], - "schedule": [ - { - "frequency": "Daily" - } - ] - }, - { - "bucket": "bucket-martin-test-drift3", - "destination": [ - { - "bucket": [ - { - "account_id": "", - "bucket_arn": "arn:aws:s3:::bucket-martin-test-drift3", - "encryption": [], - "format": "ORC", - "prefix": "" - } - ] - } - ], - "enabled": true, - "filter": [], - "id": "bucket-martin-test-drift3:Inventory_Bucket3", - "included_object_versions": "All", - "name": "Inventory_Bucket3", - "optional_fields": [], - "schedule": [ - { - "frequency": "Daily" - } - ] - }, - { - "bucket": "bucket-martin-test-drift3", - "destination": [ - { - "bucket": [ - { - "account_id": "", - "bucket_arn": "arn:aws:s3:::bucket-martin-test-drift3", - "encryption": [], - "format": "ORC", - "prefix": "" - } - ] - } - ], - "enabled": true, - "filter": [], - "id": "bucket-martin-test-drift3:Inventory2_Bucket3", - "included_object_versions": "All", - "name": "Inventory2_Bucket3", - "optional_fields": [], - "schedule": [ - { - "frequency": "Daily" - } - ] } ] \ No newline at end of file From 038116e7bfb4433c443387255f11d34315e6bb15 Mon Sep 17 00:00:00 2001 From: sundowndev Date: Thu, 18 Mar 2021 12:08:21 +0100 Subject: [PATCH 10/17] fix(remote): aws s3 bucket metrics supplier Add filter on resources based on region --- .../aws/s3_bucket_metric_supplier_test.go | 9 +++++-- pkg/remote/aws/s3_bucket_metrics_supplier.go | 13 ++++++---- .../results.golden.json | 24 ------------------- 3 files changed, 15 insertions(+), 31 deletions(-) diff --git a/pkg/remote/aws/s3_bucket_metric_supplier_test.go b/pkg/remote/aws/s3_bucket_metric_supplier_test.go index 560ebec5..770bb9d0 100644 --- a/pkg/remote/aws/s3_bucket_metric_supplier_test.go +++ b/pkg/remote/aws/s3_bucket_metric_supplier_test.go @@ -11,6 +11,7 @@ import ( "github.com/cloudskiff/driftctl/pkg/remote/aws/client" "github.com/cloudskiff/driftctl/pkg/remote/aws/repository" remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error" + tf "github.com/cloudskiff/driftctl/pkg/remote/terraform" "github.com/cloudskiff/driftctl/pkg/resource" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" @@ -121,14 +122,14 @@ func TestS3BucketMetricSupplier_Resources(t *testing.T) { "GetBucketLocation", &s3.Bucket{Name: awssdk.String("bucket-martin-test-drift")}, ).Return( - "eu-west-1", + "eu-west-3", nil, ) repository.On( "ListBucketMetricsConfigurations", &s3.Bucket{Name: awssdk.String("bucket-martin-test-drift")}, - "eu-west-1", + "eu-west-3", ).Return( nil, awserr.NewRequestFailure(nil, 403, ""), @@ -165,6 +166,10 @@ func TestS3BucketMetricSupplier_Resources(t *testing.T) { deserializer, &mock, terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)), + tf.TerraformProviderConfig{ + Name: "test", + DefaultAlias: "eu-west-3", + }, } got, err := s.Resources() assert.Equal(t, err, tt.wantErr) diff --git a/pkg/remote/aws/s3_bucket_metrics_supplier.go b/pkg/remote/aws/s3_bucket_metrics_supplier.go index 9d0e6c45..3e1696a7 100644 --- a/pkg/remote/aws/s3_bucket_metrics_supplier.go +++ b/pkg/remote/aws/s3_bucket_metrics_supplier.go @@ -7,6 +7,7 @@ import ( "github.com/cloudskiff/driftctl/pkg/remote/aws/repository" "github.com/cloudskiff/driftctl/pkg/remote/deserializer" remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error" + tf "github.com/cloudskiff/driftctl/pkg/remote/terraform" "github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource/aws" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" @@ -15,10 +16,11 @@ import ( ) type S3BucketMetricSupplier struct { - reader terraform.ResourceReader - deserializer deserializer.CTYDeserializer - repository repository.S3Repository - runner *terraform.ParallelResourceReader + reader terraform.ResourceReader + deserializer deserializer.CTYDeserializer + repository repository.S3Repository + runner *terraform.ParallelResourceReader + providerConfig tf.TerraformProviderConfig } func NewS3BucketMetricSupplier(provider *AWSTerraformProvider, repository repository.S3Repository) *S3BucketMetricSupplier { @@ -27,6 +29,7 @@ func NewS3BucketMetricSupplier(provider *AWSTerraformProvider, repository reposi awsdeserializer.NewS3BucketMetricDeserializer(), repository, terraform.NewParallelResourceReader(provider.Runner().SubRunner()), + provider.Config, } } @@ -42,7 +45,7 @@ func (s *S3BucketMetricSupplier) Resources() ([]resource.Resource, error) { if err != nil { return nil, err } - if region == "" { + if region == "" || region != s.providerConfig.DefaultAlias { continue } if err := s.listBucketMetricConfiguration(&bucket, region); err != nil { diff --git a/pkg/remote/aws/test/s3_bucket_metrics_multiple/results.golden.json b/pkg/remote/aws/test/s3_bucket_metrics_multiple/results.golden.json index 16fdbe44..b8109dc9 100755 --- a/pkg/remote/aws/test/s3_bucket_metrics_multiple/results.golden.json +++ b/pkg/remote/aws/test/s3_bucket_metrics_multiple/results.golden.json @@ -5,34 +5,10 @@ "id": "bucket-martin-test-drift2:Metrics2_Bucket2", "name": "Metrics2_Bucket2" }, - { - "bucket": "bucket-martin-test-drift", - "filter": null, - "id": "bucket-martin-test-drift:Metrics_Bucket1", - "name": "Metrics_Bucket1" - }, { "bucket": "bucket-martin-test-drift2", "filter": null, "id": "bucket-martin-test-drift2:Metrics_Bucket2", "name": "Metrics_Bucket2" - }, - { - "bucket": "bucket-martin-test-drift", - "filter": null, - "id": "bucket-martin-test-drift:Metrics2_Bucket1", - "name": "Metrics2_Bucket1" - }, - { - "bucket": "bucket-martin-test-drift3", - "filter": null, - "id": "bucket-martin-test-drift3:Metrics2_Bucket3", - "name": "Metrics2_Bucket3" - }, - { - "bucket": "bucket-martin-test-drift3", - "filter": null, - "id": "bucket-martin-test-drift3:Metrics_Bucket3", - "name": "Metrics_Bucket3" } ] \ No newline at end of file From 1bebec138df16292c106cb514dc702eed9cc01ec Mon Sep 17 00:00:00 2001 From: sundowndev Date: Thu, 18 Mar 2021 12:10:46 +0100 Subject: [PATCH 11/17] fix(remote): aws s3 bucket analytic supplier Add filter on resources based on region --- pkg/remote/aws/s3_bucket_analytic_supplier.go | 13 ++- .../aws/s3_bucket_analytic_supplier_test.go | 9 +- .../results.golden.json | 108 ------------------ 3 files changed, 15 insertions(+), 115 deletions(-) diff --git a/pkg/remote/aws/s3_bucket_analytic_supplier.go b/pkg/remote/aws/s3_bucket_analytic_supplier.go index 18fd5a3e..c540b67a 100644 --- a/pkg/remote/aws/s3_bucket_analytic_supplier.go +++ b/pkg/remote/aws/s3_bucket_analytic_supplier.go @@ -7,6 +7,7 @@ import ( "github.com/cloudskiff/driftctl/pkg/remote/aws/repository" "github.com/cloudskiff/driftctl/pkg/remote/deserializer" remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error" + tf "github.com/cloudskiff/driftctl/pkg/remote/terraform" "github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource/aws" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" @@ -15,10 +16,11 @@ import ( ) type S3BucketAnalyticSupplier struct { - reader terraform.ResourceReader - deserializer deserializer.CTYDeserializer - repository repository.S3Repository - runner *terraform.ParallelResourceReader + reader terraform.ResourceReader + deserializer deserializer.CTYDeserializer + repository repository.S3Repository + runner *terraform.ParallelResourceReader + providerConfig tf.TerraformProviderConfig } func NewS3BucketAnalyticSupplier(provider *AWSTerraformProvider, repository repository.S3Repository) *S3BucketAnalyticSupplier { @@ -27,6 +29,7 @@ func NewS3BucketAnalyticSupplier(provider *AWSTerraformProvider, repository repo awsdeserializer.NewS3BucketAnalyticDeserializer(), repository, terraform.NewParallelResourceReader(provider.Runner().SubRunner()), + provider.Config, } } @@ -42,7 +45,7 @@ func (s *S3BucketAnalyticSupplier) Resources() ([]resource.Resource, error) { if err != nil { return nil, err } - if region == "" { + if region == "" || region != s.providerConfig.DefaultAlias { continue } if err := s.listBucketAnalyticConfiguration(&bucket, region); err != nil { diff --git a/pkg/remote/aws/s3_bucket_analytic_supplier_test.go b/pkg/remote/aws/s3_bucket_analytic_supplier_test.go index 0ee358cb..bf87da2b 100644 --- a/pkg/remote/aws/s3_bucket_analytic_supplier_test.go +++ b/pkg/remote/aws/s3_bucket_analytic_supplier_test.go @@ -11,6 +11,7 @@ import ( "github.com/cloudskiff/driftctl/pkg/remote/aws/client" "github.com/cloudskiff/driftctl/pkg/remote/aws/repository" remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error" + tf "github.com/cloudskiff/driftctl/pkg/remote/terraform" "github.com/cloudskiff/driftctl/pkg/resource" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" @@ -124,14 +125,14 @@ func TestS3BucketAnalyticSupplier_Resources(t *testing.T) { "GetBucketLocation", &s3.Bucket{Name: awssdk.String("bucket-martin-test-drift")}, ).Return( - "eu-west-1", + "eu-west-3", nil, ) repository.On( "ListBucketAnalyticsConfigurations", &s3.Bucket{Name: awssdk.String("bucket-martin-test-drift")}, - "eu-west-1", + "eu-west-3", ).Return( nil, awserr.NewRequestFailure(nil, 403, ""), @@ -169,6 +170,10 @@ func TestS3BucketAnalyticSupplier_Resources(t *testing.T) { deserializer, &mock, terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)), + tf.TerraformProviderConfig{ + Name: "test", + DefaultAlias: "eu-west-3", + }, } got, err := s.Resources() assert.Equal(t, err, tt.wantErr) diff --git a/pkg/remote/aws/test/s3_bucket_analytics_multiple/results.golden.json b/pkg/remote/aws/test/s3_bucket_analytics_multiple/results.golden.json index 116c3eab..01e24e3c 100755 --- a/pkg/remote/aws/test/s3_bucket_analytics_multiple/results.golden.json +++ b/pkg/remote/aws/test/s3_bucket_analytics_multiple/results.golden.json @@ -52,113 +52,5 @@ ] } ] - }, - { - "bucket": "bucket-martin-test-drift", - "filter": [], - "id": "bucket-martin-test-drift:Analytics_Bucket1", - "name": "Analytics_Bucket1", - "storage_class_analysis": [ - { - "data_export": [ - { - "destination": [ - { - "s3_bucket_destination": [ - { - "bucket_account_id": "", - "bucket_arn": "arn:aws:s3:::bucket-martin-test-drift", - "format": "CSV", - "prefix": "" - } - ] - } - ], - "output_schema_version": "V_1" - } - ] - } - ] - }, - { - "bucket": "bucket-martin-test-drift", - "filter": [], - "id": "bucket-martin-test-drift:Analytics2_Bucket1", - "name": "Analytics2_Bucket1", - "storage_class_analysis": [ - { - "data_export": [ - { - "destination": [ - { - "s3_bucket_destination": [ - { - "bucket_account_id": "", - "bucket_arn": "arn:aws:s3:::bucket-martin-test-drift", - "format": "CSV", - "prefix": "" - } - ] - } - ], - "output_schema_version": "V_1" - } - ] - } - ] - }, - { - "bucket": "bucket-martin-test-drift3", - "filter": [], - "id": "bucket-martin-test-drift3:Analytics2_Bucket3", - "name": "Analytics2_Bucket3", - "storage_class_analysis": [ - { - "data_export": [ - { - "destination": [ - { - "s3_bucket_destination": [ - { - "bucket_account_id": "", - "bucket_arn": "arn:aws:s3:::bucket-martin-test-drift3", - "format": "CSV", - "prefix": "" - } - ] - } - ], - "output_schema_version": "V_1" - } - ] - } - ] - }, - { - "bucket": "bucket-martin-test-drift3", - "filter": [], - "id": "bucket-martin-test-drift3:Analytics_Bucket3", - "name": "Analytics_Bucket3", - "storage_class_analysis": [ - { - "data_export": [ - { - "destination": [ - { - "s3_bucket_destination": [ - { - "bucket_account_id": "", - "bucket_arn": "arn:aws:s3:::bucket-martin-test-drift3", - "format": "CSV", - "prefix": "" - } - ] - } - ], - "output_schema_version": "V_1" - } - ] - } - ] } ] \ No newline at end of file From ca3cabe7e86c512a1540299f3e5cb67f07ab623c Mon Sep 17 00:00:00 2001 From: sundowndev Date: Thu, 18 Mar 2021 12:12:34 +0100 Subject: [PATCH 12/17] fix(remote): aws s3 bucket notification supplier Add filter on resources based on region --- .../aws/s3_bucket_notification_supplier.go | 13 +++-- .../s3_bucket_notification_supplier_test.go | 5 ++ .../results.golden.json | 52 ------------------- 3 files changed, 13 insertions(+), 57 deletions(-) diff --git a/pkg/remote/aws/s3_bucket_notification_supplier.go b/pkg/remote/aws/s3_bucket_notification_supplier.go index 92b56f18..8ecf403b 100644 --- a/pkg/remote/aws/s3_bucket_notification_supplier.go +++ b/pkg/remote/aws/s3_bucket_notification_supplier.go @@ -4,6 +4,7 @@ import ( "github.com/cloudskiff/driftctl/pkg/remote/aws/repository" "github.com/cloudskiff/driftctl/pkg/remote/deserializer" remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error" + tf "github.com/cloudskiff/driftctl/pkg/remote/terraform" "github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource/aws" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" @@ -12,10 +13,11 @@ import ( ) type S3BucketNotificationSupplier struct { - reader terraform.ResourceReader - deserializer deserializer.CTYDeserializer - repository repository.S3Repository - runner *terraform.ParallelResourceReader + reader terraform.ResourceReader + deserializer deserializer.CTYDeserializer + repository repository.S3Repository + runner *terraform.ParallelResourceReader + providerConfig tf.TerraformProviderConfig } func NewS3BucketNotificationSupplier(provider *AWSTerraformProvider, repository repository.S3Repository) *S3BucketNotificationSupplier { @@ -24,6 +26,7 @@ func NewS3BucketNotificationSupplier(provider *AWSTerraformProvider, repository awsdeserializer.NewS3BucketNotificationDeserializer(), repository, terraform.NewParallelResourceReader(provider.Runner().SubRunner()), + provider.Config, } } @@ -39,7 +42,7 @@ func (s *S3BucketNotificationSupplier) Resources() ([]resource.Resource, error) if err != nil { return nil, err } - if region == "" { + if region == "" || region != s.providerConfig.DefaultAlias { continue } s.runner.Run(func() (cty.Value, error) { diff --git a/pkg/remote/aws/s3_bucket_notification_supplier_test.go b/pkg/remote/aws/s3_bucket_notification_supplier_test.go index f37fc66f..35167ed9 100644 --- a/pkg/remote/aws/s3_bucket_notification_supplier_test.go +++ b/pkg/remote/aws/s3_bucket_notification_supplier_test.go @@ -11,6 +11,7 @@ import ( "github.com/cloudskiff/driftctl/pkg/remote/aws/client" "github.com/cloudskiff/driftctl/pkg/remote/aws/repository" remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error" + tf "github.com/cloudskiff/driftctl/pkg/remote/terraform" "github.com/cloudskiff/driftctl/pkg/resource" resourceaws "github.com/cloudskiff/driftctl/pkg/resource/aws" awsdeserializer "github.com/cloudskiff/driftctl/pkg/resource/aws/deserializer" @@ -119,6 +120,10 @@ func TestS3BucketNotificationSupplier_Resources(t *testing.T) { deserializer, &mock, terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)), + tf.TerraformProviderConfig{ + Name: "test", + DefaultAlias: "eu-west-3", + }, } got, err := s.Resources() assert.Equal(t, err, tt.wantErr) diff --git a/pkg/remote/aws/test/s3_bucket_notifications_multiple/results.golden.json b/pkg/remote/aws/test/s3_bucket_notifications_multiple/results.golden.json index 5da7e501..fb56ac1b 100755 --- a/pkg/remote/aws/test/s3_bucket_notifications_multiple/results.golden.json +++ b/pkg/remote/aws/test/s3_bucket_notifications_multiple/results.golden.json @@ -1,30 +1,4 @@ [ - { - "bucket": "bucket-martin-test-drift", - "id": "bucket-martin-test-drift", - "lambda_function": [ - { - "events": [ - "s3:ObjectCreated:*" - ], - "filter_prefix": "AWSLogs/", - "filter_suffix": ".log", - "id": "tf-s3-lambda-20201103153452592700000001", - "lambda_function_arn": "arn:aws:lambda:eu-west-1:526954929923:function:example_lambda_name1" - }, - { - "events": [ - "s3:ObjectCreated:*" - ], - "filter_prefix": "OtherLogs/", - "filter_suffix": ".log", - "id": "tf-s3-lambda-20201103153452592800000002", - "lambda_function_arn": "arn:aws:lambda:eu-west-1:526954929923:function:example_lambda_name2" - } - ], - "queue": [], - "topic": [] - }, { "bucket": "bucket-martin-test-drift2", "id": "bucket-martin-test-drift2", @@ -50,31 +24,5 @@ ], "queue": [], "topic": [] - }, - { - "bucket": "bucket-martin-test-drift3", - "id": "bucket-martin-test-drift3", - "lambda_function": [ - { - "events": [ - "s3:ObjectCreated:*" - ], - "filter_prefix": "AWSLogs/", - "filter_suffix": ".log", - "id": "tf-s3-lambda-20201103165052958300000001", - "lambda_function_arn": "arn:aws:lambda:ap-northeast-1:526954929923:function:example_lambda_name1" - }, - { - "events": [ - "s3:ObjectCreated:*" - ], - "filter_prefix": "OtherLogs/", - "filter_suffix": ".log", - "id": "tf-s3-lambda-20201103165052958400000002", - "lambda_function_arn": "arn:aws:lambda:ap-northeast-1:526954929923:function:example_lambda_name2" - } - ], - "queue": [], - "topic": [] } ] \ No newline at end of file From 357005ed7bc69bacfda1d0d324a6bbe49bc04977 Mon Sep 17 00:00:00 2001 From: sundowndev Date: Thu, 18 Mar 2021 12:26:34 +0100 Subject: [PATCH 13/17] test: cleanup mocks --- .../aws/s3_bucket_metric_supplier_test.go | 24 ------------------- ...est-drift3_Metric2_Bucket3.res.golden.json | 5 ---- ...test-drift3_Metric_Bucket3.res.golden.json | 5 ---- ...st-drift3_Metrics2_Bucket3.res.golden.json | 5 ---- ...est-drift3_Metrics_Bucket3.res.golden.json | 5 ---- ...test-drift_Metric2_Bucket1.res.golden.json | 5 ---- ...-test-drift_Metric_Bucket1.res.golden.json | 5 ---- ...est-drift_Metrics2_Bucket1.res.golden.json | 5 ---- ...test-drift_Metrics_Bucket1.res.golden.json | 5 ---- test/mocks/MockGoldenTerraformProvider.go | 2 +- 10 files changed, 1 insertion(+), 65 deletions(-) delete mode 100755 pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift3_Metric2_Bucket3.res.golden.json delete mode 100755 pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift3_Metric_Bucket3.res.golden.json delete mode 100755 pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift3_Metrics2_Bucket3.res.golden.json delete mode 100755 pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift3_Metrics_Bucket3.res.golden.json delete mode 100755 pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift_Metric2_Bucket1.res.golden.json delete mode 100755 pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift_Metric_Bucket1.res.golden.json delete mode 100755 pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift_Metrics2_Bucket1.res.golden.json delete mode 100755 pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift_Metrics_Bucket1.res.golden.json diff --git a/pkg/remote/aws/s3_bucket_metric_supplier_test.go b/pkg/remote/aws/s3_bucket_metric_supplier_test.go index 770bb9d0..5b8a8bfc 100644 --- a/pkg/remote/aws/s3_bucket_metric_supplier_test.go +++ b/pkg/remote/aws/s3_bucket_metric_supplier_test.go @@ -65,18 +65,6 @@ func TestS3BucketMetricSupplier_Resources(t *testing.T) { nil, ) - repository.On( - "ListBucketMetricsConfigurations", - &s3.Bucket{Name: awssdk.String("bucket-martin-test-drift")}, - "eu-west-1", - ).Return( - []*s3.MetricsConfiguration{ - {Id: awssdk.String("Metrics_Bucket1")}, - {Id: awssdk.String("Metrics2_Bucket1")}, - }, - nil, - ) - repository.On( "ListBucketMetricsConfigurations", &s3.Bucket{Name: awssdk.String("bucket-martin-test-drift2")}, @@ -88,18 +76,6 @@ func TestS3BucketMetricSupplier_Resources(t *testing.T) { }, nil, ) - - repository.On( - "ListBucketMetricsConfigurations", - &s3.Bucket{Name: awssdk.String("bucket-martin-test-drift3")}, - "ap-northeast-1", - ).Return( - []*s3.MetricsConfiguration{ - {Id: awssdk.String("Metrics_Bucket3")}, - {Id: awssdk.String("Metrics2_Bucket3")}, - }, - nil, - ) }, }, { diff --git a/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift3_Metric2_Bucket3.res.golden.json b/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift3_Metric2_Bucket3.res.golden.json deleted file mode 100755 index 32e6102c..00000000 --- a/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift3_Metric2_Bucket3.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYnVja2V0Ijoic3RyaW5nIiwiZmlsdGVyIjpbImxpc3QiLFsib2JqZWN0Iix7InByZWZpeCI6InN0cmluZyIsInRhZ3MiOlsibWFwIiwic3RyaW5nIl19XV0sImlkIjoic3RyaW5nIiwibmFtZSI6InN0cmluZyJ9XQ==", - "Val": "bnVsbA==", - "Err": null -} \ No newline at end of file diff --git a/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift3_Metric_Bucket3.res.golden.json b/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift3_Metric_Bucket3.res.golden.json deleted file mode 100755 index 32e6102c..00000000 --- a/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift3_Metric_Bucket3.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYnVja2V0Ijoic3RyaW5nIiwiZmlsdGVyIjpbImxpc3QiLFsib2JqZWN0Iix7InByZWZpeCI6InN0cmluZyIsInRhZ3MiOlsibWFwIiwic3RyaW5nIl19XV0sImlkIjoic3RyaW5nIiwibmFtZSI6InN0cmluZyJ9XQ==", - "Val": "bnVsbA==", - "Err": null -} \ No newline at end of file diff --git a/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift3_Metrics2_Bucket3.res.golden.json b/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift3_Metrics2_Bucket3.res.golden.json deleted file mode 100755 index 427e6e35..00000000 --- a/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift3_Metrics2_Bucket3.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYnVja2V0Ijoic3RyaW5nIiwiZmlsdGVyIjpbImxpc3QiLFsib2JqZWN0Iix7InByZWZpeCI6InN0cmluZyIsInRhZ3MiOlsibWFwIiwic3RyaW5nIl19XV0sImlkIjoic3RyaW5nIiwibmFtZSI6InN0cmluZyJ9XQ==", - "Val": "eyJidWNrZXQiOiJidWNrZXQtbWFydGluLXRlc3QtZHJpZnQzIiwiZmlsdGVyIjpudWxsLCJpZCI6ImJ1Y2tldC1tYXJ0aW4tdGVzdC1kcmlmdDM6TWV0cmljczJfQnVja2V0MyIsIm5hbWUiOiJNZXRyaWNzMl9CdWNrZXQzIn0=", - "Err": null -} \ No newline at end of file diff --git a/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift3_Metrics_Bucket3.res.golden.json b/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift3_Metrics_Bucket3.res.golden.json deleted file mode 100755 index c48b1733..00000000 --- a/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift3_Metrics_Bucket3.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYnVja2V0Ijoic3RyaW5nIiwiZmlsdGVyIjpbImxpc3QiLFsib2JqZWN0Iix7InByZWZpeCI6InN0cmluZyIsInRhZ3MiOlsibWFwIiwic3RyaW5nIl19XV0sImlkIjoic3RyaW5nIiwibmFtZSI6InN0cmluZyJ9XQ==", - "Val": "eyJidWNrZXQiOiJidWNrZXQtbWFydGluLXRlc3QtZHJpZnQzIiwiZmlsdGVyIjpudWxsLCJpZCI6ImJ1Y2tldC1tYXJ0aW4tdGVzdC1kcmlmdDM6TWV0cmljc19CdWNrZXQzIiwibmFtZSI6Ik1ldHJpY3NfQnVja2V0MyJ9", - "Err": null -} \ No newline at end of file diff --git a/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift_Metric2_Bucket1.res.golden.json b/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift_Metric2_Bucket1.res.golden.json deleted file mode 100755 index 32e6102c..00000000 --- a/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift_Metric2_Bucket1.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYnVja2V0Ijoic3RyaW5nIiwiZmlsdGVyIjpbImxpc3QiLFsib2JqZWN0Iix7InByZWZpeCI6InN0cmluZyIsInRhZ3MiOlsibWFwIiwic3RyaW5nIl19XV0sImlkIjoic3RyaW5nIiwibmFtZSI6InN0cmluZyJ9XQ==", - "Val": "bnVsbA==", - "Err": null -} \ No newline at end of file diff --git a/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift_Metric_Bucket1.res.golden.json b/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift_Metric_Bucket1.res.golden.json deleted file mode 100755 index 32e6102c..00000000 --- a/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift_Metric_Bucket1.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYnVja2V0Ijoic3RyaW5nIiwiZmlsdGVyIjpbImxpc3QiLFsib2JqZWN0Iix7InByZWZpeCI6InN0cmluZyIsInRhZ3MiOlsibWFwIiwic3RyaW5nIl19XV0sImlkIjoic3RyaW5nIiwibmFtZSI6InN0cmluZyJ9XQ==", - "Val": "bnVsbA==", - "Err": null -} \ No newline at end of file diff --git a/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift_Metrics2_Bucket1.res.golden.json b/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift_Metrics2_Bucket1.res.golden.json deleted file mode 100755 index 2244284a..00000000 --- a/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift_Metrics2_Bucket1.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYnVja2V0Ijoic3RyaW5nIiwiZmlsdGVyIjpbImxpc3QiLFsib2JqZWN0Iix7InByZWZpeCI6InN0cmluZyIsInRhZ3MiOlsibWFwIiwic3RyaW5nIl19XV0sImlkIjoic3RyaW5nIiwibmFtZSI6InN0cmluZyJ9XQ==", - "Val": "eyJidWNrZXQiOiJidWNrZXQtbWFydGluLXRlc3QtZHJpZnQiLCJmaWx0ZXIiOm51bGwsImlkIjoiYnVja2V0LW1hcnRpbi10ZXN0LWRyaWZ0Ok1ldHJpY3MyX0J1Y2tldDEiLCJuYW1lIjoiTWV0cmljczJfQnVja2V0MSJ9", - "Err": null -} \ No newline at end of file diff --git a/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift_Metrics_Bucket1.res.golden.json b/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift_Metrics_Bucket1.res.golden.json deleted file mode 100755 index 8a3d4c5e..00000000 --- a/pkg/remote/aws/test/s3_bucket_metrics_multiple/aws_s3_bucket_metric-bucket-martin-test-drift_Metrics_Bucket1.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYnVja2V0Ijoic3RyaW5nIiwiZmlsdGVyIjpbImxpc3QiLFsib2JqZWN0Iix7InByZWZpeCI6InN0cmluZyIsInRhZ3MiOlsibWFwIiwic3RyaW5nIl19XV0sImlkIjoic3RyaW5nIiwibmFtZSI6InN0cmluZyJ9XQ==", - "Val": "eyJidWNrZXQiOiJidWNrZXQtbWFydGluLXRlc3QtZHJpZnQiLCJmaWx0ZXIiOm51bGwsImlkIjoiYnVja2V0LW1hcnRpbi10ZXN0LWRyaWZ0Ok1ldHJpY3NfQnVja2V0MSIsIm5hbWUiOiJNZXRyaWNzX0J1Y2tldDEifQ==", - "Err": null -} \ No newline at end of file diff --git a/test/mocks/MockGoldenTerraformProvider.go b/test/mocks/MockGoldenTerraformProvider.go index fd6b806c..e683b6c9 100644 --- a/test/mocks/MockGoldenTerraformProvider.go +++ b/test/mocks/MockGoldenTerraformProvider.go @@ -6,9 +6,9 @@ import ( "fmt" "sort" - "github.com/cloudskiff/driftctl/pkg/terraform" "github.com/cloudskiff/driftctl/test/goldenfile" + "github.com/cloudskiff/driftctl/pkg/terraform" "github.com/hashicorp/terraform/providers" "github.com/zclconf/go-cty/cty" ctyjson "github.com/zclconf/go-cty/cty/json" From 58bd84c438061357238c2d2a9bc062fb25f345b6 Mon Sep 17 00:00:00 2001 From: sundowndev Date: Thu, 18 Mar 2021 12:28:50 +0100 Subject: [PATCH 14/17] test: cleanup mocks --- .../aws/s3_bucket_inventory_supplier_test.go | 24 ------------------- ...-drift3_Inventory2_Bucket3.res.golden.json | 5 ---- ...t-drift3_Inventory_Bucket3.res.golden.json | 5 ---- ...t-drift_Inventory2_Bucket1.res.golden.json | 5 ---- ...st-drift_Inventory_Bucket1.res.golden.json | 5 ---- 5 files changed, 44 deletions(-) delete mode 100755 pkg/remote/aws/test/s3_bucket_inventories_multiple/aws_s3_bucket_inventory-bucket-martin-test-drift3_Inventory2_Bucket3.res.golden.json delete mode 100755 pkg/remote/aws/test/s3_bucket_inventories_multiple/aws_s3_bucket_inventory-bucket-martin-test-drift3_Inventory_Bucket3.res.golden.json delete mode 100755 pkg/remote/aws/test/s3_bucket_inventories_multiple/aws_s3_bucket_inventory-bucket-martin-test-drift_Inventory2_Bucket1.res.golden.json delete mode 100755 pkg/remote/aws/test/s3_bucket_inventories_multiple/aws_s3_bucket_inventory-bucket-martin-test-drift_Inventory_Bucket1.res.golden.json diff --git a/pkg/remote/aws/s3_bucket_inventory_supplier_test.go b/pkg/remote/aws/s3_bucket_inventory_supplier_test.go index 9d3604de..28e1bed1 100644 --- a/pkg/remote/aws/s3_bucket_inventory_supplier_test.go +++ b/pkg/remote/aws/s3_bucket_inventory_supplier_test.go @@ -65,18 +65,6 @@ func TestS3BucketInventorySupplier_Resources(t *testing.T) { nil, ) - repository.On( - "ListBucketInventoryConfigurations", - &s3.Bucket{Name: awssdk.String("bucket-martin-test-drift")}, - "eu-west-1", - ).Return( - []*s3.InventoryConfiguration{ - {Id: awssdk.String("Inventory_Bucket1")}, - {Id: awssdk.String("Inventory2_Bucket1")}, - }, - nil, - ) - repository.On( "ListBucketInventoryConfigurations", &s3.Bucket{Name: awssdk.String("bucket-martin-test-drift2")}, @@ -88,18 +76,6 @@ func TestS3BucketInventorySupplier_Resources(t *testing.T) { }, nil, ) - - repository.On( - "ListBucketInventoryConfigurations", - &s3.Bucket{Name: awssdk.String("bucket-martin-test-drift3")}, - "eu-west-1", - ).Return( - []*s3.InventoryConfiguration{ - {Id: awssdk.String("Inventory_Bucket3")}, - {Id: awssdk.String("Inventory2_Bucket3")}, - }, - nil, - ) }, }, { diff --git a/pkg/remote/aws/test/s3_bucket_inventories_multiple/aws_s3_bucket_inventory-bucket-martin-test-drift3_Inventory2_Bucket3.res.golden.json b/pkg/remote/aws/test/s3_bucket_inventories_multiple/aws_s3_bucket_inventory-bucket-martin-test-drift3_Inventory2_Bucket3.res.golden.json deleted file mode 100755 index 84b1f021..00000000 --- a/pkg/remote/aws/test/s3_bucket_inventories_multiple/aws_s3_bucket_inventory-bucket-martin-test-drift3_Inventory2_Bucket3.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYnVja2V0Ijoic3RyaW5nIiwiZGVzdGluYXRpb24iOlsibGlzdCIsWyJvYmplY3QiLHsiYnVja2V0IjpbImxpc3QiLFsib2JqZWN0Iix7ImFjY291bnRfaWQiOiJzdHJpbmciLCJidWNrZXRfYXJuIjoic3RyaW5nIiwiZW5jcnlwdGlvbiI6WyJsaXN0IixbIm9iamVjdCIseyJzc2Vfa21zIjpbImxpc3QiLFsib2JqZWN0Iix7ImtleV9pZCI6InN0cmluZyJ9XV0sInNzZV9zMyI6WyJsaXN0IixbIm9iamVjdCIse31dXX1dXSwiZm9ybWF0Ijoic3RyaW5nIiwicHJlZml4Ijoic3RyaW5nIn1dXX1dXSwiZW5hYmxlZCI6ImJvb2wiLCJmaWx0ZXIiOlsibGlzdCIsWyJvYmplY3QiLHsicHJlZml4Ijoic3RyaW5nIn1dXSwiaWQiOiJzdHJpbmciLCJpbmNsdWRlZF9vYmplY3RfdmVyc2lvbnMiOiJzdHJpbmciLCJuYW1lIjoic3RyaW5nIiwib3B0aW9uYWxfZmllbGRzIjpbInNldCIsInN0cmluZyJdLCJzY2hlZHVsZSI6WyJsaXN0IixbIm9iamVjdCIseyJmcmVxdWVuY3kiOiJzdHJpbmcifV1dfV0=", - "Val": "eyJidWNrZXQiOiJidWNrZXQtbWFydGluLXRlc3QtZHJpZnQzIiwiZGVzdGluYXRpb24iOlt7ImJ1Y2tldCI6W3siYWNjb3VudF9pZCI6IiIsImJ1Y2tldF9hcm4iOiJhcm46YXdzOnMzOjo6YnVja2V0LW1hcnRpbi10ZXN0LWRyaWZ0MyIsImVuY3J5cHRpb24iOltdLCJmb3JtYXQiOiJPUkMiLCJwcmVmaXgiOiIifV19XSwiZW5hYmxlZCI6dHJ1ZSwiZmlsdGVyIjpbXSwiaWQiOiJidWNrZXQtbWFydGluLXRlc3QtZHJpZnQzOkludmVudG9yeTJfQnVja2V0MyIsImluY2x1ZGVkX29iamVjdF92ZXJzaW9ucyI6IkFsbCIsIm5hbWUiOiJJbnZlbnRvcnkyX0J1Y2tldDMiLCJvcHRpb25hbF9maWVsZHMiOltdLCJzY2hlZHVsZSI6W3siZnJlcXVlbmN5IjoiRGFpbHkifV19", - "Err": null -} \ No newline at end of file diff --git a/pkg/remote/aws/test/s3_bucket_inventories_multiple/aws_s3_bucket_inventory-bucket-martin-test-drift3_Inventory_Bucket3.res.golden.json b/pkg/remote/aws/test/s3_bucket_inventories_multiple/aws_s3_bucket_inventory-bucket-martin-test-drift3_Inventory_Bucket3.res.golden.json deleted file mode 100755 index c76161b3..00000000 --- a/pkg/remote/aws/test/s3_bucket_inventories_multiple/aws_s3_bucket_inventory-bucket-martin-test-drift3_Inventory_Bucket3.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYnVja2V0Ijoic3RyaW5nIiwiZGVzdGluYXRpb24iOlsibGlzdCIsWyJvYmplY3QiLHsiYnVja2V0IjpbImxpc3QiLFsib2JqZWN0Iix7ImFjY291bnRfaWQiOiJzdHJpbmciLCJidWNrZXRfYXJuIjoic3RyaW5nIiwiZW5jcnlwdGlvbiI6WyJsaXN0IixbIm9iamVjdCIseyJzc2Vfa21zIjpbImxpc3QiLFsib2JqZWN0Iix7ImtleV9pZCI6InN0cmluZyJ9XV0sInNzZV9zMyI6WyJsaXN0IixbIm9iamVjdCIse31dXX1dXSwiZm9ybWF0Ijoic3RyaW5nIiwicHJlZml4Ijoic3RyaW5nIn1dXX1dXSwiZW5hYmxlZCI6ImJvb2wiLCJmaWx0ZXIiOlsibGlzdCIsWyJvYmplY3QiLHsicHJlZml4Ijoic3RyaW5nIn1dXSwiaWQiOiJzdHJpbmciLCJpbmNsdWRlZF9vYmplY3RfdmVyc2lvbnMiOiJzdHJpbmciLCJuYW1lIjoic3RyaW5nIiwib3B0aW9uYWxfZmllbGRzIjpbInNldCIsInN0cmluZyJdLCJzY2hlZHVsZSI6WyJsaXN0IixbIm9iamVjdCIseyJmcmVxdWVuY3kiOiJzdHJpbmcifV1dfV0=", - "Val": "eyJidWNrZXQiOiJidWNrZXQtbWFydGluLXRlc3QtZHJpZnQzIiwiZGVzdGluYXRpb24iOlt7ImJ1Y2tldCI6W3siYWNjb3VudF9pZCI6IiIsImJ1Y2tldF9hcm4iOiJhcm46YXdzOnMzOjo6YnVja2V0LW1hcnRpbi10ZXN0LWRyaWZ0MyIsImVuY3J5cHRpb24iOltdLCJmb3JtYXQiOiJPUkMiLCJwcmVmaXgiOiIifV19XSwiZW5hYmxlZCI6dHJ1ZSwiZmlsdGVyIjpbXSwiaWQiOiJidWNrZXQtbWFydGluLXRlc3QtZHJpZnQzOkludmVudG9yeV9CdWNrZXQzIiwiaW5jbHVkZWRfb2JqZWN0X3ZlcnNpb25zIjoiQWxsIiwibmFtZSI6IkludmVudG9yeV9CdWNrZXQzIiwib3B0aW9uYWxfZmllbGRzIjpbXSwic2NoZWR1bGUiOlt7ImZyZXF1ZW5jeSI6IkRhaWx5In1dfQ==", - "Err": null -} \ No newline at end of file diff --git a/pkg/remote/aws/test/s3_bucket_inventories_multiple/aws_s3_bucket_inventory-bucket-martin-test-drift_Inventory2_Bucket1.res.golden.json b/pkg/remote/aws/test/s3_bucket_inventories_multiple/aws_s3_bucket_inventory-bucket-martin-test-drift_Inventory2_Bucket1.res.golden.json deleted file mode 100755 index 5e11909f..00000000 --- a/pkg/remote/aws/test/s3_bucket_inventories_multiple/aws_s3_bucket_inventory-bucket-martin-test-drift_Inventory2_Bucket1.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYnVja2V0Ijoic3RyaW5nIiwiZGVzdGluYXRpb24iOlsibGlzdCIsWyJvYmplY3QiLHsiYnVja2V0IjpbImxpc3QiLFsib2JqZWN0Iix7ImFjY291bnRfaWQiOiJzdHJpbmciLCJidWNrZXRfYXJuIjoic3RyaW5nIiwiZW5jcnlwdGlvbiI6WyJsaXN0IixbIm9iamVjdCIseyJzc2Vfa21zIjpbImxpc3QiLFsib2JqZWN0Iix7ImtleV9pZCI6InN0cmluZyJ9XV0sInNzZV9zMyI6WyJsaXN0IixbIm9iamVjdCIse31dXX1dXSwiZm9ybWF0Ijoic3RyaW5nIiwicHJlZml4Ijoic3RyaW5nIn1dXX1dXSwiZW5hYmxlZCI6ImJvb2wiLCJmaWx0ZXIiOlsibGlzdCIsWyJvYmplY3QiLHsicHJlZml4Ijoic3RyaW5nIn1dXSwiaWQiOiJzdHJpbmciLCJpbmNsdWRlZF9vYmplY3RfdmVyc2lvbnMiOiJzdHJpbmciLCJuYW1lIjoic3RyaW5nIiwib3B0aW9uYWxfZmllbGRzIjpbInNldCIsInN0cmluZyJdLCJzY2hlZHVsZSI6WyJsaXN0IixbIm9iamVjdCIseyJmcmVxdWVuY3kiOiJzdHJpbmcifV1dfV0=", - "Val": "eyJidWNrZXQiOiJidWNrZXQtbWFydGluLXRlc3QtZHJpZnQiLCJkZXN0aW5hdGlvbiI6W3siYnVja2V0IjpbeyJhY2NvdW50X2lkIjoiIiwiYnVja2V0X2FybiI6ImFybjphd3M6czM6OjpidWNrZXQtbWFydGluLXRlc3QtZHJpZnQiLCJlbmNyeXB0aW9uIjpbXSwiZm9ybWF0IjoiT1JDIiwicHJlZml4IjoiIn1dfV0sImVuYWJsZWQiOnRydWUsImZpbHRlciI6W10sImlkIjoiYnVja2V0LW1hcnRpbi10ZXN0LWRyaWZ0OkludmVudG9yeTJfQnVja2V0MSIsImluY2x1ZGVkX29iamVjdF92ZXJzaW9ucyI6IkFsbCIsIm5hbWUiOiJJbnZlbnRvcnkyX0J1Y2tldDEiLCJvcHRpb25hbF9maWVsZHMiOltdLCJzY2hlZHVsZSI6W3siZnJlcXVlbmN5IjoiRGFpbHkifV19", - "Err": null -} \ No newline at end of file diff --git a/pkg/remote/aws/test/s3_bucket_inventories_multiple/aws_s3_bucket_inventory-bucket-martin-test-drift_Inventory_Bucket1.res.golden.json b/pkg/remote/aws/test/s3_bucket_inventories_multiple/aws_s3_bucket_inventory-bucket-martin-test-drift_Inventory_Bucket1.res.golden.json deleted file mode 100755 index 9d3e0812..00000000 --- a/pkg/remote/aws/test/s3_bucket_inventories_multiple/aws_s3_bucket_inventory-bucket-martin-test-drift_Inventory_Bucket1.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYnVja2V0Ijoic3RyaW5nIiwiZGVzdGluYXRpb24iOlsibGlzdCIsWyJvYmplY3QiLHsiYnVja2V0IjpbImxpc3QiLFsib2JqZWN0Iix7ImFjY291bnRfaWQiOiJzdHJpbmciLCJidWNrZXRfYXJuIjoic3RyaW5nIiwiZW5jcnlwdGlvbiI6WyJsaXN0IixbIm9iamVjdCIseyJzc2Vfa21zIjpbImxpc3QiLFsib2JqZWN0Iix7ImtleV9pZCI6InN0cmluZyJ9XV0sInNzZV9zMyI6WyJsaXN0IixbIm9iamVjdCIse31dXX1dXSwiZm9ybWF0Ijoic3RyaW5nIiwicHJlZml4Ijoic3RyaW5nIn1dXX1dXSwiZW5hYmxlZCI6ImJvb2wiLCJmaWx0ZXIiOlsibGlzdCIsWyJvYmplY3QiLHsicHJlZml4Ijoic3RyaW5nIn1dXSwiaWQiOiJzdHJpbmciLCJpbmNsdWRlZF9vYmplY3RfdmVyc2lvbnMiOiJzdHJpbmciLCJuYW1lIjoic3RyaW5nIiwib3B0aW9uYWxfZmllbGRzIjpbInNldCIsInN0cmluZyJdLCJzY2hlZHVsZSI6WyJsaXN0IixbIm9iamVjdCIseyJmcmVxdWVuY3kiOiJzdHJpbmcifV1dfV0=", - "Val": "eyJidWNrZXQiOiJidWNrZXQtbWFydGluLXRlc3QtZHJpZnQiLCJkZXN0aW5hdGlvbiI6W3siYnVja2V0IjpbeyJhY2NvdW50X2lkIjoiIiwiYnVja2V0X2FybiI6ImFybjphd3M6czM6OjpidWNrZXQtbWFydGluLXRlc3QtZHJpZnQiLCJlbmNyeXB0aW9uIjpbXSwiZm9ybWF0IjoiT1JDIiwicHJlZml4IjoiIn1dfV0sImVuYWJsZWQiOnRydWUsImZpbHRlciI6W10sImlkIjoiYnVja2V0LW1hcnRpbi10ZXN0LWRyaWZ0OkludmVudG9yeV9CdWNrZXQxIiwiaW5jbHVkZWRfb2JqZWN0X3ZlcnNpb25zIjoiQWxsIiwibmFtZSI6IkludmVudG9yeV9CdWNrZXQxIiwib3B0aW9uYWxfZmllbGRzIjpbXSwic2NoZWR1bGUiOlt7ImZyZXF1ZW5jeSI6IkRhaWx5In1dfQ==", - "Err": null -} \ No newline at end of file From 47369587779a0b231edbe4607c49155c166bd8c9 Mon Sep 17 00:00:00 2001 From: sundowndev Date: Thu, 18 Mar 2021 12:34:43 +0100 Subject: [PATCH 15/17] test: cleanup mocks --- ...ket_notification-bucket-martin-test-drift.res.golden.json | 5 ----- ...et_notification-bucket-martin-test-drift3.res.golden.json | 5 ----- 2 files changed, 10 deletions(-) delete mode 100755 pkg/remote/aws/test/s3_bucket_notifications_multiple/aws_s3_bucket_notification-bucket-martin-test-drift.res.golden.json delete mode 100755 pkg/remote/aws/test/s3_bucket_notifications_multiple/aws_s3_bucket_notification-bucket-martin-test-drift3.res.golden.json diff --git a/pkg/remote/aws/test/s3_bucket_notifications_multiple/aws_s3_bucket_notification-bucket-martin-test-drift.res.golden.json b/pkg/remote/aws/test/s3_bucket_notifications_multiple/aws_s3_bucket_notification-bucket-martin-test-drift.res.golden.json deleted file mode 100755 index 541f3bbe..00000000 --- a/pkg/remote/aws/test/s3_bucket_notifications_multiple/aws_s3_bucket_notification-bucket-martin-test-drift.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYnVja2V0Ijoic3RyaW5nIiwiaWQiOiJzdHJpbmciLCJsYW1iZGFfZnVuY3Rpb24iOlsibGlzdCIsWyJvYmplY3QiLHsiZXZlbnRzIjpbInNldCIsInN0cmluZyJdLCJmaWx0ZXJfcHJlZml4Ijoic3RyaW5nIiwiZmlsdGVyX3N1ZmZpeCI6InN0cmluZyIsImlkIjoic3RyaW5nIiwibGFtYmRhX2Z1bmN0aW9uX2FybiI6InN0cmluZyJ9XV0sInF1ZXVlIjpbImxpc3QiLFsib2JqZWN0Iix7ImV2ZW50cyI6WyJzZXQiLCJzdHJpbmciXSwiZmlsdGVyX3ByZWZpeCI6InN0cmluZyIsImZpbHRlcl9zdWZmaXgiOiJzdHJpbmciLCJpZCI6InN0cmluZyIsInF1ZXVlX2FybiI6InN0cmluZyJ9XV0sInRvcGljIjpbImxpc3QiLFsib2JqZWN0Iix7ImV2ZW50cyI6WyJzZXQiLCJzdHJpbmciXSwiZmlsdGVyX3ByZWZpeCI6InN0cmluZyIsImZpbHRlcl9zdWZmaXgiOiJzdHJpbmciLCJpZCI6InN0cmluZyIsInRvcGljX2FybiI6InN0cmluZyJ9XV19XQ==", - "Val": "eyJidWNrZXQiOiJidWNrZXQtbWFydGluLXRlc3QtZHJpZnQiLCJpZCI6ImJ1Y2tldC1tYXJ0aW4tdGVzdC1kcmlmdCIsImxhbWJkYV9mdW5jdGlvbiI6W3siZXZlbnRzIjpbInMzOk9iamVjdENyZWF0ZWQ6KiJdLCJmaWx0ZXJfcHJlZml4IjoiQVdTTG9ncy8iLCJmaWx0ZXJfc3VmZml4IjoiLmxvZyIsImlkIjoidGYtczMtbGFtYmRhLTIwMjAxMTAzMTUzNDUyNTkyNzAwMDAwMDAxIiwibGFtYmRhX2Z1bmN0aW9uX2FybiI6ImFybjphd3M6bGFtYmRhOmV1LXdlc3QtMTo1MjY5NTQ5Mjk5MjM6ZnVuY3Rpb246ZXhhbXBsZV9sYW1iZGFfbmFtZTEifSx7ImV2ZW50cyI6WyJzMzpPYmplY3RDcmVhdGVkOioiXSwiZmlsdGVyX3ByZWZpeCI6Ik90aGVyTG9ncy8iLCJmaWx0ZXJfc3VmZml4IjoiLmxvZyIsImlkIjoidGYtczMtbGFtYmRhLTIwMjAxMTAzMTUzNDUyNTkyODAwMDAwMDAyIiwibGFtYmRhX2Z1bmN0aW9uX2FybiI6ImFybjphd3M6bGFtYmRhOmV1LXdlc3QtMTo1MjY5NTQ5Mjk5MjM6ZnVuY3Rpb246ZXhhbXBsZV9sYW1iZGFfbmFtZTIifV0sInF1ZXVlIjpbXSwidG9waWMiOltdfQ==", - "Err": null -} \ No newline at end of file diff --git a/pkg/remote/aws/test/s3_bucket_notifications_multiple/aws_s3_bucket_notification-bucket-martin-test-drift3.res.golden.json b/pkg/remote/aws/test/s3_bucket_notifications_multiple/aws_s3_bucket_notification-bucket-martin-test-drift3.res.golden.json deleted file mode 100755 index de96e5de..00000000 --- a/pkg/remote/aws/test/s3_bucket_notifications_multiple/aws_s3_bucket_notification-bucket-martin-test-drift3.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYnVja2V0Ijoic3RyaW5nIiwiaWQiOiJzdHJpbmciLCJsYW1iZGFfZnVuY3Rpb24iOlsibGlzdCIsWyJvYmplY3QiLHsiZXZlbnRzIjpbInNldCIsInN0cmluZyJdLCJmaWx0ZXJfcHJlZml4Ijoic3RyaW5nIiwiZmlsdGVyX3N1ZmZpeCI6InN0cmluZyIsImlkIjoic3RyaW5nIiwibGFtYmRhX2Z1bmN0aW9uX2FybiI6InN0cmluZyJ9XV0sInF1ZXVlIjpbImxpc3QiLFsib2JqZWN0Iix7ImV2ZW50cyI6WyJzZXQiLCJzdHJpbmciXSwiZmlsd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iOltdfQ==", - "Err": null -} \ No newline at end of file From 8acdf14cd68e91a97c231676454522193e0c4e4f Mon Sep 17 00:00:00 2001 From: sundowndev Date: Thu, 18 Mar 2021 12:37:27 +0100 Subject: [PATCH 16/17] test: cleanup mocks --- .../aws/s3_bucket_analytic_supplier_test.go | 24 ------------------- ...-drift3_Analytics2_Bucket3.res.golden.json | 5 ---- ...t-drift3_Analytics_Bucket3.res.golden.json | 5 ---- ...st-drift_Analytics2_Bucket.res.golden.json | 5 ---- ...t-drift_Analytics2_Bucket1.res.golden.json | 5 ---- ...est-drift_Analytics_Bucket.res.golden.json | 5 ---- ...st-drift_Analytics_Bucket1.res.golden.json | 5 ---- 7 files changed, 54 deletions(-) delete mode 100755 pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift3_Analytics2_Bucket3.res.golden.json delete mode 100755 pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift3_Analytics_Bucket3.res.golden.json delete mode 100755 pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift_Analytics2_Bucket.res.golden.json delete mode 100755 pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift_Analytics2_Bucket1.res.golden.json delete mode 100755 pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift_Analytics_Bucket.res.golden.json delete mode 100755 pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift_Analytics_Bucket1.res.golden.json diff --git a/pkg/remote/aws/s3_bucket_analytic_supplier_test.go b/pkg/remote/aws/s3_bucket_analytic_supplier_test.go index bf87da2b..fb87bdaa 100644 --- a/pkg/remote/aws/s3_bucket_analytic_supplier_test.go +++ b/pkg/remote/aws/s3_bucket_analytic_supplier_test.go @@ -67,18 +67,6 @@ func TestS3BucketAnalyticSupplier_Resources(t *testing.T) { nil, ) - repository.On( - "ListBucketAnalyticsConfigurations", - &s3.Bucket{Name: awssdk.String("bucket-martin-test-drift")}, - "eu-west-1", - ).Return( - []*s3.AnalyticsConfiguration{ - {Id: awssdk.String("Analytics_Bucket1")}, - {Id: awssdk.String("Analytics2_Bucket1")}, - }, - nil, - ) - repository.On( "ListBucketAnalyticsConfigurations", &s3.Bucket{Name: awssdk.String("bucket-martin-test-drift2")}, @@ -90,18 +78,6 @@ func TestS3BucketAnalyticSupplier_Resources(t *testing.T) { }, nil, ) - - repository.On( - "ListBucketAnalyticsConfigurations", - &s3.Bucket{Name: awssdk.String("bucket-martin-test-drift3")}, - "ap-northeast-1", - ).Return( - []*s3.AnalyticsConfiguration{ - {Id: awssdk.String("Analytics_Bucket3")}, - {Id: awssdk.String("Analytics2_Bucket3")}, - }, - nil, - ) }, }, diff --git a/pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift3_Analytics2_Bucket3.res.golden.json b/pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift3_Analytics2_Bucket3.res.golden.json deleted file mode 100755 index 2f37c86c..00000000 --- a/pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift3_Analytics2_Bucket3.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYnVja2V0Ijoic3RyaW5nIiwiZmlsdGVyIjpbImxpc3QiLFsib2JqZWN0Iix7InByZWZpeCI6InN0cmluZyIsInRhZ3MiOlsibWFwIiwic3RyaW5nIl19XV0sImlkIjoic3RyaW5nIiwibmFtZSI6InN0cmluZyIsInN0b3JhZ2VfY2xhc3NfYW5hbHlzaXMiOlsibGlzdCIsWyJvYmplY3QiLHsiZGF0YV9leHBvcnQiOlsibGlzdCIsWyJvYmplY3QiLHsiZGVzdGluYXRpb24iOlsibGlzdCIsWyJvYmplY3QiLHsiczNfYnVja2V0X2Rlc3RpbmF0aW9uIjpbImxpc3QiLFsib2JqZWN0Iix7ImJ1Y2tldF9hY2NvdW50X2lkIjoic3RyaW5nIiwiYnVja2V0X2FybiI6InN0cmluZyIsImZvcm1hdCI6InN0cmluZyIsInByZWZpeCI6InN0cmluZyJ9XV19XV0sIm91dHB1dF9zY2hlbWFfdmVyc2lvbiI6InN0cmluZyJ9XV19XV19XQ==", - "Val": "eyJidWNrZXQiOiJidWNrZXQtbWFydGluLXRlc3QtZHJpZnQzIiwiZmlsdGVyIjpbXSwiaWQiOiJidWNrZXQtbWFydGluLXRlc3QtZHJpZnQzOkFuYWx5dGljczJfQnVja2V0MyIsIm5hbWUiOiJBbmFseXRpY3MyX0J1Y2tldDMiLCJzdG9yYWdlX2NsYXNzX2FuYWx5c2lzIjpbeyJkYXRhX2V4cG9ydCI6W3siZGVzdGluYXRpb24iOlt7InMzX2J1Y2tldF9kZXN0aW5hdGlvbiI6W3siYnVja2V0X2FjY291bnRfaWQiOiIiLCJidWNrZXRfYXJuIjoiYXJuOmF3czpzMzo6OmJ1Y2tldC1tYXJ0aW4tdGVzdC1kcmlmdDMiLCJmb3JtYXQiOiJDU1YiLCJwcmVmaXgiOiIifV19XSwib3V0cHV0X3NjaGVtYV92ZXJzaW9uIjoiVl8xIn1dfV19", - "Err": null -} \ No newline at end of file diff --git a/pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift3_Analytics_Bucket3.res.golden.json b/pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift3_Analytics_Bucket3.res.golden.json deleted file mode 100755 index d48788cb..00000000 --- a/pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift3_Analytics_Bucket3.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYnVja2V0Ijoic3RyaW5nIiwiZmlsdGVyIjpbImxpc3QiLFsib2JqZWN0Iix7InByZWZpeCI6InN0cmluZyIsInRhZ3MiOlsibWFwIiwic3RyaW5nIl19XV0sImlkIjoic3RyaW5nIiwibmFtZSI6InN0cmluZyIsInN0b3JhZ2VfY2xhc3NfYW5hbHlzaXMiOlsibGlzdCIsWyJvYmplY3QiLHsiZGF0YV9leHBvcnQiOlsibGlzdCIsWyJvYmplY3QiLHsiZGVzdGluYXRpb24iOlsibGlzdCIsWyJvYmplY3QiLHsiczNfYnVja2V0X2Rlc3RpbmF0aW9uIjpbImxpc3QiLFsib2JqZWN0Iix7ImJ1Y2tldF9hY2NvdW50X2lkIjoic3RyaW5nIiwiYnVja2V0X2FybiI6InN0cmluZyIsImZvcm1hdCI6InN0cmluZyIsInByZWZpeCI6InN0cmluZyJ9XV19XV0sIm91dHB1dF9zY2hlbWFfdmVyc2lvbiI6InN0cmluZyJ9XV19XV19XQ==", - "Val": "eyJidWNrZXQiOiJidWNrZXQtbWFydGluLXRlc3QtZHJpZnQzIiwiZmlsdGVyIjpbXSwiaWQiOiJidWNrZXQtbWFydGluLXRlc3QtZHJpZnQzOkFuYWx5dGljc19CdWNrZXQzIiwibmFtZSI6IkFuYWx5dGljc19CdWNrZXQzIiwic3RvcmFnZV9jbGFzc19hbmFseXNpcyI6W3siZGF0YV9leHBvcnQiOlt7ImRlc3RpbmF0aW9uIjpbeyJzM19idWNrZXRfZGVzdGluYXRpb24iOlt7ImJ1Y2tldF9hY2NvdW50X2lkIjoiIiwiYnVja2V0X2FybiI6ImFybjphd3M6czM6OjpidWNrZXQtbWFydGluLXRlc3QtZHJpZnQzIiwiZm9ybWF0IjoiQ1NWIiwicHJlZml4IjoiIn1dfV0sIm91dHB1dF9zY2hlbWFfdmVyc2lvbiI6IlZfMSJ9XX1dfQ==", - "Err": null -} \ No newline at end of file diff --git a/pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift_Analytics2_Bucket.res.golden.json b/pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift_Analytics2_Bucket.res.golden.json deleted file mode 100755 index ca7d1c0e..00000000 --- a/pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift_Analytics2_Bucket.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYnVja2V0Ijoic3RyaW5nIiwiZmlsdGVyIjpbImxpc3QiLFsib2JqZWN0Iix7InByZWZpeCI6InN0cmluZyIsInRhZ3MiOlsibWFwIiwic3RyaW5nIl19XV0sImlkIjoic3RyaW5nIiwibmFtZSI6InN0cmluZyIsInN0b3JhZ2VfY2xhc3NfYW5hbHlzaXMiOlsibGlzdCIsWyJvYmplY3QiLHsiZGF0YV9leHBvcnQiOlsibGlzdCIsWyJvYmplY3QiLHsiZGVzdGluYXRpb24iOlsibGlzdCIsWyJvYmplY3QiLHsiczNfYnVja2V0X2Rlc3RpbmF0aW9uIjpbImxpc3QiLFsib2JqZWN0Iix7ImJ1Y2tldF9hY2NvdW50X2lkIjoic3RyaW5nIiwiYnVja2V0X2FybiI6InN0cmluZyIsImZvcm1hdCI6InN0cmluZyIsInByZWZpeCI6InN0cmluZyJ9XV19XV0sIm91dHB1dF9zY2hlbWFfdmVyc2lvbiI6InN0cmluZyJ9XV19XV19XQ==", - "Val": "bnVsbA==", - "Err": null -} \ No newline at end of file diff --git a/pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift_Analytics2_Bucket1.res.golden.json b/pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift_Analytics2_Bucket1.res.golden.json deleted file mode 100755 index cdc4db3b..00000000 --- a/pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift_Analytics2_Bucket1.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYnVja2V0Ijoic3RyaW5nIiwiZmlsdGVyIjpbImxpc3QiLFsib2JqZWN0Iix7InByZWZpeCI6InN0cmluZyIsInRhZ3MiOlsibWFwIiwic3RyaW5nIl19XV0sImlkIjoic3RyaW5nIiwibmFtZSI6InN0cmluZyIsInN0b3JhZ2VfY2xhc3NfYW5hbHlzaXMiOlsibGlzdCIsWyJvYmplY3QiLHsiZGF0YV9leHBvcnQiOlsibGlzdCIsWyJvYmplY3QiLHsiZGVzdGluYXRpb24iOlsibGlzdCIsWyJvYmplY3QiLHsiczNfYnVja2V0X2Rlc3RpbmF0aW9uIjpbImxpc3QiLFsib2JqZWN0Iix7ImJ1Y2tldF9hY2NvdW50X2lkIjoic3RyaW5nIiwiYnVja2V0X2FybiI6InN0cmluZyIsImZvcm1hdCI6InN0cmluZyIsInByZWZpeCI6InN0cmluZyJ9XV19XV0sIm91dHB1dF9zY2hlbWFfdmVyc2lvbiI6InN0cmluZyJ9XV19XV19XQ==", - "Val": "eyJidWNrZXQiOiJidWNrZXQtbWFydGluLXRlc3QtZHJpZnQiLCJmaWx0ZXIiOltdLCJpZCI6ImJ1Y2tldC1tYXJ0aW4tdGVzdC1kcmlmdDpBbmFseXRpY3MyX0J1Y2tldDEiLCJuYW1lIjoiQW5hbHl0aWNzMl9CdWNrZXQxIiwic3RvcmFnZV9jbGFzc19hbmFseXNpcyI6W3siZGF0YV9leHBvcnQiOlt7ImRlc3RpbmF0aW9uIjpbeyJzM19idWNrZXRfZGVzdGluYXRpb24iOlt7ImJ1Y2tldF9hY2NvdW50X2lkIjoiIiwiYnVja2V0X2FybiI6ImFybjphd3M6czM6OjpidWNrZXQtbWFydGluLXRlc3QtZHJpZnQiLCJmb3JtYXQiOiJDU1YiLCJwcmVmaXgiOiIifV19XSwib3V0cHV0X3NjaGVtYV92ZXJzaW9uIjoiVl8xIn1dfV19", - "Err": null -} \ No newline at end of file diff --git a/pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift_Analytics_Bucket.res.golden.json b/pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift_Analytics_Bucket.res.golden.json deleted file mode 100755 index ca7d1c0e..00000000 --- a/pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift_Analytics_Bucket.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYnVja2V0Ijoic3RyaW5nIiwiZmlsdGVyIjpbImxpc3QiLFsib2JqZWN0Iix7InByZWZpeCI6InN0cmluZyIsInRhZ3MiOlsibWFwIiwic3RyaW5nIl19XV0sImlkIjoic3RyaW5nIiwibmFtZSI6InN0cmluZyIsInN0b3JhZ2VfY2xhc3NfYW5hbHlzaXMiOlsibGlzdCIsWyJvYmplY3QiLHsiZGF0YV9leHBvcnQiOlsibGlzdCIsWyJvYmplY3QiLHsiZGVzdGluYXRpb24iOlsibGlzdCIsWyJvYmplY3QiLHsiczNfYnVja2V0X2Rlc3RpbmF0aW9uIjpbImxpc3QiLFsib2JqZWN0Iix7ImJ1Y2tldF9hY2NvdW50X2lkIjoic3RyaW5nIiwiYnVja2V0X2FybiI6InN0cmluZyIsImZvcm1hdCI6InN0cmluZyIsInByZWZpeCI6InN0cmluZyJ9XV19XV0sIm91dHB1dF9zY2hlbWFfdmVyc2lvbiI6InN0cmluZyJ9XV19XV19XQ==", - "Val": "bnVsbA==", - "Err": null -} \ No newline at end of file diff --git a/pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift_Analytics_Bucket1.res.golden.json b/pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift_Analytics_Bucket1.res.golden.json deleted file mode 100755 index b6aa58a6..00000000 --- a/pkg/remote/aws/test/s3_bucket_analytics_multiple/aws_s3_bucket_analytics_configuration-bucket-martin-test-drift_Analytics_Bucket1.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYnVja2V0Ijoic3RyaW5nIiwiZmlsdGVyIjpbImxpc3QiLFsib2JqZWN0Iix7InByZWZpeCI6InN0cmluZyIsInRhZ3MiOlsibWFwIiwic3RyaW5nIl19XV0sImlkIjoic3RyaW5nIiwibmFtZSI6InN0cmluZyIsInN0b3JhZ2VfY2xhc3NfYW5hbHlzaXMiOlsibGlzdCIsWyJvYmplY3QiLHsiZGF0YV9leHBvcnQiOlsibGlzdCIsWyJvYmplY3QiLHsiZGVzdGluYXRpb24iOlsibGlzdCIsWyJvYmplY3QiLHsiczNfYnVja2V0X2Rlc3RpbmF0aW9uIjpbImxpc3QiLFsib2JqZWN0Iix7ImJ1Y2tldF9hY2NvdW50X2lkIjoic3RyaW5nIiwiYnVja2V0X2FybiI6InN0cmluZyIsImZvcm1hdCI6InN0cmluZyIsInByZWZpeCI6InN0cmluZyJ9XV19XV0sIm91dHB1dF9zY2hlbWFfdmVyc2lvbiI6InN0cmluZyJ9XV19XV19XQ==", - "Val": "eyJidWNrZXQiOiJidWNrZXQtbWFydGluLXRlc3QtZHJpZnQiLCJmaWx0ZXIiOltdLCJpZCI6ImJ1Y2tldC1tYXJ0aW4tdGVzdC1kcmlmdDpBbmFseXRpY3NfQnVja2V0MSIsIm5hbWUiOiJBbmFseXRpY3NfQnVja2V0MSIsInN0b3JhZ2VfY2xhc3NfYW5hbHlzaXMiOlt7ImRhdGFfZXhwb3J0IjpbeyJkZXN0aW5hdGlvbiI6W3siczNfYnVja2V0X2Rlc3RpbmF0aW9uIjpbeyJidWNrZXRfYWNjb3VudF9pZCI6IiIsImJ1Y2tldF9hcm4iOiJhcm46YXdzOnMzOjo6YnVja2V0LW1hcnRpbi10ZXN0LWRyaWZ0IiwiZm9ybWF0IjoiQ1NWIiwicHJlZml4IjoiIn1dfV0sIm91dHB1dF9zY2hlbWFfdmVyc2lvbiI6IlZfMSJ9XX1dfQ==", - "Err": null -} \ No newline at end of file From 9d09280ec7336d32142d89ab6d5c28feab2e3cc8 Mon Sep 17 00:00:00 2001 From: sundowndev Date: Thu, 18 Mar 2021 13:49:25 +0100 Subject: [PATCH 17/17] test: cleanup mocks --- .../aws_s3_bucket-bucket-martin-test-drift.res.golden.json | 5 ----- ...s3_bucket_policy-bucket-martin-test-drift.res.golden.json | 5 ----- ...3_bucket_policy-bucket-martin-test-drift3.res.golden.json | 5 ----- 3 files changed, 15 deletions(-) delete mode 100755 pkg/remote/aws/test/s3_bucket_multiple/aws_s3_bucket-bucket-martin-test-drift.res.golden.json delete mode 100755 pkg/remote/aws/test/s3_bucket_policies_multiple/aws_s3_bucket_policy-bucket-martin-test-drift.res.golden.json delete mode 100755 pkg/remote/aws/test/s3_bucket_policies_multiple/aws_s3_bucket_policy-bucket-martin-test-drift3.res.golden.json diff --git a/pkg/remote/aws/test/s3_bucket_multiple/aws_s3_bucket-bucket-martin-test-drift.res.golden.json b/pkg/remote/aws/test/s3_bucket_multiple/aws_s3_bucket-bucket-martin-test-drift.res.golden.json deleted file mode 100755 index b1236e76..00000000 --- a/pkg/remote/aws/test/s3_bucket_multiple/aws_s3_bucket-bucket-martin-test-drift.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYWNjZWxlcmF0aW9uX3N0YXR1cyI6InN0cmluZyIsImFjbCI6InN0cmluZyIsImFybiI6InN0cmluZyIsImJ1Y2tldCI6InN0cmluZyIsImJ1Y2tldF9kb21haW5fbmFtZSI6InN0cmluZyIsImJ1Y2tldF9wcmVmaXgiOiJzdHJpbmciLCJidWNrZXRfcmVnaW9uYWxfZG9tYWluX25hbWUiOiJzdHJpbmciLCJjb3JzX3J1bGUiOlsibGlzdCIsWyJvYmplY3QiL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fcHJlZml4IjpudWxsLCJidWNrZXRfcmVnaW9uYWxfZG9tYWluX25hbWUiOiJidWNrZXQtbWFydGluLXRlc3QtZHJpZnQuczMuZXUtd2VzdC0xLmFtYXpvbmF3cy5jb20iLCJjb3JzX3J1bGUiOltdLCJmb3JjZV9kZXN0cm95IjpudWxsLCJncmFudCI6W10sImhvc3RlZF96b25lX2lkIjoiWjFCS0NUWEQ3NEVaUEUiLCJpZCI6ImJ1Y2tldC1tYXJ0aW4tdGVzdC1kcmlmdCIsImxpZmVjeWNsZV9ydWxlIjpbXSwibG9nZ2luZyI6W10sIm9iamVjdF9sb2NrX2NvbmZpZ3VyYXRpb24iOltdLCJwb2xpY3kiOm51bGwsInJlZ2lvbiI6ImV1LXdlc3QtMSIsInJlcGxpY2F0aW9uX2NvbmZpZ3VyYXRpb24iOltdLCJyZXF1ZXN0X3BheWVyIjoiQnVja2V0T3duZXIiLCJzZXJ2ZXJfc2lkZV9lbmNyeXB0aW9uX2NvbmZpZ3VyYXRpb24iOltdLCJ0YWdzIjp7fSwidmVyc2lvbmluZyI6W3siZW5hYmxlZCI6ZmFsc2UsIm1mYV9kZWxldGUiOmZhbHNlfV0sIndlYnNpdGUiOltdLCJ3ZWJzaXRlX2RvbWFpbiI6bnVsbCwid2Vic2l0ZV9lbmRwb2ludCI6bnVsbH0=", - "Err": null -} \ No newline at end of file diff --git a/pkg/remote/aws/test/s3_bucket_policies_multiple/aws_s3_bucket_policy-bucket-martin-test-drift.res.golden.json b/pkg/remote/aws/test/s3_bucket_policies_multiple/aws_s3_bucket_policy-bucket-martin-test-drift.res.golden.json deleted file mode 100755 index d93194fd..00000000 --- a/pkg/remote/aws/test/s3_bucket_policies_multiple/aws_s3_bucket_policy-bucket-martin-test-drift.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYnVja2V0Ijoic3RyaW5nIiwiaWQiOiJzdHJpbmciLCJwb2xpY3kiOiJzdHJpbmcifV0=", - "Val": "eyJidWNrZXQiOiJidWNrZXQtbWFydGluLXRlc3QtZHJpZnQiLCJpZCI6ImJ1Y2tldC1tYXJ0aW4tdGVzdC1kcmlmdCIsInBvbGljeSI6IntcIlZlcnNpb25cIjpcIjIwMTItMTAtMTdcIixcIlN0YXRlbWVudFwiOlt7XCJTaWRcIjpcIlB1YmxpY1JlYWRHZXRPYmplY3RcIixcIkVmZmVjdFwiOlwiQWxsb3dcIixcIlByaW5jaXBhbFwiOlwiKlwiLFwiQWN0aW9uXCI6XCJzMzpHZXRPYmplY3RcIixcIlJlc291cmNlXCI6XCJhcm46YXdzOnMzOjo6YnVja2V0LW1hcnRpbi10ZXN0LWRyaWZ0LypcIn1dfSJ9", - "Err": null -} \ No newline at end of file diff --git a/pkg/remote/aws/test/s3_bucket_policies_multiple/aws_s3_bucket_policy-bucket-martin-test-drift3.res.golden.json b/pkg/remote/aws/test/s3_bucket_policies_multiple/aws_s3_bucket_policy-bucket-martin-test-drift3.res.golden.json deleted file mode 100755 index 54743d54..00000000 --- a/pkg/remote/aws/test/s3_bucket_policies_multiple/aws_s3_bucket_policy-bucket-martin-test-drift3.res.golden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Typ": "WyJvYmplY3QiLHsiYnVja2V0Ijoic3RyaW5nIiwiaWQiOiJzdHJpbmciLCJwb2xpY3kiOiJzdHJpbmcifV0=", - "Val": "eyJidWNrZXQiOiJidWNrZXQtbWFydGluLXRlc3QtZHJpZnQzIiwiaWQiOiJidWNrZXQtbWFydGluLXRlc3QtZHJpZnQzIiwicG9saWN5Ijoie1wiVmVyc2lvblwiOlwiMjAxMi0xMC0xN1wiLFwiU3RhdGVtZW50XCI6W3tcIlNpZFwiOlwiUHVibGljUmVhZEdldE9iamVjdFwiLFwiRWZmZWN0XCI6XCJBbGxvd1wiLFwiUHJpbmNpcGFsXCI6XCIqXCIsXCJBY3Rpb25cIjpcInMzOkdldE9iamVjdFwiLFwiUmVzb3VyY2VcIjpcImFybjphd3M6czM6OjpidWNrZXQtbWFydGluLXRlc3QtZHJpZnQzLypcIn1dfSJ9", - "Err": null -} \ No newline at end of file