chore: move schema repo in driftctl
parent
1ece051636
commit
f9065269e8
|
@ -5,8 +5,6 @@ import (
|
|||
|
||||
"github.com/hashicorp/go-version"
|
||||
"github.com/hashicorp/terraform/configs/configschema"
|
||||
"github.com/hashicorp/terraform/providers"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type AttributeSchema struct {
|
||||
|
@ -53,122 +51,3 @@ func (s *Schema) IsJsonStringField(path []string) bool {
|
|||
}
|
||||
return metadata.JsonString
|
||||
}
|
||||
|
||||
type SchemaRepositoryInterface interface {
|
||||
GetSchema(resourceType string) (*Schema, bool)
|
||||
SetFlags(typ string, flags ...Flags)
|
||||
UpdateSchema(typ string, schemasMutators map[string]func(attributeSchema *AttributeSchema))
|
||||
SetNormalizeFunc(typ string, normalizeFunc func(res *Resource))
|
||||
SetHumanReadableAttributesFunc(typ string, humanReadableAttributesFunc func(res *Resource) map[string]string)
|
||||
SetDiscriminantFunc(string, func(*Resource, *Resource) bool)
|
||||
}
|
||||
|
||||
type SchemaRepository struct {
|
||||
schemas map[string]*Schema
|
||||
ProviderName string
|
||||
ProviderVersion *version.Version
|
||||
}
|
||||
|
||||
func NewSchemaRepository() *SchemaRepository {
|
||||
return &SchemaRepository{
|
||||
schemas: make(map[string]*Schema),
|
||||
}
|
||||
}
|
||||
|
||||
func (r *SchemaRepository) GetSchema(resourceType string) (*Schema, bool) {
|
||||
schema, exist := r.schemas[resourceType]
|
||||
return schema, exist
|
||||
}
|
||||
|
||||
func (r *SchemaRepository) fetchNestedBlocks(root string, metadata map[string]AttributeSchema, block map[string]*configschema.NestedBlock) {
|
||||
for s, nestedBlock := range block {
|
||||
path := s
|
||||
if root != "" {
|
||||
path = strings.Join([]string{root, s}, ".")
|
||||
}
|
||||
for s2, attr := range nestedBlock.Attributes {
|
||||
nestedPath := strings.Join([]string{path, s2}, ".")
|
||||
metadata[nestedPath] = AttributeSchema{
|
||||
ConfigSchema: *attr,
|
||||
}
|
||||
}
|
||||
r.fetchNestedBlocks(path, metadata, nestedBlock.BlockTypes)
|
||||
}
|
||||
}
|
||||
|
||||
func (r *SchemaRepository) Init(providerName, providerVersion string, schema map[string]providers.Schema) error {
|
||||
v, err := version.NewVersion(providerVersion)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
r.ProviderVersion = v
|
||||
r.ProviderName = providerName
|
||||
for typ, sch := range schema {
|
||||
attributeMetas := map[string]AttributeSchema{}
|
||||
for s, attribute := range sch.Block.Attributes {
|
||||
attributeMetas[s] = AttributeSchema{
|
||||
ConfigSchema: *attribute,
|
||||
}
|
||||
}
|
||||
|
||||
r.fetchNestedBlocks("", attributeMetas, sch.Block.BlockTypes)
|
||||
|
||||
r.schemas[typ] = &Schema{
|
||||
ProviderVersion: r.ProviderVersion,
|
||||
SchemaVersion: sch.Version,
|
||||
Attributes: attributeMetas,
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r SchemaRepository) SetFlags(typ string, flags ...Flags) {
|
||||
metadata, exist := r.GetSchema(typ)
|
||||
if !exist {
|
||||
logrus.WithFields(logrus.Fields{"type": typ}).Warning("Unable to set flags, no schema found")
|
||||
return
|
||||
}
|
||||
for _, flag := range flags {
|
||||
metadata.Flags.AddFlag(flag)
|
||||
}
|
||||
}
|
||||
|
||||
func (r *SchemaRepository) UpdateSchema(typ string, schemasMutators map[string]func(attributeSchema *AttributeSchema)) {
|
||||
for s, f := range schemasMutators {
|
||||
metadata, exist := r.GetSchema(typ)
|
||||
if !exist {
|
||||
logrus.WithFields(logrus.Fields{"type": typ}).Warning("Unable to set metadata, no schema found")
|
||||
return
|
||||
}
|
||||
m := (*metadata).Attributes[s]
|
||||
f(&m)
|
||||
(*metadata).Attributes[s] = m
|
||||
}
|
||||
}
|
||||
|
||||
func (r *SchemaRepository) SetNormalizeFunc(typ string, normalizeFunc func(res *Resource)) {
|
||||
metadata, exist := r.GetSchema(typ)
|
||||
if !exist {
|
||||
logrus.WithFields(logrus.Fields{"type": typ}).Warning("Unable to set normalize func, no schema found")
|
||||
return
|
||||
}
|
||||
(*metadata).NormalizeFunc = normalizeFunc
|
||||
}
|
||||
|
||||
func (r *SchemaRepository) SetHumanReadableAttributesFunc(typ string, humanReadableAttributesFunc func(res *Resource) map[string]string) {
|
||||
metadata, exist := r.GetSchema(typ)
|
||||
if !exist {
|
||||
logrus.WithFields(logrus.Fields{"type": typ}).Warning("Unable to add human readable attributes, no schema found")
|
||||
return
|
||||
}
|
||||
(*metadata).HumanReadableAttributesFunc = humanReadableAttributesFunc
|
||||
}
|
||||
|
||||
func (r *SchemaRepository) SetDiscriminantFunc(typ string, fn func(self, res *Resource) bool) {
|
||||
metadata, exist := r.GetSchema(typ)
|
||||
if !exist {
|
||||
logrus.WithFields(logrus.Fields{"type": typ}).Warning("Unable to set discriminant function, no schema found")
|
||||
return
|
||||
}
|
||||
(*metadata).DiscriminantFunc = fn
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
|
||||
alerter2 "github.com/snyk/driftctl/enumeration/alerter"
|
||||
|
||||
"github.com/snyk/driftctl/pkg/filter"
|
||||
|
@ -1264,7 +1266,7 @@ func TestAnalyze(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func addSchemaToRes(res *resource.Resource, repo resource.SchemaRepositoryInterface) {
|
||||
func addSchemaToRes(res *resource.Resource, repo dctlresource.SchemaRepositoryInterface) {
|
||||
schema, _ := repo.GetSchema(res.ResourceType())
|
||||
res.Sch = schema
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ import (
|
|||
"github.com/snyk/driftctl/enumeration/alerter"
|
||||
"github.com/snyk/driftctl/enumeration/remote"
|
||||
"github.com/snyk/driftctl/enumeration/remote/common"
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
"github.com/snyk/driftctl/enumeration/terraform"
|
||||
"github.com/snyk/driftctl/enumeration/terraform/lock"
|
||||
"github.com/snyk/driftctl/pkg/analyser"
|
||||
|
@ -27,10 +26,7 @@ import (
|
|||
"github.com/snyk/driftctl/pkg/iac/terraform/state"
|
||||
"github.com/snyk/driftctl/pkg/memstore"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
"github.com/snyk/driftctl/pkg/resource/aws"
|
||||
"github.com/snyk/driftctl/pkg/resource/azurerm"
|
||||
"github.com/snyk/driftctl/pkg/resource/github"
|
||||
"github.com/snyk/driftctl/pkg/resource/google"
|
||||
"github.com/snyk/driftctl/pkg/resource/schemas"
|
||||
"github.com/snyk/driftctl/pkg/telemetry"
|
||||
"github.com/snyk/driftctl/pkg/terraform/hcl"
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -291,7 +287,7 @@ func scanRun(opts *pkg.ScanOptions) error {
|
|||
iacProgress := globaloutput.NewProgress("Scanning states", "Scanned states", true)
|
||||
scanProgress := globaloutput.NewProgress("Scanning resources", "Scanned resources", false)
|
||||
|
||||
resourceSchemaRepository := resource.NewSchemaRepository()
|
||||
resourceSchemaRepository := schemas.NewSchemaRepository()
|
||||
|
||||
resFactory := dctlresource.NewDriftctlResourceFactory(resourceSchemaRepository)
|
||||
|
||||
|
@ -300,17 +296,10 @@ func scanRun(opts *pkg.ScanOptions) error {
|
|||
return err
|
||||
}
|
||||
|
||||
switch opts.To {
|
||||
case common.RemoteAWSTerraform:
|
||||
aws.InitResourcesMetadata(resourceSchemaRepository)
|
||||
case common.RemoteGithubTerraform:
|
||||
github.InitResourcesMetadata(resourceSchemaRepository)
|
||||
case common.RemoteGoogleTerraform:
|
||||
google.InitResourcesMetadata(resourceSchemaRepository)
|
||||
case common.RemoteAzureTerraform:
|
||||
azurerm.InitResourcesMetadata(resourceSchemaRepository)
|
||||
default:
|
||||
return errors.Errorf("unsupported remote '%s'", opts.To)
|
||||
providerName := common.RemoteParameter(opts.To).GetProviderAddress().Type
|
||||
err = resourceSchemaRepository.Init(providerName, opts.ProviderVersion, providerLibrary.Provider(opts.To).Schema())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Teardown
|
||||
|
@ -355,8 +344,8 @@ func scanRun(opts *pkg.ScanOptions) error {
|
|||
return err
|
||||
}
|
||||
|
||||
analysis.ProviderVersion = resourceSchemaRepository.ProviderVersion.String()
|
||||
analysis.ProviderName = resourceSchemaRepository.ProviderName
|
||||
analysis.ProviderVersion = opts.ProviderVersion
|
||||
analysis.ProviderName = opts.To
|
||||
store.Bucket(memstore.TelemetryBucket).Set("provider_name", analysis.ProviderName)
|
||||
|
||||
validOutput := false
|
||||
|
@ -377,7 +366,7 @@ func scanRun(opts *pkg.ScanOptions) error {
|
|||
}
|
||||
|
||||
globaloutput.Printf(color.WhiteString("Scan duration: %s\n", analysis.Duration.Round(time.Second)))
|
||||
globaloutput.Printf(color.WhiteString("Provider version used to scan: %s. Use --tf-provider-version to use another version.\n"), resourceSchemaRepository.ProviderVersion.String())
|
||||
globaloutput.Printf(color.WhiteString("Provider version used to scan: %s. Use --tf-provider-version to use another version.\n"), opts.ProviderVersion)
|
||||
|
||||
if !opts.DisableTelemetry {
|
||||
tl := telemetry.NewTelemetry(&build.Build{})
|
||||
|
|
|
@ -4,21 +4,19 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/snyk/driftctl/enumeration/alerter"
|
||||
resource2 "github.com/snyk/driftctl/pkg/resource"
|
||||
|
||||
"github.com/jmespath/go-jmespath"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/snyk/driftctl/pkg/memstore"
|
||||
globaloutput "github.com/snyk/driftctl/pkg/output"
|
||||
|
||||
"github.com/snyk/driftctl/enumeration/alerter"
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
"github.com/snyk/driftctl/pkg/analyser"
|
||||
"github.com/snyk/driftctl/pkg/cmd/scan/output"
|
||||
"github.com/snyk/driftctl/pkg/filter"
|
||||
"github.com/snyk/driftctl/pkg/iac/config"
|
||||
"github.com/snyk/driftctl/pkg/iac/terraform/state/backend"
|
||||
"github.com/snyk/driftctl/pkg/memstore"
|
||||
"github.com/snyk/driftctl/pkg/middlewares"
|
||||
globaloutput "github.com/snyk/driftctl/pkg/output"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
type FmtOptions struct {
|
||||
|
@ -47,26 +45,26 @@ type ScanOptions struct {
|
|||
|
||||
type DriftCTL struct {
|
||||
remoteSupplier resource.Supplier
|
||||
iacSupplier resource2.IaCSupplier
|
||||
iacSupplier dctlresource.IaCSupplier
|
||||
alerter alerter.AlerterInterface
|
||||
analyzer *analyser.Analyzer
|
||||
resourceFactory resource.ResourceFactory
|
||||
scanProgress globaloutput.Progress
|
||||
iacProgress globaloutput.Progress
|
||||
resourceSchemaRepository resource.SchemaRepositoryInterface
|
||||
resourceSchemaRepository dctlresource.SchemaRepositoryInterface
|
||||
opts *ScanOptions
|
||||
store memstore.Store
|
||||
}
|
||||
|
||||
func NewDriftCTL(remoteSupplier resource.Supplier,
|
||||
iacSupplier resource2.IaCSupplier,
|
||||
iacSupplier dctlresource.IaCSupplier,
|
||||
alerter *alerter.Alerter,
|
||||
analyzer *analyser.Analyzer,
|
||||
resFactory resource.ResourceFactory,
|
||||
opts *ScanOptions,
|
||||
scanProgress globaloutput.Progress,
|
||||
iacProgress globaloutput.Progress,
|
||||
resourceSchemaRepository resource.SchemaRepositoryInterface,
|
||||
resourceSchemaRepository dctlresource.SchemaRepositoryInterface,
|
||||
store memstore.Store) *DriftCTL {
|
||||
return &DriftCTL{
|
||||
remoteSupplier,
|
||||
|
|
|
@ -14,7 +14,6 @@ import (
|
|||
"github.com/snyk/driftctl/pkg/output"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
"github.com/snyk/driftctl/pkg/resource/aws"
|
||||
"github.com/snyk/driftctl/pkg/resource/github"
|
||||
"github.com/snyk/driftctl/test"
|
||||
testresource "github.com/snyk/driftctl/test/resource"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -31,7 +30,7 @@ type TestCase struct {
|
|||
provider *TestProvider
|
||||
stateResources []*resource.Resource
|
||||
remoteResources []*resource.Resource
|
||||
mocks func(factory resource.ResourceFactory, repo resource.SchemaRepositoryInterface)
|
||||
mocks func(factory resource.ResourceFactory, repo dctlresource.SchemaRepositoryInterface)
|
||||
assert func(t *testing.T, result *test.ScanResult, err error)
|
||||
assertStore func(*testing.T, memstore.Store)
|
||||
options *pkg.ScanOptions
|
||||
|
@ -48,8 +47,6 @@ func runTest(t *testing.T, cases TestCases) {
|
|||
}
|
||||
}
|
||||
repo := testresource.InitFakeSchemaRepository(c.provider.Name, c.provider.Version)
|
||||
aws.InitResourcesMetadata(repo)
|
||||
github.InitResourcesMetadata(repo)
|
||||
t.Run(c.name, func(t *testing.T) {
|
||||
testAlerter := alerter.NewAlerter()
|
||||
|
||||
|
@ -363,7 +360,7 @@ func TestDriftctlRun_BasicBehavior(t *testing.T) {
|
|||
},
|
||||
{
|
||||
name: "we should ignore default AWS IAM role when strict mode is disabled",
|
||||
mocks: func(factory resource.ResourceFactory, repo resource.SchemaRepositoryInterface) {
|
||||
mocks: func(factory resource.ResourceFactory, repo dctlresource.SchemaRepositoryInterface) {
|
||||
factory.(*dctlresource.MockResourceFactory).On(
|
||||
"CreateAbstractResource",
|
||||
aws.AwsIamPolicyAttachmentResourceType,
|
||||
|
@ -461,7 +458,7 @@ func TestDriftctlRun_BasicBehavior(t *testing.T) {
|
|||
},
|
||||
{
|
||||
name: "we should not ignore default AWS IAM role when strict mode is enabled",
|
||||
mocks: func(factory resource.ResourceFactory, repo resource.SchemaRepositoryInterface) {
|
||||
mocks: func(factory resource.ResourceFactory, repo dctlresource.SchemaRepositoryInterface) {
|
||||
factory.(*dctlresource.MockResourceFactory).On(
|
||||
"CreateAbstractResource",
|
||||
aws.AwsIamPolicyAttachmentResourceType,
|
||||
|
@ -559,7 +556,7 @@ func TestDriftctlRun_BasicBehavior(t *testing.T) {
|
|||
},
|
||||
{
|
||||
name: "we should not ignore default AWS IAM role when strict mode is enabled and a filter is specified",
|
||||
mocks: func(factory resource.ResourceFactory, repo resource.SchemaRepositoryInterface) {
|
||||
mocks: func(factory resource.ResourceFactory, repo dctlresource.SchemaRepositoryInterface) {
|
||||
factory.(*dctlresource.MockResourceFactory).On(
|
||||
"CreateAbstractResource",
|
||||
aws.AwsIamPolicyAttachmentResourceType,
|
||||
|
@ -790,7 +787,7 @@ func TestDriftctlRun_Middlewares(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
mocks: func(factory resource.ResourceFactory, repo resource.SchemaRepositoryInterface) {
|
||||
mocks: func(factory resource.ResourceFactory, repo dctlresource.SchemaRepositoryInterface) {
|
||||
factory.(*dctlresource.MockResourceFactory).On(
|
||||
"CreateAbstractResource",
|
||||
aws.AwsS3BucketPolicyResourceType,
|
||||
|
@ -877,7 +874,7 @@ func TestDriftctlRun_Middlewares(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
mocks: func(factory resource.ResourceFactory, repo resource.SchemaRepositoryInterface) {
|
||||
mocks: func(factory resource.ResourceFactory, repo dctlresource.SchemaRepositoryInterface) {
|
||||
foo := resource.Resource{
|
||||
Id: "vol-018c5ae89895aca4c",
|
||||
Type: "aws_ebs_volume",
|
||||
|
@ -992,7 +989,7 @@ func TestDriftctlRun_Middlewares(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
mocks: func(factory resource.ResourceFactory, repo resource.SchemaRepositoryInterface) {
|
||||
mocks: func(factory resource.ResourceFactory, repo dctlresource.SchemaRepositoryInterface) {
|
||||
factory.(*dctlresource.MockResourceFactory).On("CreateAbstractResource", "aws_route", "r-table1080289494", mock.MatchedBy(func(input map[string]interface{}) bool {
|
||||
return matchByAttributes(input, map[string]interface{}{
|
||||
"destination_cidr_block": "0.0.0.0/0",
|
||||
|
@ -1070,7 +1067,7 @@ func TestDriftctlRun_Middlewares(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
mocks: func(factory resource.ResourceFactory, repo resource.SchemaRepositoryInterface) {
|
||||
mocks: func(factory resource.ResourceFactory, repo dctlresource.SchemaRepositoryInterface) {
|
||||
factory.(*dctlresource.MockResourceFactory).On("CreateAbstractResource", "aws_sns_topic_policy", "foo", map[string]interface{}{
|
||||
"id": "foo",
|
||||
"arn": "arn",
|
||||
|
@ -1132,7 +1129,7 @@ func TestDriftctlRun_Middlewares(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
mocks: func(factory resource.ResourceFactory, repo resource.SchemaRepositoryInterface) {
|
||||
mocks: func(factory resource.ResourceFactory, repo dctlresource.SchemaRepositoryInterface) {
|
||||
factory.(*dctlresource.MockResourceFactory).On("CreateAbstractResource", "aws_sqs_queue_policy", "foo", map[string]interface{}{
|
||||
"id": "foo",
|
||||
"queue_url": "foo",
|
||||
|
@ -1344,7 +1341,7 @@ func TestDriftctlRun_Middlewares(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
mocks: func(factory resource.ResourceFactory, repo resource.SchemaRepositoryInterface) {
|
||||
mocks: func(factory resource.ResourceFactory, repo dctlresource.SchemaRepositoryInterface) {
|
||||
rule1 := resource.Resource{
|
||||
Type: aws.AwsSecurityGroupRuleResourceType,
|
||||
Id: "sgrule-1707973622",
|
||||
|
@ -1553,7 +1550,7 @@ func TestDriftctlRun_Middlewares(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
mocks: func(factory resource.ResourceFactory, repo resource.SchemaRepositoryInterface) {
|
||||
mocks: func(factory resource.ResourceFactory, repo dctlresource.SchemaRepositoryInterface) {
|
||||
factory.(*dctlresource.MockResourceFactory).On("CreateAbstractResource", aws.AwsIamPolicyAttachmentResourceType, "iduser1", map[string]interface{}{
|
||||
"id": "iduser1",
|
||||
"policy_arn": "policy_arn1",
|
||||
|
@ -1784,7 +1781,7 @@ func TestDriftctlRun_Middlewares(t *testing.T) {
|
|||
runTest(t, cases)
|
||||
}
|
||||
|
||||
func getSchema(repo resource.SchemaRepositoryInterface, resourceType string) *resource.Schema {
|
||||
func getSchema(repo dctlresource.SchemaRepositoryInterface, resourceType string) *resource.Schema {
|
||||
sch, _ := repo.GetSchema(resourceType)
|
||||
return sch
|
||||
}
|
||||
|
|
|
@ -4,16 +4,17 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
"github.com/snyk/driftctl/pkg/resource/aws"
|
||||
)
|
||||
|
||||
// Explodes policy found in aws_sns_topic from state resources to aws_sns_topic_policy resources
|
||||
type AwsSNSTopicPolicyExpander struct {
|
||||
resourceFactory resource.ResourceFactory
|
||||
resourceSchemaRepository resource.SchemaRepositoryInterface
|
||||
resourceSchemaRepository dctlresource.SchemaRepositoryInterface
|
||||
}
|
||||
|
||||
func NewAwsSNSTopicPolicyExpander(resourceFactory resource.ResourceFactory, resourceSchemaRepository resource.SchemaRepositoryInterface) AwsSNSTopicPolicyExpander {
|
||||
func NewAwsSNSTopicPolicyExpander(resourceFactory resource.ResourceFactory, resourceSchemaRepository dctlresource.SchemaRepositoryInterface) AwsSNSTopicPolicyExpander {
|
||||
return AwsSNSTopicPolicyExpander{
|
||||
resourceFactory,
|
||||
resourceSchemaRepository,
|
||||
|
|
|
@ -3,16 +3,17 @@ package middlewares
|
|||
import (
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
"github.com/snyk/driftctl/pkg/resource/aws"
|
||||
)
|
||||
|
||||
// Explodes policy found in aws_sqs_queue.policy from state resources to dedicated resources
|
||||
type AwsSQSQueuePolicyExpander struct {
|
||||
resourceFactory resource.ResourceFactory
|
||||
resourceSchemaRepository resource.SchemaRepositoryInterface
|
||||
resourceSchemaRepository dctlresource.SchemaRepositoryInterface
|
||||
}
|
||||
|
||||
func NewAwsSQSQueuePolicyExpander(resourceFactory resource.ResourceFactory, resourceSchemaRepository resource.SchemaRepositoryInterface) AwsSQSQueuePolicyExpander {
|
||||
func NewAwsSQSQueuePolicyExpander(resourceFactory resource.ResourceFactory, resourceSchemaRepository dctlresource.SchemaRepositoryInterface) AwsSQSQueuePolicyExpander {
|
||||
return AwsSQSQueuePolicyExpander{
|
||||
resourceFactory,
|
||||
resourceSchemaRepository,
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsAmiResourceType = "aws_ami"
|
||||
|
||||
func initAwsAmiMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsAmiMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsAmiResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"timeouts"})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsApiGatewayV2MappingResourceType = "aws_apigatewayv2_api_mapping"
|
||||
|
||||
func initAwsApiGatewayV2MappingMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsApiGatewayV2MappingMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetHumanReadableAttributesFunc(
|
||||
AwsApiGatewayV2MappingResourceType,
|
||||
func(res *resource.Resource) map[string]string {
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsApiGatewayV2ModelResourceType = "aws_apigatewayv2_model"
|
||||
|
||||
func initAwsApiGatewayV2ModelMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsApiGatewayV2ModelMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetHumanReadableAttributesFunc(
|
||||
AwsApiGatewayV2ModelResourceType,
|
||||
func(res *resource.Resource) map[string]string {
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsAppAutoscalingPolicyResourceType = "aws_appautoscaling_policy"
|
||||
|
||||
func initAwsAppAutoscalingPolicyMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsAppAutoscalingPolicyMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetHumanReadableAttributesFunc(AwsAppAutoscalingPolicyResourceType, func(res *resource.Resource) map[string]string {
|
||||
attrs := make(map[string]string)
|
||||
if v := res.Attributes().GetString("scalable_dimension"); v != nil && *v != "" {
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsAppAutoscalingTargetResourceType = "aws_appautoscaling_target"
|
||||
|
||||
func initAwsAppAutoscalingTargetMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsAppAutoscalingTargetMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetHumanReadableAttributesFunc(AwsAppAutoscalingTargetResourceType, func(res *resource.Resource) map[string]string {
|
||||
attrs := make(map[string]string)
|
||||
if v := res.Attributes().GetString("scalable_dimension"); v != nil && *v != "" {
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsCloudformationStackResourceType = "aws_cloudformation_stack"
|
||||
|
||||
func initAwsCloudformationStackMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsCloudformationStackMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsCloudformationStackResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"timeouts"})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsCloudfrontDistributionResourceType = "aws_cloudfront_distribution"
|
||||
|
||||
func initAwsCloudfrontDistributionMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsCloudfrontDistributionMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsCloudfrontDistributionResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"etag"})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsDbInstanceResourceType = "aws_db_instance"
|
||||
|
||||
func initAwsDbInstanceMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsDbInstanceMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsDbInstanceResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"delete_automated_backups"})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsDbSubnetGroupResourceType = "aws_db_subnet_group"
|
||||
|
||||
func initAwsDbSubnetGroupMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsDbSubnetGroupMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsDbSubnetGroupResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"name_prefix"})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsDefaultNetworkACLResourceType = "aws_default_network_acl"
|
||||
|
||||
func initAwsDefaultNetworkACLMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsDefaultNetworkACLMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsDefaultNetworkACLResourceType, func(res *resource.Resource) {
|
||||
res.Attrs.SafeDelete([]string{"default_network_acl_id"})
|
||||
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsDefaultRouteTableResourceType = "aws_default_route_table"
|
||||
|
||||
func initAwsDefaultRouteTableMetadata(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsDefaultRouteTableMetadata(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetFlags(AwsDefaultRouteTableResourceType, resource.FlagDeepMode)
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsDefaultRouteTableResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsDefaultSecurityGroupResourceType = "aws_default_security_group"
|
||||
|
||||
func initAwsDefaultSecurityGroupMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsDefaultSecurityGroupMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsDefaultSecurityGroupResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"revoke_rules_on_delete"})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsDefaultSubnetResourceType = "aws_default_subnet"
|
||||
|
||||
func initAwsDefaultSubnetMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsDefaultSubnetMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsDefaultSubnetResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"timeouts"})
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsDefaultVpcResourceType = "aws_default_vpc"
|
||||
|
||||
func initAwsDefaultVpcMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsDefaultVpcMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetFlags(AwsDefaultVpcResourceType, resource.FlagDeepMode)
|
||||
}
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsDynamodbTableResourceType = "aws_dynamodb_table"
|
||||
|
||||
func initAwsDynamodbTableMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsDynamodbTableMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsDynamodbTableResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"timeouts"})
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsEbsEncryptionByDefaultResourceType = "aws_ebs_encryption_by_default"
|
||||
|
||||
func initAwsEbsEncryptionByDefaultMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsEbsEncryptionByDefaultMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetFlags(AwsEbsEncryptionByDefaultResourceType, resource.FlagDeepMode)
|
||||
}
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsEbsSnapshotResourceType = "aws_ebs_snapshot"
|
||||
|
||||
func initAwsEbsSnapshotMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsEbsSnapshotMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsEbsSnapshotResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"timeouts"})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsEbsVolumeResourceType = "aws_ebs_volume"
|
||||
|
||||
func initAwsEbsVolumeMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsEbsVolumeMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsEbsVolumeResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"arn"})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsEcrRepositoryResourceType = "aws_ecr_repository"
|
||||
|
||||
func initAwsEcrRepositoryMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsEcrRepositoryMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsEcrRepositoryResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"timeouts"})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsEipResourceType = "aws_eip"
|
||||
|
||||
func initAwsEipMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsEipMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsEipResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"timeouts"})
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsEipAssociationResourceType = "aws_eip_association"
|
||||
|
||||
func initAwsEipAssociationMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsEipAssociationMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetFlags(AwsEipAssociationResourceType, resource.FlagDeepMode)
|
||||
}
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsIamAccessKeyResourceType = "aws_iam_access_key"
|
||||
|
||||
func initAwsIAMAccessKeyMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsIAMAccessKeyMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsIamAccessKeyResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
// As we can't read secrets from aws API once access_key created we need to set
|
||||
|
|
|
@ -3,11 +3,12 @@ package aws
|
|||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
"github.com/snyk/driftctl/pkg/helpers"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsIamPolicyResourceType = "aws_iam_policy"
|
||||
|
||||
func initAwsIAMPolicyMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsIAMPolicyMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsIamPolicyResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
jsonString, err := helpers.NormalizeJsonString((*val)["policy"])
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsIamPolicyAttachmentResourceType = "aws_iam_policy_attachment"
|
||||
|
||||
func initAwsIAMPolicyAttachmentMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsIAMPolicyAttachmentMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsIamPolicyAttachmentResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"name"})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsIamRoleResourceType = "aws_iam_role"
|
||||
|
||||
func initAwsIAMRoleMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsIAMRoleMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsIamRoleResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"force_detach_policies"})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsIamRolePolicyResourceType = "aws_iam_role_policy"
|
||||
|
||||
func initAwsIAMRolePolicyMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsIAMRolePolicyMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.UpdateSchema(AwsIamRolePolicyResourceType, map[string]func(attributeSchema *resource.AttributeSchema){
|
||||
"policy": func(attributeSchema *resource.AttributeSchema) {
|
||||
attributeSchema.JsonString = true
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsIamRolePolicyAttachmentResourceType = "aws_iam_role_policy_attachment"
|
||||
|
||||
func initAwsIamRolePolicyAttachmentMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsIamRolePolicyAttachmentMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetFlags(AwsIamRolePolicyAttachmentResourceType, resource.FlagDeepMode)
|
||||
}
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsIamUserResourceType = "aws_iam_user"
|
||||
|
||||
func initAwsIAMUserMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsIAMUserMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsIamUserResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
permissionsBoundary, exist := val.Get("permissions_boundary")
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsIamUserPolicyResourceType = "aws_iam_user_policy"
|
||||
|
||||
func initAwsIAMUserPolicyMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsIAMUserPolicyMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.UpdateSchema(AwsIamUserPolicyResourceType, map[string]func(attributeSchema *resource.AttributeSchema){
|
||||
"policy": func(attributeSchema *resource.AttributeSchema) {
|
||||
attributeSchema.JsonString = true
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsIamUserPolicyAttachmentResourceType = "aws_iam_user_policy_attachment"
|
||||
|
||||
func initAwsIamUserPolicyAttachmentMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsIamUserPolicyAttachmentMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetFlags(AwsIamUserPolicyAttachmentResourceType, resource.FlagDeepMode)
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@ package aws
|
|||
|
||||
import (
|
||||
"github.com/hashicorp/go-version"
|
||||
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsInstanceResourceType = "aws_instance"
|
||||
|
||||
func initAwsInstanceMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsInstanceMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsInstanceResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"timeouts"})
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsInternetGatewayResourceType = "aws_internet_gateway"
|
||||
|
||||
func initAwsInternetGatewayMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsInternetGatewayMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetFlags(AwsInternetGatewayResourceType, resource.FlagDeepMode)
|
||||
}
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsKeyPairResourceType = "aws_key_pair"
|
||||
|
||||
func initAwsKeyPairMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsKeyPairMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsKeyPairResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"key_name_prefix"})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsKmsAliasResourceType = "aws_kms_alias"
|
||||
|
||||
func initAwsKmsAliasMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsKmsAliasMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsKmsAliasResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"name"})
|
||||
|
|
|
@ -3,11 +3,12 @@ package aws
|
|||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
"github.com/snyk/driftctl/pkg/helpers"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsKmsKeyResourceType = "aws_kms_key"
|
||||
|
||||
func initAwsKmsKeyMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsKmsKeyMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsKmsKeyResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"deletion_window_in_days"})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsLambdaEventSourceMappingResourceType = "aws_lambda_event_source_mapping"
|
||||
|
||||
func initAwsLambdaEventSourceMappingMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsLambdaEventSourceMappingMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsLambdaEventSourceMappingResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"state_transition_reason"})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsLambdaFunctionResourceType = "aws_lambda_function"
|
||||
|
||||
func initAwsLambdaFunctionMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsLambdaFunctionMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsLambdaFunctionResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"timeouts"})
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsLaunchTemplateResourceType = "aws_launch_template"
|
||||
|
||||
func initAwsLaunchTemplateMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsLaunchTemplateMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetFlags(AwsLaunchTemplateResourceType, resource.FlagDeepMode)
|
||||
}
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsLoadBalancerResourceType = "aws_lb"
|
||||
|
||||
func initAwsLoadBalancerMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsLoadBalancerMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetHumanReadableAttributesFunc(AwsLoadBalancerResourceType, func(res *resource.Resource) map[string]string {
|
||||
return map[string]string{
|
||||
"Name": *res.Attributes().GetString("name"),
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsNatGatewayResourceType = "aws_nat_gateway"
|
||||
|
||||
func initNatGatewayMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initNatGatewayMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetFlags(AwsNatGatewayResourceType, resource.FlagDeepMode)
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsNetworkACLResourceType = "aws_network_acl"
|
||||
|
||||
func initAwsNetworkACLMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsNetworkACLMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetFlags(AwsNetworkACLResourceType, resource.FlagDeepMode)
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package aws
|
|||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
"strconv"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/hashcode"
|
||||
|
@ -161,7 +162,7 @@ var protocolsNumbers = map[string]int{
|
|||
"254": 254,
|
||||
}
|
||||
|
||||
func initAwsNetworkACLRuleMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsNetworkACLRuleMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsNetworkACLRuleResourceType, func(res *resource.Resource) {
|
||||
res.Attrs.DeleteIfDefault("icmp_code")
|
||||
res.Attrs.DeleteIfDefault("icmp_type")
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsRDSClusterResourceType = "aws_rds_cluster"
|
||||
|
||||
func initAwsRDSClusterMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsRDSClusterMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsRDSClusterResourceType, func(res *resource.Resource) {
|
||||
val := res.Attributes()
|
||||
val.SafeDelete([]string{"timeouts"})
|
||||
|
|
|
@ -2,15 +2,15 @@ package aws
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/hashcode"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
)
|
||||
|
||||
const AwsRouteResourceType = "aws_route"
|
||||
|
||||
func initAwsRouteMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsRouteMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsRouteResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"timeouts"})
|
||||
|
|
|
@ -2,13 +2,13 @@ package aws
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsRoute53HealthCheckResourceType = "aws_route53_health_check"
|
||||
|
||||
func initAwsRoute53HealthCheckMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsRoute53HealthCheckMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetHumanReadableAttributesFunc(AwsRoute53HealthCheckResourceType, func(res *resource.Resource) map[string]string {
|
||||
val := res.Attrs
|
||||
attrs := make(map[string]string)
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsRoute53RecordResourceType = "aws_route53_record"
|
||||
|
||||
func initAwsRoute53RecordMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsRoute53RecordMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsRoute53RecordResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.DeleteIfDefault("health_check_id")
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsRoute53ZoneResourceType = "aws_route53_zone"
|
||||
|
||||
func initAwsRoute53ZoneMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsRoute53ZoneMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsRoute53ZoneResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"force_destroy"})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsRouteTableResourceType = "aws_route_table"
|
||||
|
||||
func initAwsRouteTableMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsRouteTableMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetFlags(AwsRouteTableResourceType, resource.FlagDeepMode)
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsRouteTableResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsRouteTableAssociationResourceType = "aws_route_table_association"
|
||||
|
||||
func initAwsRouteTableAssociationMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsRouteTableAssociationMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetHumanReadableAttributesFunc(AwsRouteTableAssociationResourceType, func(res *resource.Resource) map[string]string {
|
||||
val := res.Attrs
|
||||
attrs := make(map[string]string)
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsS3BucketResourceType = "aws_s3_bucket"
|
||||
|
||||
func initAwsS3BucketMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsS3BucketMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsS3BucketResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"force_destroy"})
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsS3BucketAnalyticsConfigurationResourceType = "aws_s3_bucket_analytics_configuration"
|
||||
|
||||
func initAwsS3BucketAnalyticsConfigurationMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsS3BucketAnalyticsConfigurationMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetFlags(AwsS3BucketAnalyticsConfigurationResourceType, resource.FlagDeepMode)
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsS3BucketInventoryResourceType = "aws_s3_bucket_inventory"
|
||||
|
||||
func initAwsS3BucketInventoryMetadata(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsS3BucketInventoryMetadata(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetFlags(AwsS3BucketInventoryResourceType, resource.FlagDeepMode)
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsS3BucketMetricResourceType = "aws_s3_bucket_metric"
|
||||
|
||||
func initAwsS3BucketMetricMetadata(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsS3BucketMetricMetadata(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetFlags(AwsS3BucketMetricResourceType, resource.FlagDeepMode)
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsS3BucketNotificationResourceType = "aws_s3_bucket_notification"
|
||||
|
||||
func initAwsS3BucketNotificationMetadata(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsS3BucketNotificationMetadata(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetFlags(AwsS3BucketNotificationResourceType, resource.FlagDeepMode)
|
||||
}
|
||||
|
|
|
@ -3,11 +3,12 @@ package aws
|
|||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
"github.com/snyk/driftctl/pkg/helpers"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsS3BucketPolicyResourceType = "aws_s3_bucket_policy"
|
||||
|
||||
func initAwsS3BucketPolicyMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsS3BucketPolicyMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsS3BucketPolicyResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
jsonString, err := helpers.NormalizeJsonString((*val)["policy"])
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsSecurityGroupResourceType = "aws_security_group"
|
||||
|
||||
func initAwsSecurityGroupMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsSecurityGroupMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsSecurityGroupResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"revoke_rules_on_delete"})
|
||||
|
|
|
@ -3,6 +3,7 @@ package aws
|
|||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/hashcode"
|
||||
|
@ -11,7 +12,7 @@ import (
|
|||
|
||||
const AwsSecurityGroupRuleResourceType = "aws_security_group_rule"
|
||||
|
||||
func initAwsSecurityGroupRuleMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsSecurityGroupRuleMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsSecurityGroupRuleResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.DeleteIfDefault("security_group_id")
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsSnsTopicResourceType = "aws_sns_topic"
|
||||
|
||||
func initSnsTopicMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initSnsTopicMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsSnsTopicResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.DeleteIfDefault("sqs_success_feedback_sample_rate")
|
||||
|
|
|
@ -3,11 +3,12 @@ package aws
|
|||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
"github.com/snyk/driftctl/pkg/helpers"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsSnsTopicPolicyResourceType = "aws_sns_topic_policy"
|
||||
|
||||
func initSnsTopicPolicyMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initSnsTopicPolicyMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsSnsTopicPolicyResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"owner"})
|
||||
|
|
|
@ -3,11 +3,12 @@ package aws
|
|||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
"github.com/snyk/driftctl/pkg/helpers"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsSnsTopicSubscriptionResourceType = "aws_sns_topic_subscription"
|
||||
|
||||
func initSnsTopicSubscriptionMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initSnsTopicSubscriptionMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsSnsTopicSubscriptionResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
jsonString, err := helpers.NormalizeJsonString((*val)["delivery_policy"])
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsSqsQueueResourceType = "aws_sqs_queue"
|
||||
|
||||
func initSqsQueueMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initSqsQueueMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetFlags(AwsSqsQueueResourceType, resource.FlagDeepMode)
|
||||
}
|
||||
|
|
|
@ -3,11 +3,12 @@ package aws
|
|||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
"github.com/snyk/driftctl/pkg/helpers"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsSqsQueuePolicyResourceType = "aws_sqs_queue_policy"
|
||||
|
||||
func initAwsSQSQueuePolicyMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsSQSQueuePolicyMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsSqsQueuePolicyResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
jsonString, err := helpers.NormalizeJsonString((*val)["policy"])
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsSubnetResourceType = "aws_subnet"
|
||||
|
||||
func initAwsSubnetMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsSubnetMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AwsSubnetResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"timeouts"})
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AwsVpcResourceType = "aws_vpc"
|
||||
|
||||
func initAwsVpcMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAwsVpcMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetFlags(AwsVpcResourceType, resource.FlagDeepMode)
|
||||
}
|
||||
|
|
|
@ -1,125 +1,126 @@
|
|||
package aws
|
||||
package aws_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
"github.com/snyk/driftctl/pkg/resource/aws"
|
||||
testresource "github.com/snyk/driftctl/test/resource"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestAWS_Metadata_Flags(t *testing.T) {
|
||||
testcases := map[string][]resource.Flags{
|
||||
AwsAmiResourceType: {resource.FlagDeepMode},
|
||||
AwsApiGatewayAccountResourceType: {},
|
||||
AwsApiGatewayApiKeyResourceType: {},
|
||||
AwsApiGatewayAuthorizerResourceType: {},
|
||||
AwsApiGatewayBasePathMappingResourceType: {},
|
||||
AwsApiGatewayDeploymentResourceType: {},
|
||||
AwsApiGatewayDomainNameResourceType: {},
|
||||
AwsApiGatewayGatewayResponseResourceType: {},
|
||||
AwsApiGatewayIntegrationResourceType: {},
|
||||
AwsApiGatewayIntegrationResponseResourceType: {},
|
||||
AwsApiGatewayMethodResourceType: {},
|
||||
AwsApiGatewayMethodResponseResourceType: {},
|
||||
AwsApiGatewayMethodSettingsResourceType: {},
|
||||
AwsApiGatewayModelResourceType: {},
|
||||
AwsApiGatewayRequestValidatorResourceType: {},
|
||||
AwsApiGatewayResourceResourceType: {},
|
||||
AwsApiGatewayRestApiResourceType: {},
|
||||
AwsApiGatewayRestApiPolicyResourceType: {},
|
||||
AwsApiGatewayStageResourceType: {},
|
||||
AwsApiGatewayVpcLinkResourceType: {},
|
||||
AwsApiGatewayV2ApiResourceType: {},
|
||||
AwsApiGatewayV2RouteResourceType: {},
|
||||
AwsApiGatewayV2DeploymentResourceType: {},
|
||||
AwsApiGatewayV2VpcLinkResourceType: {},
|
||||
AwsApiGatewayV2AuthorizerResourceType: {},
|
||||
AwsApiGatewayV2RouteResponseResourceType: {},
|
||||
AwsApiGatewayV2DomainNameResourceType: {},
|
||||
AwsApiGatewayV2ModelResourceType: {},
|
||||
AwsApiGatewayV2StageResourceType: {},
|
||||
AwsApiGatewayV2MappingResourceType: {},
|
||||
AwsApiGatewayV2IntegrationResourceType: {},
|
||||
AwsApiGatewayV2IntegrationResponseResourceType: {},
|
||||
AwsAppAutoscalingPolicyResourceType: {resource.FlagDeepMode},
|
||||
AwsAppAutoscalingScheduledActionResourceType: {},
|
||||
AwsAppAutoscalingTargetResourceType: {resource.FlagDeepMode},
|
||||
AwsCloudformationStackResourceType: {resource.FlagDeepMode},
|
||||
AwsCloudfrontDistributionResourceType: {resource.FlagDeepMode},
|
||||
AwsDbInstanceResourceType: {resource.FlagDeepMode},
|
||||
AwsDbSubnetGroupResourceType: {resource.FlagDeepMode},
|
||||
AwsDefaultNetworkACLResourceType: {resource.FlagDeepMode},
|
||||
AwsDefaultRouteTableResourceType: {resource.FlagDeepMode},
|
||||
AwsDefaultSecurityGroupResourceType: {resource.FlagDeepMode},
|
||||
AwsDefaultSubnetResourceType: {resource.FlagDeepMode},
|
||||
AwsDefaultVpcResourceType: {resource.FlagDeepMode},
|
||||
AwsDynamodbTableResourceType: {resource.FlagDeepMode},
|
||||
AwsEbsEncryptionByDefaultResourceType: {resource.FlagDeepMode},
|
||||
AwsEbsSnapshotResourceType: {resource.FlagDeepMode},
|
||||
AwsEbsVolumeResourceType: {resource.FlagDeepMode},
|
||||
AwsEcrRepositoryResourceType: {resource.FlagDeepMode},
|
||||
AwsEipResourceType: {resource.FlagDeepMode},
|
||||
AwsEipAssociationResourceType: {resource.FlagDeepMode},
|
||||
AwsElastiCacheClusterResourceType: {},
|
||||
AwsIamAccessKeyResourceType: {resource.FlagDeepMode},
|
||||
AwsIamPolicyResourceType: {resource.FlagDeepMode},
|
||||
AwsIamPolicyAttachmentResourceType: {resource.FlagDeepMode},
|
||||
AwsIamRoleResourceType: {resource.FlagDeepMode},
|
||||
AwsIamRolePolicyResourceType: {resource.FlagDeepMode},
|
||||
AwsIamRolePolicyAttachmentResourceType: {resource.FlagDeepMode},
|
||||
AwsIamUserResourceType: {resource.FlagDeepMode},
|
||||
AwsIamUserPolicyResourceType: {resource.FlagDeepMode},
|
||||
AwsIamUserPolicyAttachmentResourceType: {resource.FlagDeepMode},
|
||||
AwsIamGroupPolicyResourceType: {},
|
||||
AwsIamGroupPolicyAttachmentResourceType: {},
|
||||
AwsInstanceResourceType: {resource.FlagDeepMode},
|
||||
AwsInternetGatewayResourceType: {resource.FlagDeepMode},
|
||||
AwsKeyPairResourceType: {resource.FlagDeepMode},
|
||||
AwsKmsAliasResourceType: {resource.FlagDeepMode},
|
||||
AwsKmsKeyResourceType: {resource.FlagDeepMode},
|
||||
AwsLambdaEventSourceMappingResourceType: {resource.FlagDeepMode},
|
||||
AwsLambdaFunctionResourceType: {resource.FlagDeepMode},
|
||||
AwsNatGatewayResourceType: {resource.FlagDeepMode},
|
||||
AwsNetworkACLResourceType: {resource.FlagDeepMode},
|
||||
AwsRDSClusterResourceType: {resource.FlagDeepMode},
|
||||
AwsRDSClusterInstanceResourceType: {},
|
||||
AwsRouteResourceType: {resource.FlagDeepMode},
|
||||
AwsRoute53HealthCheckResourceType: {resource.FlagDeepMode},
|
||||
AwsRoute53RecordResourceType: {resource.FlagDeepMode},
|
||||
AwsRoute53ZoneResourceType: {resource.FlagDeepMode},
|
||||
AwsRouteTableResourceType: {resource.FlagDeepMode},
|
||||
AwsRouteTableAssociationResourceType: {resource.FlagDeepMode},
|
||||
AwsS3BucketResourceType: {resource.FlagDeepMode},
|
||||
AwsS3BucketAnalyticsConfigurationResourceType: {resource.FlagDeepMode},
|
||||
AwsS3BucketInventoryResourceType: {resource.FlagDeepMode},
|
||||
AwsS3BucketMetricResourceType: {resource.FlagDeepMode},
|
||||
AwsS3BucketNotificationResourceType: {resource.FlagDeepMode},
|
||||
AwsS3BucketPolicyResourceType: {resource.FlagDeepMode},
|
||||
AwsS3BucketPublicAccessBlockResourceType: {},
|
||||
AwsSecurityGroupResourceType: {resource.FlagDeepMode},
|
||||
AwsSnsTopicResourceType: {resource.FlagDeepMode},
|
||||
AwsSnsTopicPolicyResourceType: {resource.FlagDeepMode},
|
||||
AwsSnsTopicSubscriptionResourceType: {resource.FlagDeepMode},
|
||||
AwsSqsQueueResourceType: {resource.FlagDeepMode},
|
||||
AwsSqsQueuePolicyResourceType: {resource.FlagDeepMode},
|
||||
AwsSubnetResourceType: {resource.FlagDeepMode},
|
||||
AwsVpcResourceType: {resource.FlagDeepMode},
|
||||
AwsSecurityGroupRuleResourceType: {resource.FlagDeepMode},
|
||||
AwsNetworkACLRuleResourceType: {resource.FlagDeepMode},
|
||||
AwsLaunchTemplateResourceType: {resource.FlagDeepMode},
|
||||
AwsLaunchConfigurationResourceType: {},
|
||||
AwsLoadBalancerResourceType: {},
|
||||
AwsApplicationLoadBalancerResourceType: {},
|
||||
AwsClassicLoadBalancerResourceType: {},
|
||||
AwsLoadBalancerListenerResourceType: {},
|
||||
AwsApplicationLoadBalancerListenerResourceType: {},
|
||||
AwsIamGroupResourceType: {},
|
||||
AwsEcrRepositoryPolicyResourceType: {},
|
||||
aws.AwsAmiResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsApiGatewayAccountResourceType: {},
|
||||
aws.AwsApiGatewayApiKeyResourceType: {},
|
||||
aws.AwsApiGatewayAuthorizerResourceType: {},
|
||||
aws.AwsApiGatewayBasePathMappingResourceType: {},
|
||||
aws.AwsApiGatewayDeploymentResourceType: {},
|
||||
aws.AwsApiGatewayDomainNameResourceType: {},
|
||||
aws.AwsApiGatewayGatewayResponseResourceType: {},
|
||||
aws.AwsApiGatewayIntegrationResourceType: {},
|
||||
aws.AwsApiGatewayIntegrationResponseResourceType: {},
|
||||
aws.AwsApiGatewayMethodResourceType: {},
|
||||
aws.AwsApiGatewayMethodResponseResourceType: {},
|
||||
aws.AwsApiGatewayMethodSettingsResourceType: {},
|
||||
aws.AwsApiGatewayModelResourceType: {},
|
||||
aws.AwsApiGatewayRequestValidatorResourceType: {},
|
||||
aws.AwsApiGatewayResourceResourceType: {},
|
||||
aws.AwsApiGatewayRestApiResourceType: {},
|
||||
aws.AwsApiGatewayRestApiPolicyResourceType: {},
|
||||
aws.AwsApiGatewayStageResourceType: {},
|
||||
aws.AwsApiGatewayVpcLinkResourceType: {},
|
||||
aws.AwsApiGatewayV2ApiResourceType: {},
|
||||
aws.AwsApiGatewayV2RouteResourceType: {},
|
||||
aws.AwsApiGatewayV2DeploymentResourceType: {},
|
||||
aws.AwsApiGatewayV2VpcLinkResourceType: {},
|
||||
aws.AwsApiGatewayV2AuthorizerResourceType: {},
|
||||
aws.AwsApiGatewayV2RouteResponseResourceType: {},
|
||||
aws.AwsApiGatewayV2DomainNameResourceType: {},
|
||||
aws.AwsApiGatewayV2ModelResourceType: {},
|
||||
aws.AwsApiGatewayV2StageResourceType: {},
|
||||
aws.AwsApiGatewayV2MappingResourceType: {},
|
||||
aws.AwsApiGatewayV2IntegrationResourceType: {},
|
||||
aws.AwsApiGatewayV2IntegrationResponseResourceType: {},
|
||||
aws.AwsAppAutoscalingPolicyResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsAppAutoscalingScheduledActionResourceType: {},
|
||||
aws.AwsAppAutoscalingTargetResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsCloudformationStackResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsCloudfrontDistributionResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsDbInstanceResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsDbSubnetGroupResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsDefaultNetworkACLResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsDefaultRouteTableResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsDefaultSecurityGroupResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsDefaultSubnetResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsDefaultVpcResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsDynamodbTableResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsEbsEncryptionByDefaultResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsEbsSnapshotResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsEbsVolumeResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsEcrRepositoryResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsEipResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsEipAssociationResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsElastiCacheClusterResourceType: {},
|
||||
aws.AwsIamAccessKeyResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsIamPolicyResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsIamPolicyAttachmentResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsIamRoleResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsIamRolePolicyResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsIamRolePolicyAttachmentResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsIamUserResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsIamUserPolicyResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsIamUserPolicyAttachmentResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsIamGroupPolicyResourceType: {},
|
||||
aws.AwsIamGroupPolicyAttachmentResourceType: {},
|
||||
aws.AwsInstanceResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsInternetGatewayResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsKeyPairResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsKmsAliasResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsKmsKeyResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsLambdaEventSourceMappingResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsLambdaFunctionResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsNatGatewayResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsNetworkACLResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsRDSClusterResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsRDSClusterInstanceResourceType: {},
|
||||
aws.AwsRouteResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsRoute53HealthCheckResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsRoute53RecordResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsRoute53ZoneResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsRouteTableResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsRouteTableAssociationResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsS3BucketResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsS3BucketAnalyticsConfigurationResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsS3BucketInventoryResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsS3BucketMetricResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsS3BucketNotificationResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsS3BucketPolicyResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsS3BucketPublicAccessBlockResourceType: {},
|
||||
aws.AwsSecurityGroupResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsSnsTopicResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsSnsTopicPolicyResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsSnsTopicSubscriptionResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsSqsQueueResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsSqsQueuePolicyResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsSubnetResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsVpcResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsSecurityGroupRuleResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsNetworkACLRuleResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsLaunchTemplateResourceType: {resource.FlagDeepMode},
|
||||
aws.AwsLaunchConfigurationResourceType: {},
|
||||
aws.AwsLoadBalancerResourceType: {},
|
||||
aws.AwsApplicationLoadBalancerResourceType: {},
|
||||
aws.AwsClassicLoadBalancerResourceType: {},
|
||||
aws.AwsLoadBalancerListenerResourceType: {},
|
||||
aws.AwsApplicationLoadBalancerListenerResourceType: {},
|
||||
aws.AwsIamGroupResourceType: {},
|
||||
aws.AwsEcrRepositoryPolicyResourceType: {},
|
||||
}
|
||||
|
||||
schemaRepository := testresource.InitFakeSchemaRepository("aws", "3.19.0")
|
||||
InitResourcesMetadata(schemaRepository)
|
||||
aws.InitResourcesMetadata(schemaRepository)
|
||||
|
||||
for ty, flags := range testcases {
|
||||
t.Run(ty, func(tt *testing.T) {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package aws
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
func InitResourcesMetadata(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
initAwsAmiMetaData(resourceSchemaRepository)
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package azurerm
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AzureContainerRegistryResourceType = "azurerm_container_registry"
|
||||
|
||||
func initAzureContainerRegistryMetadata(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAzureContainerRegistryMetadata(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetHumanReadableAttributesFunc(AzureContainerRegistryResourceType, func(res *resource.Resource) map[string]string {
|
||||
val := res.Attrs
|
||||
attrs := make(map[string]string)
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package azurerm
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AzureFirewallResourceType = "azurerm_firewall"
|
||||
|
||||
func initAzureFirewallMetadata(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAzureFirewallMetadata(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetHumanReadableAttributesFunc(AzureFirewallResourceType, func(res *resource.Resource) map[string]string {
|
||||
val := res.Attrs
|
||||
attrs := make(map[string]string)
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package azurerm
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AzureImageResourceType = "azurerm_image"
|
||||
|
||||
func initAzureImageMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAzureImageMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetHumanReadableAttributesFunc(AzureImageResourceType, func(res *resource.Resource) map[string]string {
|
||||
attrs := make(map[string]string)
|
||||
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package azurerm
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AzureLoadBalancerResourceType = "azurerm_lb"
|
||||
|
||||
func initAzureLoadBalancerMetadata(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAzureLoadBalancerMetadata(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetHumanReadableAttributesFunc(AzureLoadBalancerResourceType, func(res *resource.Resource) map[string]string {
|
||||
val := res.Attrs
|
||||
attrs := make(map[string]string)
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package azurerm
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AzureLoadBalancerRuleResourceType = "azurerm_lb_rule"
|
||||
|
||||
func initAzureLoadBalancerRuleMetadata(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAzureLoadBalancerRuleMetadata(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AzureLoadBalancerRuleResourceType, func(res *resource.Resource) {
|
||||
res.Attributes().SafeDelete([]string{"timeouts"})
|
||||
})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package azurerm
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AzureNetworkSecurityGroupResourceType = "azurerm_network_security_group"
|
||||
|
||||
func initAzureNetworkSecurityGroupMetadata(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAzureNetworkSecurityGroupMetadata(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AzureNetworkSecurityGroupResourceType, func(res *resource.Resource) {
|
||||
res.Attributes().SafeDelete([]string{"timeouts"})
|
||||
})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package azurerm
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AzurePostgresqlDatabaseResourceType = "azurerm_postgresql_database"
|
||||
|
||||
func initAzurePostgresqlDatabaseMetadata(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAzurePostgresqlDatabaseMetadata(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetHumanReadableAttributesFunc(AzurePostgresqlDatabaseResourceType, func(res *resource.Resource) map[string]string {
|
||||
val := res.Attrs
|
||||
attrs := make(map[string]string)
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package azurerm
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AzurePostgresqlServerResourceType = "azurerm_postgresql_server"
|
||||
|
||||
func initAzurePostgresqlServerMetadata(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAzurePostgresqlServerMetadata(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetHumanReadableAttributesFunc(AzurePostgresqlServerResourceType, func(res *resource.Resource) map[string]string {
|
||||
val := res.Attrs
|
||||
attrs := make(map[string]string)
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package azurerm
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AzurePrivateDNSARecordResourceType = "azurerm_private_dns_a_record"
|
||||
|
||||
func initAzurePrivateDNSARecordMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAzurePrivateDNSARecordMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AzurePrivateDNSARecordResourceType, func(res *resource.Resource) {
|
||||
res.Attributes().SafeDelete([]string{"timeouts"})
|
||||
})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package azurerm
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AzurePrivateDNSAAAARecordResourceType = "azurerm_private_dns_aaaa_record"
|
||||
|
||||
func initAzurePrivateDNSAAAARecordMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAzurePrivateDNSAAAARecordMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AzurePrivateDNSAAAARecordResourceType, func(res *resource.Resource) {
|
||||
res.Attributes().SafeDelete([]string{"timeouts"})
|
||||
})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package azurerm
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AzurePrivateDNSCNameRecordResourceType = "azurerm_private_dns_cname_record"
|
||||
|
||||
func initAzurePrivateDNSCNameRecordMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAzurePrivateDNSCNameRecordMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AzurePrivateDNSCNameRecordResourceType, func(res *resource.Resource) {
|
||||
res.Attributes().SafeDelete([]string{"timeouts"})
|
||||
})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package azurerm
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AzurePrivateDNSMXRecordResourceType = "azurerm_private_dns_mx_record"
|
||||
|
||||
func initAzurePrivateDNSMXRecordMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAzurePrivateDNSMXRecordMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AzurePrivateDNSMXRecordResourceType, func(res *resource.Resource) {
|
||||
res.Attributes().SafeDelete([]string{"timeouts"})
|
||||
})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package azurerm
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AzurePrivateDNSPTRRecordResourceType = "azurerm_private_dns_ptr_record"
|
||||
|
||||
func initAzurePrivateDNSPTRRecordMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAzurePrivateDNSPTRRecordMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AzurePrivateDNSPTRRecordResourceType, func(res *resource.Resource) {
|
||||
res.Attributes().SafeDelete([]string{"timeouts"})
|
||||
})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package azurerm
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AzurePrivateDNSSRVRecordResourceType = "azurerm_private_dns_srv_record"
|
||||
|
||||
func initAzurePrivateDNSSRVRecordMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAzurePrivateDNSSRVRecordMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AzurePrivateDNSSRVRecordResourceType, func(res *resource.Resource) {
|
||||
res.Attributes().SafeDelete([]string{"timeouts"})
|
||||
})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package azurerm
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AzurePrivateDNSTXTRecordResourceType = "azurerm_private_dns_txt_record"
|
||||
|
||||
func initAzurePrivateDNSTXTRecordMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAzurePrivateDNSTXTRecordMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AzurePrivateDNSTXTRecordResourceType, func(res *resource.Resource) {
|
||||
res.Attributes().SafeDelete([]string{"timeouts"})
|
||||
})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package azurerm
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AzurePrivateDNSZoneResourceType = "azurerm_private_dns_zone"
|
||||
|
||||
func initAzurePrivateDNSZoneMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAzurePrivateDNSZoneMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AzurePrivateDNSZoneResourceType, func(res *resource.Resource) {
|
||||
res.Attributes().SafeDelete([]string{"number_of_record_sets"})
|
||||
res.Attributes().SafeDelete([]string{"timeouts"})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package azurerm
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AzurePublicIPResourceType = "azurerm_public_ip"
|
||||
|
||||
func initAzurePublicIPMetadata(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAzurePublicIPMetadata(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetHumanReadableAttributesFunc(AzurePublicIPResourceType, func(res *resource.Resource) map[string]string {
|
||||
val := res.Attrs
|
||||
attrs := make(map[string]string)
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package azurerm
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AzureResourceGroupResourceType = "azurerm_resource_group"
|
||||
|
||||
func initAzureResourceGroupMetadata(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAzureResourceGroupMetadata(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetHumanReadableAttributesFunc(AzureResourceGroupResourceType, func(res *resource.Resource) map[string]string {
|
||||
val := res.Attrs
|
||||
attrs := make(map[string]string)
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package azurerm
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AzureRouteResourceType = "azurerm_route"
|
||||
|
||||
func initAzureRouteMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAzureRouteMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetHumanReadableAttributesFunc(AzureRouteResourceType, func(res *resource.Resource) map[string]string {
|
||||
attrs := make(map[string]string)
|
||||
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package azurerm
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AzureRouteTableResourceType = "azurerm_route_table"
|
||||
|
||||
func initAzureRouteTableMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAzureRouteTableMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetHumanReadableAttributesFunc(AzureRouteTableResourceType, func(res *resource.Resource) map[string]string {
|
||||
attrs := make(map[string]string)
|
||||
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package azurerm
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AzureSSHPublicKeyResourceType = "azurerm_ssh_public_key"
|
||||
|
||||
func initAzureSSHPublicKeyMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAzureSSHPublicKeyMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(AzureSSHPublicKeyResourceType, func(res *resource.Resource) {
|
||||
res.Attributes().SafeDelete([]string{"timeouts"})
|
||||
})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package azurerm
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const AzureVirtualNetworkResourceType = "azurerm_virtual_network"
|
||||
|
||||
func initAzureVirtualNetworkMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initAzureVirtualNetworkMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetHumanReadableAttributesFunc(AzureVirtualNetworkResourceType, func(res *resource.Resource) map[string]string {
|
||||
attrs := make(map[string]string)
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package azurerm
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
func InitResourcesMetadata(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
initAzureContainerRegistryMetadata(resourceSchemaRepository)
|
||||
|
|
|
@ -1,44 +1,45 @@
|
|||
package azurerm
|
||||
package azurerm_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
"github.com/snyk/driftctl/pkg/resource/azurerm"
|
||||
testresource "github.com/snyk/driftctl/test/resource"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestAzureMetadata_Flags(t *testing.T) {
|
||||
testcases := map[string][]resource.Flags{
|
||||
AzureContainerRegistryResourceType: {},
|
||||
AzureFirewallResourceType: {},
|
||||
AzurePostgresqlServerResourceType: {},
|
||||
AzurePostgresqlDatabaseResourceType: {},
|
||||
AzurePublicIPResourceType: {},
|
||||
AzureResourceGroupResourceType: {},
|
||||
AzureRouteResourceType: {},
|
||||
AzureRouteTableResourceType: {},
|
||||
AzureStorageAccountResourceType: {},
|
||||
AzureStorageContainerResourceType: {},
|
||||
AzureSubnetResourceType: {},
|
||||
AzureVirtualNetworkResourceType: {},
|
||||
AzureNetworkSecurityGroupResourceType: {resource.FlagDeepMode},
|
||||
AzureLoadBalancerResourceType: {},
|
||||
AzurePrivateDNSZoneResourceType: {resource.FlagDeepMode},
|
||||
AzurePrivateDNSARecordResourceType: {resource.FlagDeepMode},
|
||||
AzurePrivateDNSAAAARecordResourceType: {resource.FlagDeepMode},
|
||||
AzurePrivateDNSCNameRecordResourceType: {resource.FlagDeepMode},
|
||||
AzurePrivateDNSPTRRecordResourceType: {resource.FlagDeepMode},
|
||||
AzurePrivateDNSMXRecordResourceType: {resource.FlagDeepMode},
|
||||
AzurePrivateDNSSRVRecordResourceType: {resource.FlagDeepMode},
|
||||
AzurePrivateDNSTXTRecordResourceType: {resource.FlagDeepMode},
|
||||
AzureImageResourceType: {},
|
||||
AzureSSHPublicKeyResourceType: {resource.FlagDeepMode},
|
||||
AzureLoadBalancerRuleResourceType: {resource.FlagDeepMode},
|
||||
azurerm.AzureContainerRegistryResourceType: {},
|
||||
azurerm.AzureFirewallResourceType: {},
|
||||
azurerm.AzurePostgresqlServerResourceType: {},
|
||||
azurerm.AzurePostgresqlDatabaseResourceType: {},
|
||||
azurerm.AzurePublicIPResourceType: {},
|
||||
azurerm.AzureResourceGroupResourceType: {},
|
||||
azurerm.AzureRouteResourceType: {},
|
||||
azurerm.AzureRouteTableResourceType: {},
|
||||
azurerm.AzureStorageAccountResourceType: {},
|
||||
azurerm.AzureStorageContainerResourceType: {},
|
||||
azurerm.AzureSubnetResourceType: {},
|
||||
azurerm.AzureVirtualNetworkResourceType: {},
|
||||
azurerm.AzureNetworkSecurityGroupResourceType: {resource.FlagDeepMode},
|
||||
azurerm.AzureLoadBalancerResourceType: {},
|
||||
azurerm.AzurePrivateDNSZoneResourceType: {resource.FlagDeepMode},
|
||||
azurerm.AzurePrivateDNSARecordResourceType: {resource.FlagDeepMode},
|
||||
azurerm.AzurePrivateDNSAAAARecordResourceType: {resource.FlagDeepMode},
|
||||
azurerm.AzurePrivateDNSCNameRecordResourceType: {resource.FlagDeepMode},
|
||||
azurerm.AzurePrivateDNSPTRRecordResourceType: {resource.FlagDeepMode},
|
||||
azurerm.AzurePrivateDNSMXRecordResourceType: {resource.FlagDeepMode},
|
||||
azurerm.AzurePrivateDNSSRVRecordResourceType: {resource.FlagDeepMode},
|
||||
azurerm.AzurePrivateDNSTXTRecordResourceType: {resource.FlagDeepMode},
|
||||
azurerm.AzureImageResourceType: {},
|
||||
azurerm.AzureSSHPublicKeyResourceType: {resource.FlagDeepMode},
|
||||
azurerm.AzureLoadBalancerRuleResourceType: {resource.FlagDeepMode},
|
||||
}
|
||||
|
||||
schemaRepository := testresource.InitFakeSchemaRepository("azurerm", "2.71.0")
|
||||
InitResourcesMetadata(schemaRepository)
|
||||
azurerm.InitResourcesMetadata(schemaRepository)
|
||||
|
||||
for ty, flags := range testcases {
|
||||
t.Run(ty, func(tt *testing.T) {
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
package resource
|
||||
|
||||
import "github.com/snyk/driftctl/enumeration/resource"
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
)
|
||||
|
||||
type ResourceFactory interface {
|
||||
CreateAbstractResource(ty, id string, data map[string]interface{}) *resource.Resource
|
||||
}
|
||||
|
||||
type DriftctlResourceFactory struct {
|
||||
resourceSchemaRepository resource.SchemaRepositoryInterface
|
||||
resourceSchemaRepository SchemaRepositoryInterface
|
||||
}
|
||||
|
||||
func NewDriftctlResourceFactory(resourceSchemaRepository resource.SchemaRepositoryInterface) *DriftctlResourceFactory {
|
||||
func NewDriftctlResourceFactory(resourceSchemaRepository SchemaRepositoryInterface) *DriftctlResourceFactory {
|
||||
return &DriftctlResourceFactory{
|
||||
resourceSchemaRepository: resourceSchemaRepository,
|
||||
}
|
||||
|
@ -28,7 +30,7 @@ func (r *DriftctlResourceFactory) CreateAbstractResource(ty, id string, data map
|
|||
Sch: schema,
|
||||
}
|
||||
|
||||
schema, exist := r.resourceSchemaRepository.(*resource.SchemaRepository).GetSchema(ty)
|
||||
schema, exist := r.resourceSchemaRepository.GetSchema(ty)
|
||||
if exist && schema.NormalizeFunc != nil {
|
||||
schema.NormalizeFunc(&res)
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@ package github
|
|||
|
||||
import (
|
||||
"encoding/base64"
|
||||
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const GithubBranchProtectionResourceType = "github_branch_protection"
|
||||
|
||||
func initGithubBranchProtectionMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initGithubBranchProtectionMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(GithubBranchProtectionResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"repository_id"}) // Terraform provider is always returning nil
|
||||
|
|
|
@ -2,11 +2,12 @@ package github
|
|||
|
||||
import (
|
||||
"github.com/snyk/driftctl/enumeration/resource"
|
||||
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
||||
const GithubMembershipResourceType = "github_membership"
|
||||
|
||||
func initGithubMembershipMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
||||
func initGithubMembershipMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
|
||||
resourceSchemaRepository.SetNormalizeFunc(GithubMembershipResourceType, func(res *resource.Resource) {
|
||||
val := res.Attrs
|
||||
val.SafeDelete([]string{"etag"})
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue