2020-12-09 15:31:34 +00:00
|
|
|
package aws
|
|
|
|
|
|
|
|
import (
|
2020-12-16 12:02:02 +00:00
|
|
|
"github.com/cloudskiff/driftctl/pkg/alerter"
|
2020-12-09 15:31:34 +00:00
|
|
|
"github.com/cloudskiff/driftctl/pkg/resource"
|
|
|
|
"github.com/cloudskiff/driftctl/pkg/terraform"
|
|
|
|
)
|
|
|
|
|
|
|
|
const RemoteAWSTerraform = "aws+tf"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize remote (configure credentials, launch tf providers and start gRPC clients)
|
|
|
|
* Required to use Scanner
|
|
|
|
*/
|
2021-01-22 17:06:17 +00:00
|
|
|
func Init(alerter *alerter.Alerter, providerLibrary *terraform.ProviderLibrary, supplierLibrary *resource.SupplierLibrary) error {
|
2021-02-09 13:56:11 +00:00
|
|
|
provider, err := NewAWSTerraformProvider()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
err = provider.Init()
|
2020-12-09 15:31:34 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
factory := AwsClientFactory{config: provider.session}
|
|
|
|
|
2021-01-22 17:06:17 +00:00
|
|
|
providerLibrary.AddProvider(terraform.AWS, provider)
|
|
|
|
|
|
|
|
supplierLibrary.AddSupplier(NewS3BucketSupplier(provider, factory))
|
|
|
|
supplierLibrary.AddSupplier(NewS3BucketAnalyticSupplier(provider, factory))
|
|
|
|
supplierLibrary.AddSupplier(NewS3BucketInventorySupplier(provider, factory))
|
|
|
|
supplierLibrary.AddSupplier(NewS3BucketMetricSupplier(provider, factory))
|
|
|
|
supplierLibrary.AddSupplier(NewS3BucketNotificationSupplier(provider, factory))
|
|
|
|
supplierLibrary.AddSupplier(NewS3BucketPolicySupplier(provider, factory))
|
|
|
|
supplierLibrary.AddSupplier(NewEC2EipSupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewEC2EipAssociationSupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewEC2EbsVolumeSupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewEC2EbsSnapshotSupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewRoute53ZoneSupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewRoute53RecordSupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewEC2InstanceSupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewEC2AmiSupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewEC2KeyPairSupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewLambdaFunctionSupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewDBSubnetGroupSupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewDBInstanceSupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewVPCSecurityGroupSupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewIamUserSupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewIamUserPolicySupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewIamUserPolicyAttachmentSupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewIamAccessKeySupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewIamRoleSupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewIamPolicySupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewIamRolePolicySupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewIamRolePolicyAttachmentSupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewVPCSecurityGroupRuleSupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewVPCSupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewSubnetSupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewRouteTableSupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewRouteSupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewRouteTableAssociationSupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewNatGatewaySupplier(provider))
|
|
|
|
supplierLibrary.AddSupplier(NewInternetGatewaySupplier(provider))
|
2021-01-27 10:49:25 +00:00
|
|
|
supplierLibrary.AddSupplier(NewSqsQueueSupplier(provider))
|
2021-01-29 11:35:11 +00:00
|
|
|
supplierLibrary.AddSupplier(NewSqsQueuePolicySupplier(provider))
|
2021-02-02 12:02:53 +00:00
|
|
|
supplierLibrary.AddSupplier(NewSNSTopicSupplier(provider))
|
2021-02-04 15:11:51 +00:00
|
|
|
supplierLibrary.AddSupplier(NewSNSTopicPolicySupplier(provider))
|
2021-02-05 10:03:45 +00:00
|
|
|
supplierLibrary.AddSupplier(NewSNSTopicSubscriptionSupplier(provider))
|
2021-02-11 11:21:49 +00:00
|
|
|
supplierLibrary.AddSupplier(NewDynamoDBTableSupplier(provider))
|
2021-02-15 20:00:16 +00:00
|
|
|
supplierLibrary.AddSupplier(NewRoute53HealthCheckSupplier(provider))
|
2021-02-17 14:33:08 +00:00
|
|
|
supplierLibrary.AddSupplier(NewCloudfrontDistributionSupplier(provider))
|
2020-12-09 15:31:34 +00:00
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|