2020-12-09 15:31:34 +00:00
|
|
|
package aws
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/aws/aws-sdk-go/service/iam"
|
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"
|
|
|
|
|
|
|
|
"github.com/aws/aws-sdk-go/service/ec2"
|
|
|
|
"github.com/aws/aws-sdk-go/service/lambda"
|
|
|
|
"github.com/aws/aws-sdk-go/service/rds"
|
|
|
|
"github.com/aws/aws-sdk-go/service/route53"
|
|
|
|
)
|
|
|
|
|
|
|
|
const RemoteAWSTerraform = "aws+tf"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize remote (configure credentials, launch tf providers and start gRPC clients)
|
|
|
|
* Required to use Scanner
|
|
|
|
*/
|
2020-12-16 12:02:02 +00:00
|
|
|
func Init(alerter *alerter.Alerter) error {
|
2020-12-09 15:31:34 +00:00
|
|
|
provider, err := NewTerraFormProvider()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
factory := AwsClientFactory{config: provider.session}
|
|
|
|
|
|
|
|
terraform.AddProvider(terraform.AWS, provider)
|
|
|
|
resource.AddSupplier(NewS3BucketSupplier(provider.Runner().SubRunner(), factory))
|
|
|
|
resource.AddSupplier(NewS3BucketAnalyticSupplier(provider.Runner().SubRunner(), factory))
|
|
|
|
resource.AddSupplier(NewS3BucketInventorySupplier(provider.Runner().SubRunner(), factory))
|
|
|
|
resource.AddSupplier(NewS3BucketMetricSupplier(provider.Runner().SubRunner(), factory))
|
|
|
|
resource.AddSupplier(NewS3BucketNotificationSupplier(provider.Runner().SubRunner(), factory))
|
|
|
|
resource.AddSupplier(NewS3BucketPolicySupplier(provider.Runner().SubRunner(), factory))
|
|
|
|
resource.AddSupplier(NewEC2EipSupplier(provider.Runner().SubRunner(), ec2.New(provider.session)))
|
|
|
|
resource.AddSupplier(NewEC2EipAssociationSupplier(provider.Runner().SubRunner(), ec2.New(provider.session)))
|
|
|
|
resource.AddSupplier(NewEC2EbsVolumeSupplier(provider.Runner().SubRunner(), ec2.New(provider.session)))
|
|
|
|
resource.AddSupplier(NewEC2EbsSnapshotSupplier(provider.Runner().SubRunner(), ec2.New(provider.session)))
|
|
|
|
resource.AddSupplier(NewRoute53ZoneSupplier(provider.Runner().SubRunner(), route53.New(provider.session)))
|
|
|
|
resource.AddSupplier(NewRoute53RecordSupplier(provider.Runner().SubRunner(), route53.New(provider.session)))
|
|
|
|
resource.AddSupplier(NewEC2InstanceSupplier(provider.Runner().SubRunner(), ec2.New(provider.session)))
|
|
|
|
resource.AddSupplier(NewEC2AmiSupplier(provider.Runner().SubRunner(), ec2.New(provider.session)))
|
|
|
|
resource.AddSupplier(NewEC2KeyPairSupplier(provider.Runner().SubRunner(), ec2.New(provider.session)))
|
|
|
|
resource.AddSupplier(NewLambdaFunctionSupplier(provider.Runner().SubRunner(), lambda.New(provider.session)))
|
|
|
|
resource.AddSupplier(NewDBSubnetGroupSupplier(provider.Runner().SubRunner(), rds.New(provider.session)))
|
|
|
|
resource.AddSupplier(NewDBInstanceSupplier(provider.Runner().SubRunner(), rds.New(provider.session)))
|
2021-01-15 13:15:31 +00:00
|
|
|
resource.AddSupplier(NewVPCSecurityGroupSupplier(provider.Runner(), ec2.New(provider.session)))
|
2020-12-09 15:31:34 +00:00
|
|
|
resource.AddSupplier(NewIamUserSupplier(provider.Runner().SubRunner(), iam.New(provider.session)))
|
|
|
|
resource.AddSupplier(NewIamUserPolicySupplier(provider.Runner().SubRunner(), iam.New(provider.session)))
|
|
|
|
resource.AddSupplier(NewIamUserPolicyAttachmentSupplier(provider.Runner().SubRunner(), iam.New(provider.session)))
|
|
|
|
resource.AddSupplier(NewIamAccessKeySupplier(provider.Runner().SubRunner(), iam.New(provider.session)))
|
|
|
|
resource.AddSupplier(NewIamRoleSupplier(provider.Runner().SubRunner(), iam.New(provider.session)))
|
|
|
|
resource.AddSupplier(NewIamPolicySupplier(provider.Runner().SubRunner(), iam.New(provider.session)))
|
|
|
|
resource.AddSupplier(NewIamRolePolicySupplier(provider.Runner().SubRunner(), iam.New(provider.session)))
|
|
|
|
resource.AddSupplier(NewIamRolePolicyAttachmentSupplier(provider.Runner().SubRunner(), iam.New(provider.session)))
|
|
|
|
resource.AddSupplier(NewVPCSecurityGroupRuleSupplier(provider.Runner().SubRunner(), ec2.New(provider.session)))
|
2020-12-15 10:07:03 +00:00
|
|
|
resource.AddSupplier(NewVPCSupplier(provider.Runner(), ec2.New(provider.session)))
|
2021-01-07 16:53:17 +00:00
|
|
|
resource.AddSupplier(NewSubnetSupplier(provider.Runner(), ec2.New(provider.session)))
|
2021-01-14 17:11:02 +00:00
|
|
|
resource.AddSupplier(NewRouteTableSupplier(provider.Runner(), ec2.New(provider.session)))
|
|
|
|
resource.AddSupplier(NewRouteSupplier(provider.Runner(), ec2.New(provider.session)))
|
2021-01-18 14:27:31 +00:00
|
|
|
resource.AddSupplier(NewRouteTableAssociationSupplier(provider.Runner(), ec2.New(provider.session)))
|
2021-01-20 16:28:56 +00:00
|
|
|
resource.AddSupplier(NewNatGatewaySupplier(provider.Runner(), ec2.New(provider.session)))
|
2021-01-20 21:54:41 +00:00
|
|
|
resource.AddSupplier(NewInternetGatewaySupplier(provider.Runner().SubRunner(), ec2.New(provider.session)))
|
2020-12-09 15:31:34 +00:00
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|