mirror of
https://github.com/aquasecurity/trivy.git
synced 2026-01-31 05:43:14 +08:00
test(misconf): simplify test values using *Test helpers (#9985)
Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
This commit is contained in:
@@ -43,17 +43,16 @@ func TestAdapt(t *testing.T) {
|
||||
want := s3.S3{
|
||||
Buckets: []s3.Bucket{
|
||||
{
|
||||
Name: iacTypes.String("mys3bucket", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("mys3bucket"),
|
||||
Encryption: s3.Encryption{
|
||||
Enabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Algorithm: iacTypes.String("aws:kms", iacTypes.NewTestMetadata()),
|
||||
KMSKeyId: iacTypes.String("arn:aws:kms:us-east-1:1234/5678example", iacTypes.NewTestMetadata()),
|
||||
Algorithm: iacTypes.StringTest("aws:kms"),
|
||||
KMSKeyId: iacTypes.StringTest("arn:aws:kms:us-east-1:1234/5678example"),
|
||||
},
|
||||
PublicAccessBlock: &s3.PublicAccessBlock{
|
||||
BlockPublicACLs: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
BlockPublicPolicy: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
IgnorePublicACLs: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
RestrictPublicBuckets: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
BlockPublicACLs: iacTypes.BoolTest(true),
|
||||
BlockPublicPolicy: iacTypes.BoolTest(true),
|
||||
IgnorePublicACLs: iacTypes.BoolTest(true),
|
||||
RestrictPublicBuckets: iacTypes.BoolTest(true),
|
||||
},
|
||||
Website: &s3.Website{},
|
||||
},
|
||||
|
||||
@@ -76,10 +76,10 @@ func TestAdapt(t *testing.T) {
|
||||
EnablePurgeProtection: types.BoolTest(true),
|
||||
SoftDeleteRetentionDays: types.IntTest(50),
|
||||
Keys: []keyvault.Key{{
|
||||
ExpiryDate: types.Time(time.Unix(20, 0), types.NewTestMetadata()),
|
||||
ExpiryDate: types.TimeTest(time.Unix(20, 0)),
|
||||
}},
|
||||
Secrets: []keyvault.Secret{{
|
||||
ExpiryDate: types.Time(time.Unix(20, 0), types.NewTestMetadata()),
|
||||
ExpiryDate: types.TimeTest(time.Unix(20, 0)),
|
||||
ContentType: types.StringTest("text/plain"),
|
||||
}},
|
||||
}},
|
||||
|
||||
@@ -114,15 +114,15 @@ Resources:
|
||||
Instances: []ec2.Instance{
|
||||
{
|
||||
MetadataOptions: ec2.MetadataOptions{
|
||||
HttpEndpoint: types.StringDefault("enabled", types.NewTestMetadata()),
|
||||
HttpTokens: types.StringDefault("optional", types.NewTestMetadata()),
|
||||
HttpEndpoint: types.StringTest("enabled"),
|
||||
HttpTokens: types.StringTest("optional"),
|
||||
},
|
||||
RootBlockDevice: &ec2.BlockDevice{
|
||||
Encrypted: types.BoolDefault(true, types.NewTestMetadata()),
|
||||
Encrypted: types.BoolTest(true),
|
||||
},
|
||||
EBSBlockDevices: []*ec2.BlockDevice{
|
||||
{
|
||||
Encrypted: types.BoolDefault(false, types.NewTestMetadata()),
|
||||
Encrypted: types.BoolTest(false),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -59,7 +59,7 @@ Resources:
|
||||
{
|
||||
Type: types.StringTest("application"),
|
||||
DropInvalidHeaderFields: types.BoolTest(true),
|
||||
Internal: types.Bool(true, types.NewTestMetadata()),
|
||||
Internal: types.BoolTest(true),
|
||||
Listeners: []elb.Listener{
|
||||
{
|
||||
Protocol: types.StringTest("HTTPS"),
|
||||
|
||||
@@ -140,7 +140,7 @@ Resources:
|
||||
{
|
||||
Name: types.StringTest("test-bucket"),
|
||||
Encryption: s3.Encryption{
|
||||
Enabled: types.BoolDefault(false, types.NewTestMetadata()),
|
||||
Enabled: types.BoolTest(false),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -165,7 +165,7 @@ Resources:
|
||||
{
|
||||
Name: types.StringTest("test-bucket"),
|
||||
Encryption: s3.Encryption{
|
||||
Enabled: types.BoolDefault(false, types.NewTestMetadata()),
|
||||
Enabled: types.BoolTest(false),
|
||||
KMSKeyId: types.StringTest("alias/my-key"),
|
||||
Algorithm: types.StringTest("aes256"),
|
||||
},
|
||||
|
||||
@@ -125,15 +125,15 @@ resource "aws_apigatewayv2_domain_name" "example" {
|
||||
}
|
||||
|
||||
func Int(i int) iacTypes.IntValue {
|
||||
return iacTypes.Int(i, iacTypes.NewTestMetadata())
|
||||
return iacTypes.IntTest(i)
|
||||
}
|
||||
|
||||
func Bool(b bool) iacTypes.BoolValue {
|
||||
return iacTypes.Bool(b, iacTypes.NewTestMetadata())
|
||||
return iacTypes.BoolTest(b)
|
||||
}
|
||||
|
||||
func String(s string) iacTypes.StringValue {
|
||||
return iacTypes.String(s, iacTypes.NewTestMetadata())
|
||||
return iacTypes.StringTest(s)
|
||||
}
|
||||
func TestLines(t *testing.T) {
|
||||
src := `
|
||||
|
||||
@@ -30,11 +30,9 @@ func Test_adaptDatabase(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: athena.Database{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("database_name", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("database_name"),
|
||||
Encryption: athena.EncryptionConfiguration{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Type: iacTypes.String(athena.EncryptionTypeSSEKMS, iacTypes.NewTestMetadata()),
|
||||
Type: iacTypes.StringTest(athena.EncryptionTypeSSEKMS),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -73,13 +71,11 @@ func Test_adaptWorkgroup(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: athena.Workgroup{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("example", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("example"),
|
||||
Encryption: athena.EncryptionConfiguration{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Type: iacTypes.String(athena.EncryptionTypeSSEKMS, iacTypes.NewTestMetadata()),
|
||||
Type: iacTypes.StringTest(athena.EncryptionTypeSSEKMS),
|
||||
},
|
||||
EnforceConfiguration: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
EnforceConfiguration: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -100,13 +96,10 @@ func Test_adaptWorkgroup(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: athena.Workgroup{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("example", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("example"),
|
||||
Encryption: athena.EncryptionConfiguration{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Type: iacTypes.String(athena.EncryptionTypeSSEKMS, iacTypes.NewTestMetadata()),
|
||||
Type: iacTypes.StringTest(athena.EncryptionTypeSSEKMS),
|
||||
},
|
||||
EnforceConfiguration: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -125,13 +118,11 @@ func Test_adaptWorkgroup(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: athena.Workgroup{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("example", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("example"),
|
||||
Encryption: athena.EncryptionConfiguration{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Type: iacTypes.String(athena.EncryptionTypeNone, iacTypes.NewTestMetadata()),
|
||||
Type: iacTypes.StringTest(athena.EncryptionTypeNone),
|
||||
},
|
||||
EnforceConfiguration: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
EnforceConfiguration: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -142,13 +133,10 @@ func Test_adaptWorkgroup(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: athena.Workgroup{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("example", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("example"),
|
||||
Encryption: athena.EncryptionConfiguration{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Type: iacTypes.String(athena.EncryptionTypeNone, iacTypes.NewTestMetadata()),
|
||||
Type: iacTypes.StringTest(athena.EncryptionTypeNone),
|
||||
},
|
||||
EnforceConfiguration: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -44,27 +44,22 @@ func Test_adaptDistribution(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: cloudfront.Distribution{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
WAFID: iacTypes.String("waf_id", iacTypes.NewTestMetadata()),
|
||||
WAFID: iacTypes.StringTest("waf_id"),
|
||||
Logging: cloudfront.Logging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Bucket: iacTypes.String("mylogs.s3.amazonaws.com", iacTypes.NewTestMetadata()),
|
||||
Bucket: iacTypes.StringTest("mylogs.s3.amazonaws.com"),
|
||||
},
|
||||
DefaultCacheBehaviour: cloudfront.CacheBehaviour{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ViewerProtocolPolicy: iacTypes.String("redirect-to-https", iacTypes.NewTestMetadata()),
|
||||
ViewerProtocolPolicy: iacTypes.StringTest("redirect-to-https"),
|
||||
},
|
||||
OrdererCacheBehaviours: []cloudfront.CacheBehaviour{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ViewerProtocolPolicy: iacTypes.String("redirect-to-https", iacTypes.NewTestMetadata()),
|
||||
ViewerProtocolPolicy: iacTypes.StringTest("redirect-to-https"),
|
||||
},
|
||||
},
|
||||
ViewerCertificate: cloudfront.ViewerCertificate{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
MinimumProtocolVersion: iacTypes.String("TLSv1.2_2021", iacTypes.NewTestMetadata()),
|
||||
CloudfrontDefaultCertificate: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
SSLSupportMethod: iacTypes.String("sni-only", iacTypes.NewTestMetadata()),
|
||||
MinimumProtocolVersion: iacTypes.StringTest("TLSv1.2_2021"),
|
||||
CloudfrontDefaultCertificate: iacTypes.BoolTest(true),
|
||||
SSLSupportMethod: iacTypes.StringTest("sni-only"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -75,20 +70,11 @@ func Test_adaptDistribution(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: cloudfront.Distribution{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
WAFID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Logging: cloudfront.Logging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Bucket: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
DefaultCacheBehaviour: cloudfront.CacheBehaviour{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ViewerProtocolPolicy: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Logging: cloudfront.Logging{},
|
||||
DefaultCacheBehaviour: cloudfront.CacheBehaviour{},
|
||||
|
||||
ViewerCertificate: cloudfront.ViewerCertificate{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
MinimumProtocolVersion: iacTypes.String("TLSv1", iacTypes.NewTestMetadata()),
|
||||
MinimumProtocolVersion: iacTypes.StringTest("TLSv1"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -33,14 +33,12 @@ func Test_adaptTrail(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: cloudtrail.Trail{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("example", iacTypes.NewTestMetadata()),
|
||||
EnableLogFileValidation: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
IsMultiRegion: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("kms-key", iacTypes.NewTestMetadata()),
|
||||
CloudWatchLogsLogGroupArn: iacTypes.String("abc", iacTypes.NewTestMetadata()),
|
||||
IsLogging: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
BucketName: iacTypes.String("abcdefgh", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("example"),
|
||||
EnableLogFileValidation: iacTypes.BoolTest(true),
|
||||
IsMultiRegion: iacTypes.BoolTest(true),
|
||||
KMSKeyID: iacTypes.StringTest("kms-key"),
|
||||
CloudWatchLogsLogGroupArn: iacTypes.StringTest("abc"),
|
||||
BucketName: iacTypes.StringTest("abcdefgh"),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -50,14 +48,7 @@ func Test_adaptTrail(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: cloudtrail.Trail{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
EnableLogFileValidation: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
IsMultiRegion: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
BucketName: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
CloudWatchLogsLogGroupArn: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
IsLogging: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
IsLogging: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -31,12 +31,8 @@ func Test_adaptLogGroups(t *testing.T) {
|
||||
`,
|
||||
expected: []cloudwatch.LogGroup{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Arn: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.String("my-group", iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("aws_kms_key.log_key", iacTypes.NewTestMetadata()),
|
||||
RetentionInDays: iacTypes.Int(0, iacTypes.NewTestMetadata()),
|
||||
MetricFilters: nil,
|
||||
Name: iacTypes.StringTest("my-group"),
|
||||
KMSKeyID: iacTypes.StringTest("aws_kms_key.log_key"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -50,11 +46,8 @@ func Test_adaptLogGroups(t *testing.T) {
|
||||
`,
|
||||
expected: []cloudwatch.LogGroup{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Arn: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.String("my-group", iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("key-as-string", iacTypes.NewTestMetadata()),
|
||||
RetentionInDays: iacTypes.Int(0, iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("my-group"),
|
||||
KMSKeyID: iacTypes.StringTest("key-as-string"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -68,11 +61,8 @@ func Test_adaptLogGroups(t *testing.T) {
|
||||
`,
|
||||
expected: []cloudwatch.LogGroup{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Arn: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.String("my-group", iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
RetentionInDays: iacTypes.Int(3, iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("my-group"),
|
||||
RetentionInDays: iacTypes.IntTest(3),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -36,20 +36,14 @@ func Test_adaptProject(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: codebuild.Project{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ArtifactSettings: codebuild.ArtifactSettings{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EncryptionEnabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
EncryptionEnabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
SecondaryArtifactSettings: []codebuild.ArtifactSettings{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EncryptionEnabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EncryptionEnabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
EncryptionEnabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -60,10 +54,8 @@ func Test_adaptProject(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: codebuild.Project{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ArtifactSettings: codebuild.ArtifactSettings{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EncryptionEnabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
EncryptionEnabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -30,8 +30,7 @@ func Test_adaptConfigurationAggregrator(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: config.ConfigurationAggregrator{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
SourceAllRegions: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
SourceAllRegions: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -40,10 +39,7 @@ func Test_adaptConfigurationAggregrator(t *testing.T) {
|
||||
resource "aws_config_configuration_aggregator" "example" {
|
||||
}
|
||||
`,
|
||||
expected: config.ConfigurationAggregrator{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
SourceAllRegions: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
expected: config.ConfigurationAggregrator{},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -36,19 +36,17 @@ func Test_adaptCluster(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: documentdb.Cluster{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Identifier: iacTypes.String("my-docdb-cluster", iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("kms-key", iacTypes.NewTestMetadata()),
|
||||
Identifier: iacTypes.StringTest("my-docdb-cluster"),
|
||||
KMSKeyID: iacTypes.StringTest("kms-key"),
|
||||
EnabledLogExports: []iacTypes.StringValue{
|
||||
iacTypes.String("audit", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("audit"),
|
||||
},
|
||||
Instances: []documentdb.Instance{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
KMSKeyID: iacTypes.String("kms-key#1", iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.StringTest("kms-key#1"),
|
||||
},
|
||||
},
|
||||
StorageEncrypted: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
StorageEncrypted: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -57,12 +55,7 @@ func Test_adaptCluster(t *testing.T) {
|
||||
resource "aws_docdb_cluster" "docdb" {
|
||||
}
|
||||
`,
|
||||
expected: documentdb.Cluster{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Identifier: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
StorageEncrypted: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
expected: documentdb.Cluster{},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -28,13 +28,9 @@ func Test_adaptCluster(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: dynamodb.DAXCluster{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ServerSideEncryption: dynamodb.ServerSideEncryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
PointInTimeRecovery: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -71,13 +67,11 @@ func Test_adaptTable(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: dynamodb.Table{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ServerSideEncryption: dynamodb.ServerSideEncryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("key-string", iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
KMSKeyID: iacTypes.StringTest("key-string"),
|
||||
},
|
||||
PointInTimeRecovery: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
PointInTimeRecovery: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -90,13 +84,10 @@ func Test_adaptTable(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: dynamodb.Table{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ServerSideEncryption: dynamodb.ServerSideEncryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String(dynamodb.DefaultKMSKeyID, iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
KMSKeyID: iacTypes.StringTest(dynamodb.DefaultKMSKeyID),
|
||||
},
|
||||
PointInTimeRecovery: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -115,13 +106,10 @@ func Test_adaptTable(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: dynamodb.Table{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ServerSideEncryption: dynamodb.ServerSideEncryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("aws_kms_key.a", iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
KMSKeyID: iacTypes.StringTest("aws_kms_key.a"),
|
||||
},
|
||||
PointInTimeRecovery: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -46,24 +46,19 @@ export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
|
||||
expected: ec2.EC2{
|
||||
Instances: []ec2.Instance{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
MetadataOptions: ec2.MetadataOptions{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
HttpTokens: iacTypes.String("required", iacTypes.NewTestMetadata()),
|
||||
HttpEndpoint: iacTypes.String("disabled", iacTypes.NewTestMetadata()),
|
||||
HttpTokens: iacTypes.StringTest("required"),
|
||||
HttpEndpoint: iacTypes.StringTest("disabled"),
|
||||
},
|
||||
UserData: iacTypes.String(
|
||||
UserData: iacTypes.StringTest(
|
||||
`export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
|
||||
`,
|
||||
iacTypes.NewTestMetadata()),
|
||||
`),
|
||||
RootBlockDevice: &ec2.BlockDevice{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Encrypted: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Encrypted: iacTypes.BoolTest(true),
|
||||
},
|
||||
EBSBlockDevices: []*ec2.BlockDevice{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Encrypted: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Encrypted: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -79,17 +74,8 @@ export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
|
||||
expected: ec2.EC2{
|
||||
Instances: []ec2.Instance{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
MetadataOptions: ec2.MetadataOptions{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
HttpTokens: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
HttpEndpoint: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
UserData: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
RootBlockDevice: &ec2.BlockDevice{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Encrypted: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
MetadataOptions: ec2.MetadataOptions{},
|
||||
RootBlockDevice: &ec2.BlockDevice{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -113,27 +99,21 @@ resource "aws_instance" "this" {
|
||||
expected: ec2.EC2{
|
||||
LaunchTemplates: []ec2.LaunchTemplate{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Instance: ec2.Instance{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
MetadataOptions: ec2.MetadataOptions{
|
||||
HttpEndpoint: iacTypes.String("disabled", iacTypes.NewTestMetadata()),
|
||||
HttpTokens: iacTypes.String("required", iacTypes.NewTestMetadata()),
|
||||
HttpEndpoint: iacTypes.StringTest("disabled"),
|
||||
HttpTokens: iacTypes.StringTest("required"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Instances: []ec2.Instance{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
MetadataOptions: ec2.MetadataOptions{
|
||||
HttpEndpoint: iacTypes.String("disabled", iacTypes.NewTestMetadata()),
|
||||
HttpTokens: iacTypes.String("required", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
RootBlockDevice: &ec2.BlockDevice{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Encrypted: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
HttpEndpoint: iacTypes.StringTest("disabled"),
|
||||
HttpTokens: iacTypes.StringTest("required"),
|
||||
},
|
||||
RootBlockDevice: &ec2.BlockDevice{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -158,27 +138,21 @@ resource "aws_instance" "this" {
|
||||
expected: ec2.EC2{
|
||||
LaunchTemplates: []ec2.LaunchTemplate{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Instance: ec2.Instance{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
MetadataOptions: ec2.MetadataOptions{
|
||||
HttpEndpoint: iacTypes.String("disabled", iacTypes.NewTestMetadata()),
|
||||
HttpTokens: iacTypes.String("required", iacTypes.NewTestMetadata()),
|
||||
HttpEndpoint: iacTypes.StringTest("disabled"),
|
||||
HttpTokens: iacTypes.StringTest("required"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Instances: []ec2.Instance{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
MetadataOptions: ec2.MetadataOptions{
|
||||
HttpEndpoint: iacTypes.String("disabled", iacTypes.NewTestMetadata()),
|
||||
HttpTokens: iacTypes.String("required", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
RootBlockDevice: &ec2.BlockDevice{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Encrypted: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
HttpEndpoint: iacTypes.StringTest("disabled"),
|
||||
HttpTokens: iacTypes.StringTest("required"),
|
||||
},
|
||||
RootBlockDevice: &ec2.BlockDevice{},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -24,7 +24,6 @@ data "aws_ami" "example" {
|
||||
expected: ec2.EC2{
|
||||
RequestedAMIs: []ec2.RequestedAMI{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Owners: iacTypes.StringValueList{
|
||||
iacTypes.StringTest("amazon"),
|
||||
}},
|
||||
@@ -40,7 +39,6 @@ data "aws_ami" "example" {
|
||||
expected: ec2.EC2{
|
||||
RequestedAMIs: []ec2.RequestedAMI{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Owners: iacTypes.StringValueList{
|
||||
iacTypes.StringTest("amazon"),
|
||||
iacTypes.StringTest("badguys"),
|
||||
@@ -57,9 +55,7 @@ data "aws_ami" "example" {
|
||||
}`,
|
||||
expected: ec2.EC2{
|
||||
RequestedAMIs: []ec2.RequestedAMI{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
},
|
||||
{},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -39,23 +39,15 @@ func Test_AdaptAutoscaling(t *testing.T) {
|
||||
expected: ec2.EC2{
|
||||
LaunchConfigurations: []ec2.LaunchConfiguration{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("web_config", iacTypes.NewTestMetadata()),
|
||||
AssociatePublicIP: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
UserData: iacTypes.String("export EDITOR=vimacs", iacTypes.NewTestMetadata()),
|
||||
MetadataOptions: ec2.MetadataOptions{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
HttpTokens: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
HttpEndpoint: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Name: iacTypes.StringTest("web_config"),
|
||||
UserData: iacTypes.StringTest("export EDITOR=vimacs"),
|
||||
MetadataOptions: ec2.MetadataOptions{},
|
||||
RootBlockDevice: &ec2.BlockDevice{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Encrypted: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Encrypted: iacTypes.BoolTest(true),
|
||||
},
|
||||
EBSBlockDevices: []*ec2.BlockDevice{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Encrypted: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Encrypted: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -86,21 +78,14 @@ export AWS_DEFAULT_REGION=us-west-2
|
||||
expected: ec2.EC2{
|
||||
LaunchConfigurations: []ec2.LaunchConfiguration{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("web_config", iacTypes.NewTestMetadata()),
|
||||
AssociatePublicIP: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
UserData: iacTypes.String(`export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
|
||||
Name: iacTypes.StringTest("web_config"),
|
||||
UserData: iacTypes.StringTest(`export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
|
||||
export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
||||
export AWS_DEFAULT_REGION=us-west-2
|
||||
`, iacTypes.NewTestMetadata()),
|
||||
MetadataOptions: ec2.MetadataOptions{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
HttpTokens: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
HttpEndpoint: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
`),
|
||||
MetadataOptions: ec2.MetadataOptions{},
|
||||
RootBlockDevice: &ec2.BlockDevice{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Encrypted: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Encrypted: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -123,14 +108,9 @@ export AWS_DEFAULT_REGION=us-west-2
|
||||
expected: ec2.EC2{
|
||||
LaunchTemplates: []ec2.LaunchTemplate{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Instance: ec2.Instance{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
UserData: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
MetadataOptions: ec2.MetadataOptions{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
HttpTokens: iacTypes.String("required", iacTypes.NewTestMetadata()),
|
||||
HttpEndpoint: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
HttpTokens: iacTypes.StringTest("required"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -27,8 +27,7 @@ func Test_adaptSubnet(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: ec2.Subnet{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
MapPublicIpOnLaunch: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
MapPublicIpOnLaunch: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -39,10 +38,7 @@ func Test_adaptSubnet(t *testing.T) {
|
||||
map_public_ip_on_launch = false
|
||||
}
|
||||
`,
|
||||
expected: ec2.Subnet{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
MapPublicIpOnLaunch: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
expected: ec2.Subnet{},
|
||||
},
|
||||
{
|
||||
name: "defaults",
|
||||
@@ -51,10 +47,7 @@ func Test_adaptSubnet(t *testing.T) {
|
||||
vpc_id = "vpc-123456"
|
||||
}
|
||||
`,
|
||||
expected: ec2.Subnet{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
MapPublicIpOnLaunch: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
expected: ec2.Subnet{},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -31,11 +31,9 @@ func Test_adaptVolume(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: ec2.Volume{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Encryption: ec2.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("aws_kms_key.ebs_encryption", iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
KMSKeyID: iacTypes.StringTest("aws_kms_key.ebs_encryption"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -48,11 +46,9 @@ func Test_adaptVolume(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: ec2.Volume{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Encryption: ec2.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("string-key", iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
KMSKeyID: iacTypes.StringTest("string-key"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -63,12 +59,7 @@ func Test_adaptVolume(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: ec2.Volume{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Encryption: ec2.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Encryption: ec2.Encryption{},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -93,43 +93,32 @@ resource "aws_default_security_group" "default" {
|
||||
expected: ec2.EC2{
|
||||
VPCs: []ec2.VPC{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IsDefault: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
ID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
FlowLogsEnabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
IsDefault: iacTypes.BoolTest(true),
|
||||
},
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IsDefault: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
ID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
FlowLogsEnabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
FlowLogsEnabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
SecurityGroups: []ec2.SecurityGroup{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Description: iacTypes.String("Allow inbound HTTP traffic", iacTypes.NewTestMetadata()),
|
||||
IsDefault: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
VPCID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Description: iacTypes.StringTest("Allow inbound HTTP traffic"),
|
||||
IngressRules: []ec2.SecurityGroupRule{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
|
||||
Description: iacTypes.String("Rule #1", iacTypes.NewTestMetadata()),
|
||||
Description: iacTypes.StringTest("Rule #1"),
|
||||
CIDRs: []iacTypes.StringValue{
|
||||
iacTypes.String("4.5.6.7/32", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("4.5.6.7/32"),
|
||||
},
|
||||
FromPort: iacTypes.IntTest(80),
|
||||
ToPort: iacTypes.IntTest(80),
|
||||
Protocol: iacTypes.StringTest("tcp"),
|
||||
},
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
|
||||
Description: iacTypes.String("Rule #2", iacTypes.NewTestMetadata()),
|
||||
Description: iacTypes.StringTest("Rule #2"),
|
||||
CIDRs: []iacTypes.StringValue{
|
||||
iacTypes.String("1.2.3.4/32", iacTypes.NewTestMetadata()),
|
||||
iacTypes.String("4.5.6.7/32", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("1.2.3.4/32"),
|
||||
iacTypes.StringTest("4.5.6.7/32"),
|
||||
},
|
||||
FromPort: iacTypes.IntTest(22),
|
||||
ToPort: iacTypes.IntTest(22),
|
||||
@@ -139,10 +128,8 @@ resource "aws_default_security_group" "default" {
|
||||
|
||||
EgressRules: []ec2.SecurityGroupRule{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Description: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
CIDRs: []iacTypes.StringValue{
|
||||
iacTypes.String("1.2.3.4/32", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("1.2.3.4/32"),
|
||||
},
|
||||
FromPort: iacTypes.IntTest(-1),
|
||||
ToPort: iacTypes.IntTest(-1),
|
||||
@@ -154,15 +141,11 @@ resource "aws_default_security_group" "default" {
|
||||
IngressRules: []ec2.SecurityGroupRule{
|
||||
{
|
||||
Protocol: iacTypes.StringTest("-1"),
|
||||
FromPort: iacTypes.IntTest(0),
|
||||
ToPort: iacTypes.IntTest(0),
|
||||
},
|
||||
},
|
||||
EgressRules: []ec2.SecurityGroupRule{
|
||||
{
|
||||
Protocol: iacTypes.StringTest("-1"),
|
||||
FromPort: iacTypes.IntTest(0),
|
||||
ToPort: iacTypes.IntTest(0),
|
||||
CIDRs: []iacTypes.StringValue{iacTypes.StringTest("0.0.0.0/0")},
|
||||
},
|
||||
},
|
||||
@@ -170,21 +153,18 @@ resource "aws_default_security_group" "default" {
|
||||
},
|
||||
NetworkACLs: []ec2.NetworkACL{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Rules: []ec2.NetworkACLRule{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Type: iacTypes.String("ingress", iacTypes.NewTestMetadata()),
|
||||
Action: iacTypes.String("allow", iacTypes.NewTestMetadata()),
|
||||
Protocol: iacTypes.String("tcp", iacTypes.NewTestMetadata()),
|
||||
Type: iacTypes.StringTest("ingress"),
|
||||
Action: iacTypes.StringTest("allow"),
|
||||
Protocol: iacTypes.StringTest("tcp"),
|
||||
CIDRs: []iacTypes.StringValue{
|
||||
iacTypes.String("10.0.0.0/16", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("10.0.0.0/16"),
|
||||
},
|
||||
FromPort: iacTypes.IntTest(22),
|
||||
ToPort: iacTypes.IntTest(22),
|
||||
},
|
||||
},
|
||||
IsDefaultRule: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -205,43 +185,31 @@ resource "aws_network_acl_rule" "example" {
|
||||
expected: ec2.EC2{
|
||||
SecurityGroups: []ec2.SecurityGroup{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Description: iacTypes.String("Managed by Terraform", iacTypes.NewTestMetadata()),
|
||||
IsDefault: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
VPCID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Description: iacTypes.StringTest("Managed by Terraform"),
|
||||
IngressRules: []ec2.SecurityGroupRule{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Description: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
FromPort: iacTypes.IntTest(-1),
|
||||
ToPort: iacTypes.IntTest(-1),
|
||||
FromPort: iacTypes.IntTest(-1),
|
||||
ToPort: iacTypes.IntTest(-1),
|
||||
},
|
||||
},
|
||||
|
||||
EgressRules: []ec2.SecurityGroupRule{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Description: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
FromPort: iacTypes.IntTest(-1),
|
||||
ToPort: iacTypes.IntTest(-1),
|
||||
FromPort: iacTypes.IntTest(-1),
|
||||
ToPort: iacTypes.IntTest(-1),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
NetworkACLs: []ec2.NetworkACL{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Rules: []ec2.NetworkACLRule{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Type: iacTypes.String("ingress", iacTypes.NewTestMetadata()),
|
||||
Action: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Protocol: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Type: iacTypes.StringTest("ingress"),
|
||||
FromPort: iacTypes.IntTest(-1),
|
||||
ToPort: iacTypes.IntTest(-1),
|
||||
},
|
||||
},
|
||||
IsDefaultRule: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -262,10 +230,7 @@ resource "aws_flow_log" "this" {
|
||||
expected: ec2.EC2{
|
||||
VPCs: []ec2.VPC{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IsDefault: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
ID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
FlowLogsEnabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
FlowLogsEnabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -75,21 +75,15 @@ func Test_adaptRepository(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: ecr.Repository{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ImageTagsImmutable: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
ImageScanning: ecr.ImageScanning{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ScanOnPush: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
ScanOnPush: iacTypes.BoolTest(true),
|
||||
},
|
||||
Encryption: ecr.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Type: iacTypes.String("KMS", iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("aws_kms_key.ecr_kms", iacTypes.NewTestMetadata()),
|
||||
Type: iacTypes.StringTest("KMS"),
|
||||
KMSKeyID: iacTypes.StringTest("aws_kms_key.ecr_kms"),
|
||||
},
|
||||
Policies: []iam.Policy{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.StringDefault("", iacTypes.NewTestMetadata()),
|
||||
Document: func() iam.Document {
|
||||
|
||||
builder := iamgo.NewPolicyBuilder()
|
||||
@@ -118,11 +112,9 @@ func Test_adaptRepository(t *testing.T) {
|
||||
builder.WithStatement(sb.Build())
|
||||
|
||||
return iam.Document{
|
||||
Parsed: builder.Build(),
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Parsed: builder.Build(),
|
||||
}
|
||||
}(),
|
||||
Builtin: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -134,16 +126,9 @@ func Test_adaptRepository(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: ecr.Repository{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ImageTagsImmutable: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
ImageScanning: ecr.ImageScanning{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ScanOnPush: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
ImageScanning: ecr.ImageScanning{},
|
||||
Encryption: ecr.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Type: iacTypes.String("AES256", iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Type: iacTypes.StringTest("AES256"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -31,8 +31,7 @@ func Test_adaptClusterSettings(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: ecs.ClusterSettings{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ContainerInsightsEnabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
ContainerInsightsEnabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -48,8 +47,7 @@ func Test_adaptClusterSettings(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: ecs.ClusterSettings{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ContainerInsightsEnabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
ContainerInsightsEnabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -64,10 +62,7 @@ func Test_adaptClusterSettings(t *testing.T) {
|
||||
}
|
||||
}
|
||||
`,
|
||||
expected: ecs.ClusterSettings{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ContainerInsightsEnabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
expected: ecs.ClusterSettings{},
|
||||
},
|
||||
{
|
||||
name: "defaults",
|
||||
@@ -75,10 +70,7 @@ func Test_adaptClusterSettings(t *testing.T) {
|
||||
resource "aws_ecs_cluster" "example" {
|
||||
}
|
||||
`,
|
||||
expected: ecs.ClusterSettings{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ContainerInsightsEnabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
expected: ecs.ClusterSettings{},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -127,25 +119,20 @@ func Test_adaptTaskDefinitionResource(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: ecs.TaskDefinition{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Volumes: []ecs.Volume{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EFSVolumeConfiguration: ecs.EFSVolumeConfiguration{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
TransitEncryptionEnabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
TransitEncryptionEnabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
ContainerDefinitions: []ecs.ContainerDefinition{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("my_service", iacTypes.NewTestMetadata()),
|
||||
Image: iacTypes.String("my_image", iacTypes.NewTestMetadata()),
|
||||
CPU: iacTypes.String("2", iacTypes.NewTestMetadata()),
|
||||
Memory: iacTypes.String("256", iacTypes.NewTestMetadata()),
|
||||
Essential: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Privileged: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("my_service"),
|
||||
Image: iacTypes.StringTest("my_image"),
|
||||
CPU: iacTypes.StringTest("2"),
|
||||
Memory: iacTypes.StringTest("256"),
|
||||
Essential: iacTypes.BoolTest(true),
|
||||
Environment: []ecs.EnvVar{
|
||||
{
|
||||
Name: iacTypes.StringTest("ENVIRONMENT"),
|
||||
@@ -169,18 +156,11 @@ func Test_adaptTaskDefinitionResource(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: ecs.TaskDefinition{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Volumes: []ecs.Volume{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EFSVolumeConfiguration: ecs.EFSVolumeConfiguration{
|
||||
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
TransitEncryptionEnabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
EFSVolumeConfiguration: ecs.EFSVolumeConfiguration{},
|
||||
},
|
||||
},
|
||||
ContainerDefinitions: nil,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -28,8 +28,7 @@ func Test_adaptFileSystem(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: efs.FileSystem{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Encrypted: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Encrypted: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -38,10 +37,7 @@ func Test_adaptFileSystem(t *testing.T) {
|
||||
resource "aws_efs_file_system" "example" {
|
||||
}
|
||||
`,
|
||||
expected: efs.FileSystem{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Encrypted: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
expected: efs.FileSystem{},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -40,23 +40,19 @@ func Test_adaptCluster(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: eks.Cluster{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Logging: eks.Logging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
API: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Authenticator: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Audit: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Scheduler: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
ControllerManager: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
API: iacTypes.BoolTest(true),
|
||||
Authenticator: iacTypes.BoolTest(true),
|
||||
Audit: iacTypes.BoolTest(true),
|
||||
Scheduler: iacTypes.BoolTest(true),
|
||||
ControllerManager: iacTypes.BoolTest(true),
|
||||
},
|
||||
Encryption: eks.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Secrets: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("key-arn", iacTypes.NewTestMetadata()),
|
||||
Secrets: iacTypes.BoolTest(true),
|
||||
KMSKeyID: iacTypes.StringTest("key-arn"),
|
||||
},
|
||||
PublicAccessEnabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
PublicAccessCIDRs: []iacTypes.StringValue{
|
||||
iacTypes.String("10.2.0.0/8", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("10.2.0.0/8"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -67,22 +63,9 @@ func Test_adaptCluster(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: eks.Cluster{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Logging: eks.Logging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
API: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Authenticator: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Audit: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Scheduler: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
ControllerManager: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Encryption: eks.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Secrets: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
PublicAccessEnabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
PublicAccessCIDRs: nil,
|
||||
Logging: eks.Logging{},
|
||||
Encryption: eks.Encryption{},
|
||||
PublicAccessEnabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -34,10 +34,9 @@ func Test_adaptCluster(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: elasticache.Cluster{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Engine: iacTypes.String("redis", iacTypes.NewTestMetadata()),
|
||||
NodeType: iacTypes.String("cache.m4.large", iacTypes.NewTestMetadata()),
|
||||
SnapshotRetentionLimit: iacTypes.Int(5, iacTypes.NewTestMetadata()),
|
||||
Engine: iacTypes.StringTest("redis"),
|
||||
NodeType: iacTypes.StringTest("cache.m4.large"),
|
||||
SnapshotRetentionLimit: iacTypes.IntTest(5),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -45,12 +44,7 @@ func Test_adaptCluster(t *testing.T) {
|
||||
terraform: `
|
||||
resource "aws_elasticache_cluster" "example" {
|
||||
}`,
|
||||
expected: elasticache.Cluster{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Engine: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
NodeType: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
SnapshotRetentionLimit: iacTypes.Int(0, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
expected: elasticache.Cluster{},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -80,9 +74,8 @@ func Test_adaptReplicationGroup(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: elasticache.ReplicationGroup{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
TransitEncryptionEnabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
AtRestEncryptionEnabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
TransitEncryptionEnabled: iacTypes.BoolTest(true),
|
||||
AtRestEncryptionEnabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -91,11 +84,7 @@ func Test_adaptReplicationGroup(t *testing.T) {
|
||||
resource "aws_elasticache_replication_group" "example" {
|
||||
}
|
||||
`,
|
||||
expected: elasticache.ReplicationGroup{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
TransitEncryptionEnabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
AtRestEncryptionEnabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
expected: elasticache.ReplicationGroup{},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -128,8 +117,7 @@ func Test_adaptSecurityGroup(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: elasticache.SecurityGroup{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Description: iacTypes.String("something", iacTypes.NewTestMetadata()),
|
||||
Description: iacTypes.StringTest("something"),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -144,8 +132,7 @@ func Test_adaptSecurityGroup(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: elasticache.SecurityGroup{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Description: iacTypes.String("Managed by Terraform", iacTypes.NewTestMetadata()),
|
||||
Description: iacTypes.StringTest("Managed by Terraform"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -47,24 +47,19 @@ func Test_adaptDomain(t *testing.T) {
|
||||
expected: elasticsearch.Elasticsearch{
|
||||
Domains: []elasticsearch.Domain{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
DomainName: iacTypes.String("domain-foo", iacTypes.NewTestMetadata()),
|
||||
DomainName: iacTypes.StringTest("domain-foo"),
|
||||
LogPublishing: elasticsearch.LogPublishing{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
AuditEnabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
AuditEnabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
TransitEncryption: elasticsearch.TransitEncryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
AtRestEncryption: elasticsearch.AtRestEncryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
Endpoint: elasticsearch.Endpoint{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EnforceHTTPS: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
TLSPolicy: iacTypes.String("Policy-Min-TLS-1-2-2019-07", iacTypes.NewTestMetadata()),
|
||||
EnforceHTTPS: iacTypes.BoolTest(true),
|
||||
TLSPolicy: iacTypes.StringTest("Policy-Min-TLS-1-2-2019-07"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -79,25 +74,10 @@ func Test_adaptDomain(t *testing.T) {
|
||||
expected: elasticsearch.Elasticsearch{
|
||||
Domains: []elasticsearch.Domain{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
DomainName: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
LogPublishing: elasticsearch.LogPublishing{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
AuditEnabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
TransitEncryption: elasticsearch.TransitEncryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
AtRestEncryption: elasticsearch.AtRestEncryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Endpoint: elasticsearch.Endpoint{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EnforceHTTPS: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
TLSPolicy: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
LogPublishing: elasticsearch.LogPublishing{},
|
||||
TransitEncryption: elasticsearch.TransitEncryption{},
|
||||
AtRestEncryption: elasticsearch.AtRestEncryption{},
|
||||
Endpoint: elasticsearch.Endpoint{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -129,24 +109,19 @@ func Test_adaptDomain(t *testing.T) {
|
||||
expected: elasticsearch.Elasticsearch{
|
||||
Domains: []elasticsearch.Domain{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
DomainName: iacTypes.String("example", iacTypes.NewTestMetadata()),
|
||||
DomainName: iacTypes.StringTest("example"),
|
||||
LogPublishing: elasticsearch.LogPublishing{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
AuditEnabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
AuditEnabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
TransitEncryption: elasticsearch.TransitEncryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
AtRestEncryption: elasticsearch.AtRestEncryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
Endpoint: elasticsearch.Endpoint{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EnforceHTTPS: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
TLSPolicy: iacTypes.String("Policy-Min-TLS-1-2-2019-07", iacTypes.NewTestMetadata()),
|
||||
EnforceHTTPS: iacTypes.BoolTest(true),
|
||||
TLSPolicy: iacTypes.StringTest("Policy-Min-TLS-1-2-2019-07"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -48,19 +48,16 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: elb.ELB{
|
||||
LoadBalancers: []elb.LoadBalancer{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Type: iacTypes.String("application", iacTypes.NewTestMetadata()),
|
||||
DropInvalidHeaderFields: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Internal: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Type: iacTypes.StringTest("application"),
|
||||
DropInvalidHeaderFields: iacTypes.BoolTest(true),
|
||||
Internal: iacTypes.BoolTest(true),
|
||||
Listeners: []elb.Listener{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Protocol: iacTypes.String("HTTPS", iacTypes.NewTestMetadata()),
|
||||
TLSPolicy: iacTypes.String("ELBSecurityPolicy-TLS-1-1-2017-01", iacTypes.NewTestMetadata()),
|
||||
Protocol: iacTypes.StringTest("HTTPS"),
|
||||
TLSPolicy: iacTypes.StringTest("ELBSecurityPolicy-TLS-1-1-2017-01"),
|
||||
DefaultActions: []elb.Action{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Type: iacTypes.String("forward", iacTypes.NewTestMetadata()),
|
||||
Type: iacTypes.StringTest("forward"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -78,11 +75,7 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: elb.ELB{
|
||||
LoadBalancers: []elb.LoadBalancer{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Type: iacTypes.String("application", iacTypes.NewTestMetadata()),
|
||||
DropInvalidHeaderFields: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Internal: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Listeners: nil,
|
||||
Type: iacTypes.StringTest("application"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -42,9 +42,8 @@ func Test_adaptSecurityConfiguration(t *testing.T) {
|
||||
EOF
|
||||
}`,
|
||||
expected: emr.SecurityConfiguration{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.StringExplicit("emrsc_test", iacTypes.NewTestMetadata()),
|
||||
Configuration: iacTypes.String(
|
||||
Name: iacTypes.StringTest("emrsc_test"),
|
||||
Configuration: iacTypes.StringTest(
|
||||
` {
|
||||
"EncryptionConfiguration": {
|
||||
"AtRestEncryptionConfiguration": {
|
||||
@@ -60,7 +59,7 @@ func Test_adaptSecurityConfiguration(t *testing.T) {
|
||||
"EnableAtRestEncryption": true
|
||||
}
|
||||
}
|
||||
`, iacTypes.NewTestMetadata()),
|
||||
`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -46,12 +46,10 @@ func Test_adaptGroups(t *testing.T) {
|
||||
`,
|
||||
expected: []iam.Group{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("developers", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("developers"),
|
||||
Policies: []iam.Policy{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("my_developer_policy", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("my_developer_policy"),
|
||||
Document: defaultPolicyDocuemnt(false),
|
||||
},
|
||||
},
|
||||
@@ -89,12 +87,10 @@ resource "aws_iam_group_policy_attachment" "test-attach" {
|
||||
`,
|
||||
expected: []iam.Group{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("test-group", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test-group"),
|
||||
Policies: []iam.Policy{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("test-policy", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test-policy"),
|
||||
Document: defaultPolicyDocuemnt(false),
|
||||
},
|
||||
},
|
||||
|
||||
@@ -30,14 +30,13 @@ func Test_adaptPasswordPolicy(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: iam.PasswordPolicy{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ReusePreventionCount: iacTypes.Int(3, iacTypes.NewTestMetadata()),
|
||||
RequireLowercase: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
RequireUppercase: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
RequireNumbers: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
RequireSymbols: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
MaxAgeDays: iacTypes.Int(90, iacTypes.NewTestMetadata()),
|
||||
MinimumLength: iacTypes.Int(8, iacTypes.NewTestMetadata()),
|
||||
ReusePreventionCount: iacTypes.IntTest(3),
|
||||
RequireLowercase: iacTypes.BoolTest(true),
|
||||
RequireUppercase: iacTypes.BoolTest(true),
|
||||
RequireNumbers: iacTypes.BoolTest(true),
|
||||
RequireSymbols: iacTypes.BoolTest(true),
|
||||
MaxAgeDays: iacTypes.IntTest(90),
|
||||
MinimumLength: iacTypes.IntTest(8),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ func defaultPolicyDocuemnt(offset bool) iam.Document {
|
||||
|
||||
return iam.Document{
|
||||
Parsed: builder.Build(),
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IsOffset: offset,
|
||||
HasRefs: false,
|
||||
}
|
||||
@@ -58,10 +57,8 @@ func Test_adaptPolicies(t *testing.T) {
|
||||
`,
|
||||
expected: []iam.Policy{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("test", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test"),
|
||||
Document: defaultPolicyDocuemnt(false),
|
||||
Builtin: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -94,11 +91,8 @@ resource "aws_iam_policy" "this" {
|
||||
`,
|
||||
expected: []iam.Policy{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("test-0", iacTypes.NewTestMetadata()),
|
||||
Builtin: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test-0"),
|
||||
Document: iam.Document{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IsOffset: true,
|
||||
HasRefs: false,
|
||||
Parsed: func() iamgo.Document {
|
||||
@@ -144,11 +138,8 @@ resource "aws_iam_policy" "this" {
|
||||
}`,
|
||||
expected: []iam.Policy{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("test-sqs1", iacTypes.NewTestMetadata()),
|
||||
Builtin: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test-sqs1"),
|
||||
Document: iam.Document{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IsOffset: true,
|
||||
HasRefs: false,
|
||||
Parsed: func() iamgo.Document {
|
||||
@@ -196,8 +187,7 @@ resource "aws_iam_policy" "this" {
|
||||
}`,
|
||||
expected: []iam.Policy{
|
||||
{
|
||||
Name: iacTypes.String("test-policy", iacTypes.NewTestMetadata()),
|
||||
Builtin: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test-policy"),
|
||||
Document: func() iam.Document {
|
||||
builder := iamgo.NewPolicyBuilder()
|
||||
firstStatement := iamgo.NewStatementBuilder().
|
||||
@@ -218,7 +208,6 @@ resource "aws_iam_policy" "this" {
|
||||
|
||||
return iam.Document{
|
||||
Parsed: builder.Build(),
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IsOffset: true,
|
||||
HasRefs: false,
|
||||
}
|
||||
@@ -256,7 +245,7 @@ data "aws_iam_policy_document" "policy_source" {
|
||||
}`,
|
||||
expected: []iam.Policy{
|
||||
{
|
||||
Name: iacTypes.String("test-policy", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test-policy"),
|
||||
Document: func() iam.Document {
|
||||
builder := iamgo.NewPolicyBuilder().
|
||||
WithStatement(
|
||||
@@ -276,7 +265,6 @@ data "aws_iam_policy_document" "policy_source" {
|
||||
|
||||
return iam.Document{
|
||||
Parsed: builder.Build(),
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IsOffset: true,
|
||||
HasRefs: false,
|
||||
}
|
||||
@@ -316,7 +304,7 @@ data "aws_iam_policy_document" "policy_source2" {
|
||||
`,
|
||||
expected: []iam.Policy{
|
||||
{
|
||||
Name: iacTypes.String("test-policy", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test-policy"),
|
||||
Document: func() iam.Document {
|
||||
builder := iamgo.NewPolicyBuilder().
|
||||
WithStatement(
|
||||
@@ -329,7 +317,6 @@ data "aws_iam_policy_document" "policy_source2" {
|
||||
|
||||
return iam.Document{
|
||||
Parsed: builder.Build(),
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IsOffset: true,
|
||||
HasRefs: false,
|
||||
}
|
||||
@@ -362,7 +349,7 @@ data "aws_iam_policy_document" "policy" {
|
||||
`,
|
||||
expected: []iam.Policy{
|
||||
{
|
||||
Name: iacTypes.String("test-policy", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test-policy"),
|
||||
Document: func() iam.Document {
|
||||
builder := iamgo.NewPolicyBuilder().
|
||||
WithStatement(
|
||||
@@ -375,7 +362,6 @@ data "aws_iam_policy_document" "policy" {
|
||||
|
||||
return iam.Document{
|
||||
Parsed: builder.Build(),
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IsOffset: true,
|
||||
HasRefs: false,
|
||||
}
|
||||
@@ -395,7 +381,7 @@ data "aws_iam_policy_document" "policy" {
|
||||
}`,
|
||||
expected: []iam.Policy{
|
||||
{
|
||||
Name: iacTypes.String("test-policy", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test-policy"),
|
||||
Document: iam.Document{
|
||||
IsOffset: true,
|
||||
},
|
||||
@@ -461,7 +447,6 @@ EOF
|
||||
|
||||
return iam.Document{
|
||||
Parsed: builder.Build(),
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IsOffset: false,
|
||||
HasRefs: true,
|
||||
}
|
||||
|
||||
@@ -55,12 +55,10 @@ data "aws_iam_policy_document" "policy" {
|
||||
`,
|
||||
expected: []iam.Role{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("test_role", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test_role"),
|
||||
Policies: []iam.Policy{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("test_policy", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test_policy"),
|
||||
Document: defaultPolicyDocuemnt(true),
|
||||
},
|
||||
},
|
||||
@@ -97,12 +95,10 @@ resource "aws_iam_role_policy_attachment" "test-attach" {
|
||||
`,
|
||||
expected: []iam.Role{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("test-role", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test-role"),
|
||||
Policies: []iam.Policy{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("test-policy", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test-policy"),
|
||||
Document: defaultPolicyDocuemnt(true),
|
||||
},
|
||||
},
|
||||
@@ -133,12 +129,10 @@ resource "aws_iam_role" "example" {
|
||||
`,
|
||||
expected: []iam.Role{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("test-role", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test-role"),
|
||||
Policies: []iam.Policy{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("my_inline_policy", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("my_inline_policy"),
|
||||
Document: defaultPolicyDocuemnt(false),
|
||||
},
|
||||
},
|
||||
@@ -183,23 +177,19 @@ resource "aws_iam_role_policy_attachment" "this" {
|
||||
`,
|
||||
expected: []iam.Role{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("test-role1", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test-role1"),
|
||||
Policies: []iam.Policy{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("test-role1-policy", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test-role1-policy"),
|
||||
Document: defaultPolicyDocuemnt(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("test-role2", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test-role2"),
|
||||
Policies: []iam.Policy{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("test-role2-policy", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test-role2-policy"),
|
||||
Document: defaultPolicyDocuemnt(true),
|
||||
},
|
||||
},
|
||||
@@ -235,11 +225,10 @@ data "aws_iam_policy_document" "s3_policy" {
|
||||
}`,
|
||||
expected: []iam.Role{
|
||||
{
|
||||
Name: iacTypes.String("test_role", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test_role"),
|
||||
Policies: []iam.Policy{
|
||||
{
|
||||
Name: iacTypes.String("test_policy", iacTypes.NewTestMetadata()),
|
||||
Builtin: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test_policy"),
|
||||
Document: func() iam.Document {
|
||||
builder := iamgo.NewPolicyBuilder()
|
||||
sb := iamgo.NewStatementBuilder()
|
||||
@@ -251,7 +240,6 @@ data "aws_iam_policy_document" "s3_policy" {
|
||||
|
||||
return iam.Document{
|
||||
Parsed: builder.Build(),
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IsOffset: true,
|
||||
HasRefs: false,
|
||||
}
|
||||
@@ -358,7 +346,6 @@ data "aws_partition" "current" {}
|
||||
Name: iacTypes.StringTest("test"),
|
||||
Policies: []iam.Policy{
|
||||
{
|
||||
Name: iacTypes.StringTest(""),
|
||||
Document: iam.Document{},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -44,15 +44,11 @@ resource "aws_iam_user_policy" "policy" {
|
||||
`,
|
||||
expected: []iam.User{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("loadbalancer", iacTypes.NewTestMetadata()),
|
||||
LastAccess: iacTypes.TimeUnresolvable(iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("loadbalancer"),
|
||||
Policies: []iam.Policy{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("test", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test"),
|
||||
Document: defaultPolicyDocuemnt(false),
|
||||
Builtin: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -89,15 +85,11 @@ resource "aws_iam_user_policy_attachment" "test-attach" {
|
||||
`,
|
||||
expected: []iam.User{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("test-user", iacTypes.NewTestMetadata()),
|
||||
LastAccess: iacTypes.TimeUnresolvable(iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test-user"),
|
||||
Policies: []iam.Policy{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("test-policy", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test-policy"),
|
||||
Document: defaultPolicyDocuemnt(false),
|
||||
Builtin: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -119,14 +111,10 @@ resource "aws_iam_user" "lb" {
|
||||
`,
|
||||
expected: []iam.User{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("loadbalafncer", iacTypes.NewTestMetadata()),
|
||||
LastAccess: iacTypes.TimeUnresolvable(iacTypes.NewTestMetadata()),
|
||||
Policies: nil,
|
||||
Name: iacTypes.StringTest("loadbalafncer"),
|
||||
AccessKeys: []iam.AccessKey{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Active: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Active: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -147,14 +135,10 @@ resource "aws_iam_user" "lb" {
|
||||
`,
|
||||
expected: []iam.User{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("loadbalafncer", iacTypes.NewTestMetadata()),
|
||||
LastAccess: iacTypes.TimeUnresolvable(iacTypes.NewTestMetadata()),
|
||||
Policies: nil,
|
||||
Name: iacTypes.StringTest("loadbalafncer"),
|
||||
AccessKeys: []iam.AccessKey{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Active: iacTypes.BoolDefault(true, iacTypes.NewTestMetadata()),
|
||||
Active: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -27,11 +27,9 @@ func Test_adaptStream(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: kinesis.Stream{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Encryption: kinesis.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Type: iacTypes.String("KMS", iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("my/special/key", iacTypes.NewTestMetadata()),
|
||||
Type: iacTypes.StringTest("KMS"),
|
||||
KMSKeyID: iacTypes.StringTest("my/special/key"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -42,11 +40,8 @@ func Test_adaptStream(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: kinesis.Stream{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Encryption: kinesis.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Type: iacTypes.String("NONE", iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Type: iacTypes.StringTest("NONE"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -27,8 +27,8 @@ func Test_adaptKey(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: kms.Key{
|
||||
Usage: iacTypes.String(kms.KeyUsageSignAndVerify, iacTypes.NewTestMetadata()),
|
||||
RotationEnabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Usage: iacTypes.StringTest(kms.KeyUsageSignAndVerify),
|
||||
RotationEnabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -38,8 +38,7 @@ func Test_adaptKey(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: kms.Key{
|
||||
Usage: iacTypes.String("ENCRYPT_DECRYPT", iacTypes.NewTestMetadata()),
|
||||
RotationEnabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Usage: iacTypes.StringTest("ENCRYPT_DECRYPT"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -43,16 +43,13 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: lambda.Lambda{
|
||||
Functions: []lambda.Function{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Tracing: lambda.Tracing{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Mode: iacTypes.String("Passthrough", iacTypes.NewTestMetadata()),
|
||||
Mode: iacTypes.StringTest("Passthrough"),
|
||||
},
|
||||
Permissions: []lambda.Permission{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Principal: iacTypes.String("sns.amazonaws.com", iacTypes.NewTestMetadata()),
|
||||
SourceARN: iacTypes.String("default", iacTypes.NewTestMetadata()),
|
||||
Principal: iacTypes.StringTest("sns.amazonaws.com"),
|
||||
SourceARN: iacTypes.StringTest("default"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -73,24 +70,12 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: lambda.Lambda{
|
||||
Functions: []lambda.Function{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Tracing: lambda.Tracing{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Mode: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Tracing: lambda.Tracing{},
|
||||
},
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Tracing: lambda.Tracing{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Mode: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Tracing: lambda.Tracing{},
|
||||
Permissions: []lambda.Permission{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Principal: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
SourceARN: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
{},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -30,12 +30,8 @@ func Test_adaptBroker(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: mq.Broker{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
PublicAccess: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Logging: mq.Logging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
General: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Audit: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Audit: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -51,12 +47,9 @@ func Test_adaptBroker(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: mq.Broker{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
PublicAccess: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
PublicAccess: iacTypes.BoolTest(true),
|
||||
Logging: mq.Logging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
General: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Audit: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
General: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -67,13 +60,7 @@ func Test_adaptBroker(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: mq.Broker{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
PublicAccess: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Logging: mq.Logging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
General: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Audit: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Logging: mq.Logging{},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -52,31 +52,23 @@ func Test_adaptCluster(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: msk.Cluster{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EncryptionInTransit: msk.EncryptionInTransit{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ClientBroker: iacTypes.String("TLS", iacTypes.NewTestMetadata()),
|
||||
ClientBroker: iacTypes.StringTest("TLS"),
|
||||
},
|
||||
EncryptionAtRest: msk.EncryptionAtRest{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
KMSKeyARN: iacTypes.String("foo-bar-key", iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
KMSKeyARN: iacTypes.StringTest("foo-bar-key"),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
Logging: msk.Logging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Broker: msk.BrokerLogging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
S3: msk.S3Logging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
Cloudwatch: msk.CloudwatchLogging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
Firehose: msk.FirehoseLogging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -89,27 +81,14 @@ func Test_adaptCluster(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: msk.Cluster{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EncryptionInTransit: msk.EncryptionInTransit{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ClientBroker: iacTypes.String("TLS_PLAINTEXT", iacTypes.NewTestMetadata()),
|
||||
ClientBroker: iacTypes.StringTest("TLS_PLAINTEXT"),
|
||||
},
|
||||
Logging: msk.Logging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Broker: msk.BrokerLogging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
S3: msk.S3Logging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Cloudwatch: msk.CloudwatchLogging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Firehose: msk.FirehoseLogging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
S3: msk.S3Logging{},
|
||||
Cloudwatch: msk.CloudwatchLogging{},
|
||||
Firehose: msk.FirehoseLogging{},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -28,13 +28,11 @@ func Test_adaptCluster(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: neptune.Cluster{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Logging: neptune.Logging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Audit: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Audit: iacTypes.BoolTest(true),
|
||||
},
|
||||
StorageEncrypted: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("kms-key", iacTypes.NewTestMetadata()),
|
||||
StorageEncrypted: iacTypes.BoolTest(true),
|
||||
KMSKeyID: iacTypes.StringTest("kms-key"),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -44,13 +42,7 @@ func Test_adaptCluster(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: neptune.Cluster{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Logging: neptune.Logging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Audit: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
StorageEncrypted: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Logging: neptune.Logging{},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -48,32 +48,31 @@ provider "aws" {
|
||||
}`,
|
||||
expected: []aws.TerraformProvider{
|
||||
{
|
||||
Version: types.String("~> 5.0", types.NewTestMetadata()),
|
||||
Region: types.String("us-east-1", types.NewTestMetadata()),
|
||||
Version: types.StringTest("~> 5.0"),
|
||||
Region: types.StringTest("us-east-1"),
|
||||
DefaultTags: aws.DefaultTags{
|
||||
Metadata: types.NewTestMetadata(),
|
||||
Tags: types.Map(map[string]string{
|
||||
Tags: types.MapTest(map[string]string{
|
||||
"Environment": "Local",
|
||||
"Name": "LocalStack",
|
||||
}, types.NewTestMetadata()),
|
||||
}),
|
||||
},
|
||||
Endpoints: types.Map(map[string]string{
|
||||
Endpoints: types.MapTest(map[string]string{
|
||||
"dynamodb": "http://localhost:4566",
|
||||
"s3": "http://localhost:4566",
|
||||
}, types.NewTestMetadata()),
|
||||
Profile: types.String("localstack", types.NewTestMetadata()),
|
||||
AccessKey: types.String("fake", types.NewTestMetadata()),
|
||||
SecretKey: types.String("fake", types.NewTestMetadata()),
|
||||
SkipCredentialsValidation: types.Bool(true, types.NewTestMetadata()),
|
||||
SkipMetadataAPICheck: types.Bool(true, types.NewTestMetadata()),
|
||||
SkipRequestingAccountID: types.Bool(true, types.NewTestMetadata()),
|
||||
S3UsePathStyle: types.Bool(true, types.NewTestMetadata()),
|
||||
MaxRetries: types.IntDefault(defaultMaxRetires, types.NewTestMetadata()),
|
||||
}),
|
||||
Profile: types.StringTest("localstack"),
|
||||
AccessKey: types.StringTest("fake"),
|
||||
SecretKey: types.StringTest("fake"),
|
||||
SkipCredentialsValidation: types.BoolTest(true),
|
||||
SkipMetadataAPICheck: types.BoolTest(true),
|
||||
SkipRequestingAccountID: types.BoolTest(true),
|
||||
S3UsePathStyle: types.BoolTest(true),
|
||||
MaxRetries: types.IntTest(defaultMaxRetires),
|
||||
SharedConfigFiles: types.StringValueList{
|
||||
types.StringDefault(defaultSharedConfigFile, types.NewTestMetadata()),
|
||||
types.StringTest(defaultSharedConfigFile),
|
||||
},
|
||||
SharedCredentialsFiles: types.StringValueList{
|
||||
types.StringDefault(defaultSharedCredentialsFile, types.NewTestMetadata()),
|
||||
types.StringTest(defaultSharedCredentialsFile),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -93,26 +92,26 @@ provider "aws" {
|
||||
`,
|
||||
expected: []aws.TerraformProvider{
|
||||
{
|
||||
Region: types.String("us-east-1", types.NewTestMetadata()),
|
||||
Endpoints: types.Map(make(map[string]string), types.NewTestMetadata()),
|
||||
MaxRetries: types.IntDefault(defaultMaxRetires, types.NewTestMetadata()),
|
||||
Region: types.StringTest("us-east-1"),
|
||||
Endpoints: types.MapTest(make(map[string]string)),
|
||||
MaxRetries: types.IntTest(defaultMaxRetires),
|
||||
SharedConfigFiles: types.StringValueList{
|
||||
types.StringDefault(defaultSharedConfigFile, types.NewTestMetadata()),
|
||||
types.StringTest(defaultSharedConfigFile),
|
||||
},
|
||||
SharedCredentialsFiles: types.StringValueList{
|
||||
types.StringDefault(defaultSharedCredentialsFile, types.NewTestMetadata()),
|
||||
types.StringTest(defaultSharedCredentialsFile),
|
||||
},
|
||||
},
|
||||
{
|
||||
Alias: types.String("west", types.NewTestMetadata()),
|
||||
Region: types.String("us-west-2", types.NewTestMetadata()),
|
||||
Endpoints: types.Map(make(map[string]string), types.NewTestMetadata()),
|
||||
MaxRetries: types.IntDefault(defaultMaxRetires, types.NewTestMetadata()),
|
||||
Alias: types.StringTest("west"),
|
||||
Region: types.StringTest("us-west-2"),
|
||||
Endpoints: types.MapTest(make(map[string]string)),
|
||||
MaxRetries: types.IntTest(defaultMaxRetires),
|
||||
SharedConfigFiles: types.StringValueList{
|
||||
types.StringDefault(defaultSharedConfigFile, types.NewTestMetadata()),
|
||||
types.StringTest(defaultSharedConfigFile),
|
||||
},
|
||||
SharedCredentialsFiles: types.StringValueList{
|
||||
types.StringDefault(defaultSharedCredentialsFile, types.NewTestMetadata()),
|
||||
types.StringTest(defaultSharedCredentialsFile),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -58,77 +58,57 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: rds.RDS{
|
||||
Instances: []rds.Instance{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
BackupRetentionPeriodDays: iacTypes.Int(5, iacTypes.NewTestMetadata()),
|
||||
ReplicationSourceARN: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
BackupRetentionPeriodDays: iacTypes.IntTest(5),
|
||||
PerformanceInsights: rds.PerformanceInsights{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("performance_key_1", iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
KMSKeyID: iacTypes.StringTest("performance_key_1"),
|
||||
},
|
||||
Encryption: rds.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EncryptStorage: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("kms_key_2", iacTypes.NewTestMetadata()),
|
||||
EncryptStorage: iacTypes.BoolTest(true),
|
||||
KMSKeyID: iacTypes.StringTest("kms_key_2"),
|
||||
},
|
||||
PublicAccess: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Engine: iacTypes.String(rds.EngineAurora, iacTypes.NewTestMetadata()),
|
||||
StorageEncrypted: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Engine: iacTypes.StringTest(rds.EngineAurora),
|
||||
StorageEncrypted: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
Clusters: []rds.Cluster{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
BackupRetentionPeriodDays: iacTypes.Int(7, iacTypes.NewTestMetadata()),
|
||||
ReplicationSourceARN: iacTypes.String("arn-of-a-source-db-cluster", iacTypes.NewTestMetadata()),
|
||||
PerformanceInsights: rds.PerformanceInsights{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
BackupRetentionPeriodDays: iacTypes.IntTest(7),
|
||||
ReplicationSourceARN: iacTypes.StringTest("arn-of-a-source-db-cluster"),
|
||||
PerformanceInsights: rds.PerformanceInsights{},
|
||||
Encryption: rds.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EncryptStorage: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("kms_key_1", iacTypes.NewTestMetadata()),
|
||||
EncryptStorage: iacTypes.BoolTest(true),
|
||||
KMSKeyID: iacTypes.StringTest("kms_key_1"),
|
||||
},
|
||||
Instances: []rds.ClusterInstance{
|
||||
{
|
||||
Instance: rds.Instance{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
BackupRetentionPeriodDays: iacTypes.Int(0, iacTypes.NewTestMetadata()),
|
||||
ReplicationSourceARN: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
PerformanceInsights: rds.PerformanceInsights{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("performance_key_0", iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
KMSKeyID: iacTypes.StringTest("performance_key_0"),
|
||||
},
|
||||
Encryption: rds.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EncryptStorage: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("kms_key_0", iacTypes.NewTestMetadata()),
|
||||
EncryptStorage: iacTypes.BoolTest(true),
|
||||
KMSKeyID: iacTypes.StringTest("kms_key_0"),
|
||||
},
|
||||
PublicAccess: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Engine: iacTypes.String(rds.EngineAurora, iacTypes.NewTestMetadata()),
|
||||
StorageEncrypted: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Engine: iacTypes.StringTest(rds.EngineAurora),
|
||||
StorageEncrypted: iacTypes.BoolTest(true),
|
||||
},
|
||||
ClusterIdentifier: iacTypes.String("aws_rds_cluster.example", iacTypes.NewTestMetadata()),
|
||||
ClusterIdentifier: iacTypes.StringTest("aws_rds_cluster.example"),
|
||||
},
|
||||
},
|
||||
PublicAccess: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Engine: iacTypes.String(rds.EngineAuroraMysql, iacTypes.NewTestMetadata()),
|
||||
Engine: iacTypes.StringTest(rds.EngineAuroraMysql),
|
||||
AvailabilityZones: iacTypes.StringValueList{
|
||||
iacTypes.String("us-west-2a", iacTypes.NewTestMetadata()),
|
||||
iacTypes.String("us-west-2b", iacTypes.NewTestMetadata()),
|
||||
iacTypes.String("us-west-2c", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("us-west-2a"),
|
||||
iacTypes.StringTest("us-west-2b"),
|
||||
iacTypes.StringTest("us-west-2c"),
|
||||
},
|
||||
DeletionProtection: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
DeletionProtection: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
Classic: rds.Classic{
|
||||
DBSecurityGroups: []rds.DBSecurityGroup{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
},
|
||||
{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -157,23 +137,10 @@ func Test_adaptInstance(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: rds.Instance{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
BackupRetentionPeriodDays: iacTypes.Int(0, iacTypes.NewTestMetadata()),
|
||||
ReplicationSourceARN: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
PerformanceInsights: rds.PerformanceInsights{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Encryption: rds.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EncryptStorage: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
PublicAccess: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Engine: iacTypes.String(rds.EngineAurora, iacTypes.NewTestMetadata()),
|
||||
StorageEncrypted: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
IAMAuthEnabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
PerformanceInsights: rds.PerformanceInsights{},
|
||||
Encryption: rds.Encryption{},
|
||||
Engine: iacTypes.StringTest(rds.EngineAurora),
|
||||
StorageEncrypted: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -200,21 +167,10 @@ func Test_adaptCluster(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: rds.Cluster{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
BackupRetentionPeriodDays: iacTypes.Int(1, iacTypes.NewTestMetadata()),
|
||||
ReplicationSourceARN: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
PerformanceInsights: rds.PerformanceInsights{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Encryption: rds.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EncryptStorage: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
PublicAccess: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Engine: iacTypes.String(rds.EngineAurora, iacTypes.NewTestMetadata()),
|
||||
BackupRetentionPeriodDays: iacTypes.IntTest(1),
|
||||
PerformanceInsights: rds.PerformanceInsights{},
|
||||
Encryption: rds.Encryption{},
|
||||
Engine: iacTypes.StringTest(rds.EngineAurora),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -44,27 +44,21 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: redshift.Redshift{
|
||||
Clusters: []redshift.Cluster{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ClusterIdentifier: iacTypes.String("tf-redshift-cluster", iacTypes.NewTestMetadata()),
|
||||
PubliclyAccessible: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
NumberOfNodes: iacTypes.Int(1, iacTypes.NewTestMetadata()),
|
||||
AllowVersionUpgrade: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
ClusterIdentifier: iacTypes.StringTest("tf-redshift-cluster"),
|
||||
NumberOfNodes: iacTypes.IntTest(1),
|
||||
EndPoint: redshift.EndPoint{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Port: iacTypes.Int(5440, iacTypes.NewTestMetadata()),
|
||||
Port: iacTypes.IntTest(5440),
|
||||
},
|
||||
Encryption: redshift.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("aws_kms_key.redshift", iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
KMSKeyID: iacTypes.StringTest("aws_kms_key.redshift"),
|
||||
},
|
||||
SubnetGroupName: iacTypes.String("redshift_subnet", iacTypes.NewTestMetadata()),
|
||||
SubnetGroupName: iacTypes.StringTest("redshift_subnet"),
|
||||
},
|
||||
},
|
||||
SecurityGroups: []redshift.SecurityGroup{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Description: iacTypes.String("some description", iacTypes.NewTestMetadata()),
|
||||
Description: iacTypes.StringTest("some description"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -101,21 +95,16 @@ func Test_adaptCluster(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: redshift.Cluster{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ClusterIdentifier: iacTypes.String("tf-redshift-cluster", iacTypes.NewTestMetadata()),
|
||||
PubliclyAccessible: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
NumberOfNodes: iacTypes.Int(1, iacTypes.NewTestMetadata()),
|
||||
AllowVersionUpgrade: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
ClusterIdentifier: iacTypes.StringTest("tf-redshift-cluster"),
|
||||
NumberOfNodes: iacTypes.IntTest(1),
|
||||
EndPoint: redshift.EndPoint{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Port: iacTypes.Int(5440, iacTypes.NewTestMetadata()),
|
||||
Port: iacTypes.IntTest(5440),
|
||||
},
|
||||
Encryption: redshift.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("key-id", iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
KMSKeyID: iacTypes.StringTest("key-id"),
|
||||
},
|
||||
SubnetGroupName: iacTypes.String("redshift_subnet", iacTypes.NewTestMetadata()),
|
||||
SubnetGroupName: iacTypes.StringTest("redshift_subnet"),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -125,21 +114,13 @@ func Test_adaptCluster(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: redshift.Cluster{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ClusterIdentifier: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
PubliclyAccessible: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
NumberOfNodes: iacTypes.Int(1, iacTypes.NewTestMetadata()),
|
||||
AllowVersionUpgrade: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
PubliclyAccessible: iacTypes.BoolTest(true),
|
||||
NumberOfNodes: iacTypes.IntTest(1),
|
||||
AllowVersionUpgrade: iacTypes.BoolTest(true),
|
||||
EndPoint: redshift.EndPoint{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Port: iacTypes.Int(5439, iacTypes.NewTestMetadata()),
|
||||
Port: iacTypes.IntTest(5439),
|
||||
},
|
||||
Encryption: redshift.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
SubnetGroupName: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Encryption: redshift.Encryption{},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -166,8 +147,7 @@ resource "" "example" {
|
||||
}
|
||||
`,
|
||||
expected: redshift.SecurityGroup{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Description: iacTypes.String("Managed by Terraform", iacTypes.NewTestMetadata()),
|
||||
Description: iacTypes.StringTest("Managed by Terraform"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -208,19 +208,15 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: s3.S3{
|
||||
Buckets: []s3.Bucket{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("bucket", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("bucket"),
|
||||
PublicAccessBlock: &s3.PublicAccessBlock{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
BlockPublicACLs: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
BlockPublicPolicy: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
IgnorePublicACLs: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
RestrictPublicBuckets: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
BlockPublicACLs: iacTypes.BoolTest(true),
|
||||
BlockPublicPolicy: iacTypes.BoolTest(true),
|
||||
IgnorePublicACLs: iacTypes.BoolTest(true),
|
||||
RestrictPublicBuckets: iacTypes.BoolTest(true),
|
||||
},
|
||||
BucketPolicies: []iam.Policy{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Document: func() iam.Document {
|
||||
|
||||
builder := iamgo.NewPolicyBuilder()
|
||||
@@ -234,34 +230,28 @@ func Test_Adapt(t *testing.T) {
|
||||
|
||||
return iam.Document{
|
||||
Parsed: builder.Build(),
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IsOffset: true,
|
||||
HasRefs: false,
|
||||
}
|
||||
}(),
|
||||
Builtin: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
},
|
||||
Encryption: s3.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Algorithm: iacTypes.String("aws:kms", iacTypes.NewTestMetadata()),
|
||||
KMSKeyId: iacTypes.String("string-key", iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
Algorithm: iacTypes.StringTest("aws:kms"),
|
||||
KMSKeyId: iacTypes.StringTest("string-key"),
|
||||
},
|
||||
Versioning: s3.Versioning{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
MFADelete: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
MFADelete: iacTypes.BoolTest(true),
|
||||
},
|
||||
Logging: s3.Logging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
TargetBucket: iacTypes.String("aws_s3_bucket.example", iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
TargetBucket: iacTypes.StringTest("aws_s3_bucket.example"),
|
||||
},
|
||||
ACL: iacTypes.String("private", iacTypes.NewTestMetadata()),
|
||||
ACL: iacTypes.StringTest("private"),
|
||||
Grants: []s3.Grant{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Grantee: s3.Grantee{
|
||||
Type: iacTypes.StringTest("Group"),
|
||||
URI: iacTypes.StringTest("http://acs.amazonaws.com/groups/s3/LogDelivery"),
|
||||
@@ -326,11 +316,9 @@ resource "aws_s3_bucket_server_side_encryption_configuration" "this" {
|
||||
expected: s3.S3{
|
||||
Buckets: []s3.Bucket{
|
||||
{
|
||||
Name: iacTypes.String("test", iacTypes.NewTestMetadata()),
|
||||
Encryption: s3.Encryption{
|
||||
Enabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
ACL: iacTypes.String("private", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test"),
|
||||
Encryption: s3.Encryption{},
|
||||
ACL: iacTypes.StringTest("private"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -26,11 +26,8 @@ func Test_adaptTopic(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: sns.Topic{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ARN: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Encryption: sns.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
KMSKeyID: iacTypes.String("/blah", iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.StringTest("/blah"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -41,12 +38,7 @@ func Test_adaptTopic(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: sns.Topic{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ARN: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Encryption: sns.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
KMSKeyID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Encryption: sns.Encryption{},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -39,13 +39,7 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: sqs.SQS{
|
||||
Queues: []sqs.Queue{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
QueueURL: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Encryption: sqs.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ManagedEncryption: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Encryption: sqs.Encryption{},
|
||||
Policies: func() []iam.Policy {
|
||||
sb := iamgo.NewStatementBuilder()
|
||||
sb.WithEffect("Allow")
|
||||
@@ -58,13 +52,9 @@ func Test_Adapt(t *testing.T) {
|
||||
|
||||
return []iam.Policy{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.StringDefault("", iacTypes.NewTestMetadata()),
|
||||
Document: iam.Document{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Parsed: builder.Build(),
|
||||
Parsed: builder.Build(),
|
||||
},
|
||||
Builtin: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
}
|
||||
}(),
|
||||
@@ -81,14 +71,9 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: sqs.SQS{
|
||||
Queues: []sqs.Queue{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
QueueURL: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Encryption: sqs.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ManagedEncryption: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.String("/blah", iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.StringTest("/blah"),
|
||||
},
|
||||
Policies: nil,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -33,8 +33,7 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: ssm.SSM{
|
||||
Secrets: []ssm.Secret{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
KMSKeyID: iacTypes.String("aws_kms_key.secrets", iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.StringTest("aws_kms_key.secrets"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -50,8 +49,7 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: ssm.SSM{
|
||||
Secrets: []ssm.Secret{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
KMSKeyID: iacTypes.String("key_id", iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.StringTest("key_id"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -65,8 +63,7 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: ssm.SSM{
|
||||
Secrets: []ssm.Secret{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
KMSKeyID: iacTypes.String("alias/aws/secretsmanager", iacTypes.NewTestMetadata()),
|
||||
KMSKeyID: iacTypes.StringTest("alias/aws/secretsmanager"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -27,19 +27,14 @@ func Test_adaptWorkspace(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: workspaces.WorkSpace{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
RootVolume: workspaces.Volume{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Encryption: workspaces.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
UserVolume: workspaces.Volume{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Encryption: workspaces.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -51,20 +46,11 @@ func Test_adaptWorkspace(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: workspaces.WorkSpace{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
RootVolume: workspaces.Volume{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Encryption: workspaces.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Encryption: workspaces.Encryption{},
|
||||
},
|
||||
UserVolume: workspaces.Volume{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Encryption: workspaces.Encryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Encryption: workspaces.Encryption{},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -166,9 +166,7 @@ func Test_adaptFunctionApp(t *testing.T) {
|
||||
resource "azurerm_function_app" "my_example" {
|
||||
}
|
||||
`,
|
||||
expected: appservice.FunctionApp{
|
||||
HTTPSOnly: iacTypes.BoolTest(false),
|
||||
},
|
||||
expected: appservice.FunctionApp{},
|
||||
},
|
||||
{
|
||||
name: "os-specific resource",
|
||||
|
||||
@@ -35,12 +35,10 @@ func Test_adaptRoleDefinition(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: authorization.RoleDefinition{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Permissions: []authorization.Permission{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Actions: []iacTypes.StringValue{
|
||||
iacTypes.String("*", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("*"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -66,14 +64,11 @@ func Test_adaptRoleDefinition(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: authorization.RoleDefinition{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Permissions: []authorization.Permission{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
},
|
||||
{},
|
||||
},
|
||||
AssignableScopes: []iacTypes.StringValue{
|
||||
iacTypes.String("/", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("/"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -134,11 +129,10 @@ func Test_adaptRoleAssignment(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: authorization.RoleAssignment{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
RoleDefinitionId: iacTypes.String("/subscriptions/12345678-1234-1234-1234-123456789012/providers/Microsoft.Authorization/roleDefinitions/8e3af657-a8ff-443c-a75c-2fe8c4bcb635", iacTypes.NewTestMetadata()),
|
||||
RoleDefinitionName: iacTypes.String("Owner", iacTypes.NewTestMetadata()),
|
||||
PrincipalId: iacTypes.String("11111111-1111-1111-1111-111111111111", iacTypes.NewTestMetadata()),
|
||||
PrincipalType: iacTypes.String("User", iacTypes.NewTestMetadata()),
|
||||
RoleDefinitionId: iacTypes.StringTest("/subscriptions/12345678-1234-1234-1234-123456789012/providers/Microsoft.Authorization/roleDefinitions/8e3af657-a8ff-443c-a75c-2fe8c4bcb635"),
|
||||
RoleDefinitionName: iacTypes.StringTest("Owner"),
|
||||
PrincipalId: iacTypes.StringTest("11111111-1111-1111-1111-111111111111"),
|
||||
PrincipalType: iacTypes.StringTest("User"),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -151,11 +145,8 @@ func Test_adaptRoleAssignment(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: authorization.RoleAssignment{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
RoleDefinitionId: iacTypes.String("/subscriptions/12345678-1234-1234-1234-123456789012/providers/Microsoft.Authorization/roleDefinitions/reader", iacTypes.NewTestMetadata()),
|
||||
RoleDefinitionName: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
PrincipalId: iacTypes.String("33333333-3333-3333-3333-333333333333", iacTypes.NewTestMetadata()),
|
||||
PrincipalType: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
RoleDefinitionId: iacTypes.StringTest("/subscriptions/12345678-1234-1234-1234-123456789012/providers/Microsoft.Authorization/roleDefinitions/reader"),
|
||||
PrincipalId: iacTypes.StringTest("33333333-3333-3333-3333-333333333333"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -29,9 +29,7 @@ resource "azurerm_managed_disk" "example" {
|
||||
}
|
||||
}`,
|
||||
expected: compute.ManagedDisk{
|
||||
Encryption: compute.Encryption{
|
||||
Enabled: iacTypes.BoolTest(false),
|
||||
},
|
||||
Encryption: compute.Encryption{},
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -82,7 +80,6 @@ resource "azurerm_virtual_machine" "example" {
|
||||
}
|
||||
`,
|
||||
expected: compute.LinuxVirtualMachine{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
VirtualMachine: compute.VirtualMachine{},
|
||||
OSProfileLinuxConfig: compute.OSProfileLinuxConfig{
|
||||
DisablePasswordAuthentication: iacTypes.BoolTest(true),
|
||||
|
||||
@@ -25,7 +25,6 @@ resource "azurerm_cosmosdb_account" "example" {
|
||||
}
|
||||
`,
|
||||
expected: cosmosdb.Account{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IPRangeFilter: []iacTypes.StringValue{},
|
||||
},
|
||||
},
|
||||
@@ -37,7 +36,6 @@ resource "azurerm_cosmosdb_account" "example" {
|
||||
}
|
||||
`,
|
||||
expected: cosmosdb.Account{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IPRangeFilter: []iacTypes.StringValue{
|
||||
iacTypes.StringTest("10.0.0.0/16"),
|
||||
},
|
||||
@@ -51,7 +49,6 @@ resource "azurerm_cosmosdb_account" "example" {
|
||||
}
|
||||
`,
|
||||
expected: cosmosdb.Account{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IPRangeFilter: []iacTypes.StringValue{
|
||||
iacTypes.StringTest("10.0.0.0/16"),
|
||||
iacTypes.StringTest("192.168.1.0/24"),
|
||||
@@ -67,7 +64,6 @@ resource "azurerm_cosmosdb_account" "example" {
|
||||
}
|
||||
`,
|
||||
expected: cosmosdb.Account{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IPRangeFilter: []iacTypes.StringValue{
|
||||
iacTypes.StringTest("10.0.0.0/8"),
|
||||
iacTypes.StringTest("172.16.0.0/12"),
|
||||
@@ -82,7 +78,6 @@ resource "azurerm_cosmosdb_account" "example" {
|
||||
}
|
||||
`,
|
||||
expected: cosmosdb.Account{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IPRangeFilter: nil, // AsStringValues() returns nil for empty lists
|
||||
},
|
||||
},
|
||||
@@ -111,7 +106,6 @@ resource "azurerm_cosmosdb_account" "example1" {
|
||||
`,
|
||||
expected: []cosmosdb.Account{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IPRangeFilter: []iacTypes.StringValue{},
|
||||
},
|
||||
},
|
||||
@@ -129,13 +123,11 @@ resource "azurerm_cosmosdb_account" "example2" {
|
||||
`,
|
||||
expected: []cosmosdb.Account{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IPRangeFilter: []iacTypes.StringValue{
|
||||
iacTypes.StringTest("10.0.0.0/16"),
|
||||
},
|
||||
},
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IPRangeFilter: []iacTypes.StringValue{
|
||||
iacTypes.StringTest("192.168.0.0/16"),
|
||||
},
|
||||
@@ -169,7 +161,6 @@ resource "azurerm_cosmosdb_account" "example" {
|
||||
expected: cosmosdb.CosmosDB{
|
||||
Accounts: []cosmosdb.Account{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IPRangeFilter: []iacTypes.StringValue{
|
||||
iacTypes.StringTest("10.0.0.0/16"),
|
||||
},
|
||||
@@ -190,11 +181,9 @@ resource "azurerm_cosmosdb_account" "example2" {
|
||||
expected: cosmosdb.CosmosDB{
|
||||
Accounts: []cosmosdb.Account{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IPRangeFilter: []iacTypes.StringValue{},
|
||||
},
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IPRangeFilter: []iacTypes.StringValue{
|
||||
iacTypes.StringTest("192.168.0.0/16"),
|
||||
},
|
||||
|
||||
@@ -28,10 +28,7 @@ func Test_adaptFactory(t *testing.T) {
|
||||
public_network_enabled = false
|
||||
}
|
||||
`,
|
||||
expected: datafactory.Factory{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EnablePublicNetwork: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
expected: datafactory.Factory{},
|
||||
},
|
||||
{
|
||||
name: "default",
|
||||
@@ -41,8 +38,7 @@ func Test_adaptFactory(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: datafactory.Factory{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EnablePublicNetwork: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
EnablePublicNetwork: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -26,8 +26,7 @@ func Test_adaptStore(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: datalake.Store{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EnableEncryption: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
EnableEncryption: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -37,10 +36,7 @@ func Test_adaptStore(t *testing.T) {
|
||||
encryption_state = "Disabled"
|
||||
}
|
||||
`,
|
||||
expected: datalake.Store{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EnableEncryption: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
expected: datalake.Store{},
|
||||
},
|
||||
{
|
||||
name: "enabled by default",
|
||||
@@ -49,8 +45,7 @@ func Test_adaptStore(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: datalake.Store{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EnableEncryption: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
EnableEncryption: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -37,12 +37,10 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: keyvault.KeyVault{
|
||||
Vaults: []keyvault.Vault{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EnablePurgeProtection: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
SoftDeleteRetentionDays: iacTypes.Int(7, iacTypes.NewTestMetadata()),
|
||||
EnablePurgeProtection: iacTypes.BoolTest(true),
|
||||
SoftDeleteRetentionDays: iacTypes.IntTest(7),
|
||||
NetworkACLs: keyvault.NetworkACLs{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
DefaultAction: iacTypes.String("Deny", iacTypes.NewTestMetadata()),
|
||||
DefaultAction: iacTypes.StringTest("Deny"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -57,13 +55,7 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: keyvault.KeyVault{
|
||||
Vaults: []keyvault.Vault{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EnablePurgeProtection: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
SoftDeleteRetentionDays: iacTypes.Int(0, iacTypes.NewTestMetadata()),
|
||||
NetworkACLs: keyvault.NetworkACLs{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
DefaultAction: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
NetworkACLs: keyvault.NetworkACLs{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -92,9 +84,7 @@ func Test_adaptSecret(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: keyvault.Secret{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ContentType: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
ExpiryDate: iacTypes.Time(time.Time{}, iacTypes.NewTestMetadata()),
|
||||
ExpiryDate: iacTypes.TimeTest(time.Time{}),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -106,12 +96,11 @@ func Test_adaptSecret(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: keyvault.Secret{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ContentType: iacTypes.String("password", iacTypes.NewTestMetadata()),
|
||||
ExpiryDate: iacTypes.Time(func(timeVal string) time.Time {
|
||||
ContentType: iacTypes.StringTest("password"),
|
||||
ExpiryDate: iacTypes.TimeTest(func(timeVal string) time.Time {
|
||||
parsed, _ := time.Parse(time.RFC3339, timeVal)
|
||||
return parsed
|
||||
}("1982-12-31T00:00:00Z"), iacTypes.NewTestMetadata())},
|
||||
}("1982-12-31T00:00:00Z"))},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -139,11 +128,10 @@ func Test_adaptKey(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: keyvault.Key{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ExpiryDate: iacTypes.Time(func(timeVal string) time.Time {
|
||||
ExpiryDate: iacTypes.TimeTest(func(timeVal string) time.Time {
|
||||
parsed, _ := time.Parse(time.RFC3339, timeVal)
|
||||
return parsed
|
||||
}("1982-12-31T00:00:00Z"), iacTypes.NewTestMetadata()),
|
||||
}("1982-12-31T00:00:00Z")),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -153,8 +141,7 @@ func Test_adaptKey(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: keyvault.Key{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ExpiryDate: iacTypes.Time(time.Time{}, iacTypes.NewTestMetadata()),
|
||||
ExpiryDate: iacTypes.TimeTest(time.Time{}),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -196,10 +183,7 @@ resource "azurerm_key_vault_key" "this" {
|
||||
expiration_date = time_offset.expiry.rfc3339
|
||||
}
|
||||
`,
|
||||
expected: keyvault.Key{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ExpiryDate: iacTypes.TimeUnresolvable(iacTypes.NewTestMetadata()),
|
||||
},
|
||||
expected: keyvault.Key{},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -41,21 +41,19 @@ func Test_adaptLogProfile(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: monitor.LogProfile{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Categories: []iacTypes.StringValue{
|
||||
iacTypes.String("Action", iacTypes.NewTestMetadata()),
|
||||
iacTypes.String("Delete", iacTypes.NewTestMetadata()),
|
||||
iacTypes.String("Write", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("Action"),
|
||||
iacTypes.StringTest("Delete"),
|
||||
iacTypes.StringTest("Write"),
|
||||
},
|
||||
RetentionPolicy: monitor.RetentionPolicy{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Days: iacTypes.Int(365, iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
Days: iacTypes.IntTest(365),
|
||||
},
|
||||
Locations: []iacTypes.StringValue{
|
||||
iacTypes.String("eastus", iacTypes.NewTestMetadata()),
|
||||
iacTypes.String("eastus2", iacTypes.NewTestMetadata()),
|
||||
iacTypes.String("southcentralus", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("eastus"),
|
||||
iacTypes.StringTest("eastus2"),
|
||||
iacTypes.StringTest("southcentralus"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -66,12 +64,7 @@ func Test_adaptLogProfile(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: monitor.LogProfile{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
RetentionPolicy: monitor.RetentionPolicy{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Days: iacTypes.Int(0, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
RetentionPolicy: monitor.RetentionPolicy{},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -63,8 +63,7 @@ func Test_Adapt(t *testing.T) {
|
||||
},
|
||||
SourcePorts: []common.PortRange{
|
||||
{
|
||||
Start: iacTypes.IntTest(0),
|
||||
End: iacTypes.IntTest(65535),
|
||||
End: iacTypes.IntTest(65535),
|
||||
},
|
||||
},
|
||||
DestinationPorts: []common.PortRange{
|
||||
@@ -131,26 +130,20 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: network.Network{
|
||||
NetworkInterfaces: []network.NetworkInterface{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
// legacy fields filled from primary
|
||||
SubnetID: iacTypes.String("subnet-primary-id", iacTypes.NewTestMetadata()),
|
||||
HasPublicIP: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
PublicIPAddress: iacTypes.String("public-ip-primary-id", iacTypes.NewTestMetadata()),
|
||||
SubnetID: iacTypes.StringTest("subnet-primary-id"),
|
||||
HasPublicIP: iacTypes.BoolTest(true),
|
||||
PublicIPAddress: iacTypes.StringTest("public-ip-primary-id"),
|
||||
|
||||
IPConfigurations: []network.IPConfiguration{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
SubnetID: iacTypes.String("subnet-primary-id", iacTypes.NewTestMetadata()),
|
||||
Primary: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
HasPublicIP: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
PublicIPAddress: iacTypes.String("public-ip-primary-id", iacTypes.NewTestMetadata()),
|
||||
SubnetID: iacTypes.StringTest("subnet-primary-id"),
|
||||
Primary: iacTypes.BoolTest(true),
|
||||
HasPublicIP: iacTypes.BoolTest(true),
|
||||
PublicIPAddress: iacTypes.StringTest("public-ip-primary-id"),
|
||||
},
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
SubnetID: iacTypes.String("subnet-secondary-id", iacTypes.NewTestMetadata()),
|
||||
Primary: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
HasPublicIP: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
PublicIPAddress: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
SubnetID: iacTypes.StringTest("subnet-secondary-id"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -202,11 +195,7 @@ func Test_adaptWatcherLog(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: network.NetworkWatcherFlowLog{
|
||||
Enabled: iacTypes.BoolTest(false),
|
||||
RetentionPolicy: network.RetentionPolicy{
|
||||
Enabled: iacTypes.BoolTest(false),
|
||||
Days: iacTypes.IntTest(0),
|
||||
},
|
||||
RetentionPolicy: network.RetentionPolicy{},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -29,11 +29,10 @@ func Test_adaptContact(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: securitycenter.Contact{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EnableAlertNotifications: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
EnableAlertsToAdmins: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Email: iacTypes.String("contact@example.com", iacTypes.NewTestMetadata()),
|
||||
Phone: iacTypes.String("+1-555-555-5555", iacTypes.NewTestMetadata()),
|
||||
EnableAlertNotifications: iacTypes.BoolTest(true),
|
||||
EnableAlertsToAdmins: iacTypes.BoolTest(true),
|
||||
Email: iacTypes.StringTest("contact@example.com"),
|
||||
Phone: iacTypes.StringTest("+1-555-555-5555"),
|
||||
IsEnabled: iacTypes.BoolValue{},
|
||||
MinimalSeverity: iacTypes.StringValue{},
|
||||
},
|
||||
@@ -45,13 +44,8 @@ func Test_adaptContact(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: securitycenter.Contact{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EnableAlertNotifications: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
EnableAlertsToAdmins: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Email: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Phone: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
IsEnabled: iacTypes.BoolValue{},
|
||||
MinimalSeverity: iacTypes.StringValue{},
|
||||
IsEnabled: iacTypes.BoolValue{},
|
||||
MinimalSeverity: iacTypes.StringValue{},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -78,8 +72,7 @@ func Test_adaptSubscription(t *testing.T) {
|
||||
tier = "Free"
|
||||
}`,
|
||||
expected: securitycenter.SubscriptionPricing{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Tier: iacTypes.String("Free", iacTypes.NewTestMetadata()),
|
||||
Tier: iacTypes.StringTest("Free"),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -88,8 +81,7 @@ func Test_adaptSubscription(t *testing.T) {
|
||||
resource "azurerm_security_center_subscription_pricing" "example" {
|
||||
}`,
|
||||
expected: securitycenter.SubscriptionPricing{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Tier: iacTypes.String("Free", iacTypes.NewTestMetadata()),
|
||||
Tier: iacTypes.StringTest("Free"),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -99,8 +91,7 @@ func Test_adaptSubscription(t *testing.T) {
|
||||
tier = "Standard"
|
||||
}`,
|
||||
expected: securitycenter.SubscriptionPricing{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Tier: iacTypes.String("Standard", iacTypes.NewTestMetadata()),
|
||||
Tier: iacTypes.StringTest("Standard"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -24,20 +24,15 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: storage.Storage{
|
||||
Accounts: []storage.Account{
|
||||
{
|
||||
PublicNetworkAccess: iacTypes.BoolTest(true),
|
||||
MinimumTLSVersion: iacTypes.StringTest(minimumTlsVersionOneTwo),
|
||||
EnforceHTTPS: iacTypes.BoolTest(true),
|
||||
AccountReplicationType: iacTypes.StringTest(""),
|
||||
InfrastructureEncryptionEnabled: iacTypes.BoolTest(false),
|
||||
PublicNetworkAccess: iacTypes.BoolTest(true),
|
||||
MinimumTLSVersion: iacTypes.StringTest(minimumTlsVersionOneTwo),
|
||||
EnforceHTTPS: iacTypes.BoolTest(true),
|
||||
BlobProperties: storage.BlobProperties{
|
||||
DeleteRetentionPolicy: storage.DeleteRetentionPolicy{
|
||||
Days: iacTypes.IntTest(7),
|
||||
},
|
||||
},
|
||||
CustomerManagedKey: storage.CustomerManagedKey{
|
||||
KeyVaultKeyId: iacTypes.StringTest(""),
|
||||
UserAssignedIdentityId: iacTypes.StringTest(""),
|
||||
},
|
||||
CustomerManagedKey: storage.CustomerManagedKey{},
|
||||
},
|
||||
{
|
||||
BlobProperties: storage.BlobProperties{
|
||||
@@ -97,53 +92,41 @@ func Test_Adapt(t *testing.T) {
|
||||
Accounts: []storage.Account{
|
||||
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EnforceHTTPS: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
MinimumTLSVersion: iacTypes.String("TLS1_2", iacTypes.NewTestMetadata()),
|
||||
PublicNetworkAccess: iacTypes.BoolTest(false),
|
||||
EnforceHTTPS: iacTypes.BoolTest(true),
|
||||
MinimumTLSVersion: iacTypes.StringTest("TLS1_2"),
|
||||
NetworkRules: []storage.NetworkRule{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Bypass: []iacTypes.StringValue{
|
||||
iacTypes.String("Metrics", iacTypes.NewTestMetadata()),
|
||||
iacTypes.String("AzureServices", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("Metrics"),
|
||||
iacTypes.StringTest("AzureServices"),
|
||||
},
|
||||
AllowByDefault: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Bypass: []iacTypes.StringValue{
|
||||
iacTypes.String("Metrics", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("Metrics"),
|
||||
},
|
||||
AllowByDefault: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
AllowByDefault: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
QueueProperties: storage.QueueProperties{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EnableLogging: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
EnableLogging: iacTypes.BoolTest(true),
|
||||
Logging: storage.QueueLogging{
|
||||
Delete: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Read: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Write: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Version: iacTypes.String("1.0", iacTypes.NewTestMetadata()),
|
||||
RetentionPolicyDays: iacTypes.Int(10, iacTypes.NewTestMetadata()),
|
||||
Delete: iacTypes.BoolTest(true),
|
||||
Read: iacTypes.BoolTest(true),
|
||||
Write: iacTypes.BoolTest(true),
|
||||
Version: iacTypes.StringTest("1.0"),
|
||||
RetentionPolicyDays: iacTypes.IntTest(10),
|
||||
},
|
||||
},
|
||||
AccountReplicationType: iacTypes.StringTest(""),
|
||||
InfrastructureEncryptionEnabled: iacTypes.BoolTest(false),
|
||||
BlobProperties: storage.BlobProperties{
|
||||
DeleteRetentionPolicy: storage.DeleteRetentionPolicy{
|
||||
Days: iacTypes.IntTest(7),
|
||||
},
|
||||
},
|
||||
CustomerManagedKey: storage.CustomerManagedKey{
|
||||
KeyVaultKeyId: iacTypes.StringTest(""),
|
||||
UserAssignedIdentityId: iacTypes.StringTest(""),
|
||||
},
|
||||
CustomerManagedKey: storage.CustomerManagedKey{},
|
||||
Containers: []storage.Container{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
PublicAccess: iacTypes.String("blob", iacTypes.NewTestMetadata()),
|
||||
PublicAccess: iacTypes.StringTest("blob"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -189,11 +172,10 @@ func Test_Adapt(t *testing.T) {
|
||||
EnforceHTTPS: iacTypes.BoolDefault(false, iacTypes.NewUnmanagedMetadata()),
|
||||
NetworkRules: []storage.NetworkRule{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Bypass: []iacTypes.StringValue{
|
||||
iacTypes.String("Metrics", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("Metrics"),
|
||||
},
|
||||
AllowByDefault: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
AllowByDefault: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
QueueProperties: storage.QueueProperties{
|
||||
@@ -214,8 +196,7 @@ func Test_Adapt(t *testing.T) {
|
||||
},
|
||||
Containers: []storage.Container{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
PublicAccess: iacTypes.String("blob", iacTypes.NewTestMetadata()),
|
||||
PublicAccess: iacTypes.StringTest("blob"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -26,8 +26,7 @@ func Test_adaptWorkspace(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: synapse.Workspace{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EnableManagedVirtualNetwork: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
EnableManagedVirtualNetwork: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -37,10 +36,7 @@ func Test_adaptWorkspace(t *testing.T) {
|
||||
managed_virtual_network_enabled = false
|
||||
}
|
||||
`,
|
||||
expected: synapse.Workspace{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EnableManagedVirtualNetwork: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
expected: synapse.Workspace{},
|
||||
},
|
||||
{
|
||||
name: "default",
|
||||
@@ -48,10 +44,7 @@ func Test_adaptWorkspace(t *testing.T) {
|
||||
resource "azurerm_synapse_workspace" "example" {
|
||||
}
|
||||
`,
|
||||
expected: synapse.Workspace{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EnableManagedVirtualNetwork: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
expected: synapse.Workspace{},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -29,9 +29,8 @@ export DATABASE_PASSWORD=\"SomeSortOfPassword\"
|
||||
}
|
||||
`,
|
||||
expected: compute.Instance{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
UserData: iacTypes.String(`export DATABASE_PASSWORD=\"SomeSortOfPassword\"
|
||||
`, iacTypes.NewTestMetadata()),
|
||||
UserData: iacTypes.StringTest(`export DATABASE_PASSWORD=\"SomeSortOfPassword\"
|
||||
`),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -43,8 +42,7 @@ export DATABASE_PASSWORD=\"SomeSortOfPassword\"
|
||||
}
|
||||
`,
|
||||
expected: compute.Instance{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
UserData: iacTypes.String(`export DATABASE_PASSWORD="SomeSortOfPassword"`, iacTypes.NewTestMetadata()),
|
||||
UserData: iacTypes.StringTest(`export DATABASE_PASSWORD="SomeSortOfPassword"`),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -53,10 +51,7 @@ export DATABASE_PASSWORD=\"SomeSortOfPassword\"
|
||||
resource "cloudstack_instance" "web" {
|
||||
}
|
||||
`,
|
||||
expected: compute.Instance{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
UserData: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
expected: compute.Instance{},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -31,9 +31,8 @@ func Test_adaptDroplets(t *testing.T) {
|
||||
`,
|
||||
expected: []compute.Droplet{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
SSHKeys: []iacTypes.StringValue{
|
||||
iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringUnresolvable(iacTypes.NewTestMetadata()),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -51,9 +50,8 @@ func Test_adaptDroplets(t *testing.T) {
|
||||
`,
|
||||
expected: []compute.Droplet{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
SSHKeys: []iacTypes.StringValue{
|
||||
iacTypes.String("my-ssh-key", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("my-ssh-key"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -65,9 +63,7 @@ func Test_adaptDroplets(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: []compute.Droplet{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
},
|
||||
{},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -108,21 +104,18 @@ func Test_adaptFirewalls(t *testing.T) {
|
||||
`,
|
||||
expected: []compute.Firewall{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
OutboundRules: []compute.OutboundFirewallRule{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
DestinationAddresses: []iacTypes.StringValue{
|
||||
iacTypes.String("192.168.1.0/24", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("192.168.1.0/24"),
|
||||
},
|
||||
},
|
||||
},
|
||||
InboundRules: []compute.InboundFirewallRule{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
SourceAddresses: []iacTypes.StringValue{
|
||||
iacTypes.String("192.168.1.0/24", iacTypes.NewTestMetadata()),
|
||||
iacTypes.String("fc00::/7", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("192.168.1.0/24"),
|
||||
iacTypes.StringTest("fc00::/7"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -136,11 +129,7 @@ func Test_adaptFirewalls(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: []compute.Firewall{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
OutboundRules: []compute.OutboundFirewallRule(nil),
|
||||
InboundRules: []compute.InboundFirewallRule(nil),
|
||||
},
|
||||
{},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -178,12 +167,10 @@ func Test_adaptLoadBalancers(t *testing.T) {
|
||||
`,
|
||||
expected: []compute.LoadBalancer{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
RedirectHttpToHttps: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
RedirectHttpToHttps: iacTypes.BoolTest(true),
|
||||
ForwardingRules: []compute.ForwardingRule{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EntryProtocol: iacTypes.String("https", iacTypes.NewTestMetadata()),
|
||||
EntryProtocol: iacTypes.StringTest("https"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -196,10 +183,7 @@ func Test_adaptLoadBalancers(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: []compute.LoadBalancer{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ForwardingRules: nil,
|
||||
},
|
||||
{},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -232,9 +216,8 @@ func Test_adaptKubernetesClusters(t *testing.T) {
|
||||
`,
|
||||
expected: []compute.KubernetesCluster{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
SurgeUpgrade: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
AutoUpgrade: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
SurgeUpgrade: iacTypes.BoolTest(true),
|
||||
AutoUpgrade: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -245,11 +228,7 @@ func Test_adaptKubernetesClusters(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: []compute.KubernetesCluster{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
SurgeUpgrade: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
AutoUpgrade: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
{},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -40,19 +40,16 @@ func Test_adaptBuckets(t *testing.T) {
|
||||
`,
|
||||
expected: []spaces.Bucket{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("public_space", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("public_space"),
|
||||
Objects: []spaces.Object{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ACL: iacTypes.String("private", iacTypes.NewTestMetadata()),
|
||||
ACL: iacTypes.StringTest("private"),
|
||||
},
|
||||
},
|
||||
ACL: iacTypes.String("private", iacTypes.NewTestMetadata()),
|
||||
ForceDestroy: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
ACL: iacTypes.StringTest("private"),
|
||||
ForceDestroy: iacTypes.BoolTest(true),
|
||||
Versioning: spaces.Versioning{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -66,15 +63,8 @@ func Test_adaptBuckets(t *testing.T) {
|
||||
`,
|
||||
expected: []spaces.Bucket{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Objects: nil,
|
||||
ACL: iacTypes.String("private", iacTypes.NewTestMetadata()),
|
||||
ForceDestroy: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Versioning: spaces.Versioning{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
ACL: iacTypes.StringTest("private"),
|
||||
Versioning: spaces.Versioning{},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -22,14 +22,7 @@ resource "github_actions_environment_secret" "example" {
|
||||
}
|
||||
`,
|
||||
expected: []github.EnvironmentSecret{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Environment: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
SecretName: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
PlainTextValue: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
EncryptedValue: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Repository: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
{},
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -45,12 +38,11 @@ resource "github_actions_environment_secret" "example" {
|
||||
`,
|
||||
expected: []github.EnvironmentSecret{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
SecretName: iacTypes.String("a", iacTypes.NewTestMetadata()),
|
||||
PlainTextValue: iacTypes.String("b", iacTypes.NewTestMetadata()),
|
||||
Environment: iacTypes.String("c", iacTypes.NewTestMetadata()),
|
||||
EncryptedValue: iacTypes.String("d", iacTypes.NewTestMetadata()),
|
||||
Repository: iacTypes.String("e", iacTypes.NewTestMetadata()),
|
||||
SecretName: iacTypes.StringTest("a"),
|
||||
PlainTextValue: iacTypes.StringTest("b"),
|
||||
Environment: iacTypes.StringTest("c"),
|
||||
EncryptedValue: iacTypes.StringTest("d"),
|
||||
Repository: iacTypes.StringTest("e"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -36,20 +36,14 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: bigquery.BigQuery{
|
||||
Datasets: []bigquery.Dataset{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
AccessGrants: []bigquery.AccessGrant{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Role: iacTypes.String("OWNER", iacTypes.NewTestMetadata()),
|
||||
Domain: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
SpecialGroup: iacTypes.String(bigquery.SpecialGroupAllAuthenticatedUsers, iacTypes.NewTestMetadata()),
|
||||
Role: iacTypes.StringTest("OWNER"),
|
||||
SpecialGroup: iacTypes.StringTest(bigquery.SpecialGroupAllAuthenticatedUsers),
|
||||
},
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Role: iacTypes.String("READER", iacTypes.NewTestMetadata()),
|
||||
Domain: iacTypes.String("hashicorp.com", iacTypes.NewTestMetadata()),
|
||||
SpecialGroup: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Role: iacTypes.StringTest("READER"),
|
||||
Domain: iacTypes.StringTest("hashicorp.com"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -66,8 +60,7 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: bigquery.BigQuery{
|
||||
Datasets: []bigquery.Dataset{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ID: iacTypes.String("example_dataset", iacTypes.NewTestMetadata()),
|
||||
ID: iacTypes.StringTest("example_dataset"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -83,15 +76,8 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: bigquery.BigQuery{
|
||||
Datasets: []bigquery.Dataset{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
AccessGrants: []bigquery.AccessGrant{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Role: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Domain: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
SpecialGroup: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
{},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -36,20 +36,15 @@ func Test_adaptDisks(t *testing.T) {
|
||||
`,
|
||||
expected: []compute.Disk{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("disk #1", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("disk #1"),
|
||||
Encryption: compute.DiskEncryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
KMSKeyLink: iacTypes.String("something", iacTypes.NewTestMetadata()),
|
||||
KMSKeyLink: iacTypes.StringTest("something"),
|
||||
},
|
||||
},
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("disk #2", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("disk #2"),
|
||||
Encryption: compute.DiskEncryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
KMSKeyLink: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
RawKey: iacTypes.Bytes([]byte("b2ggbm8gdGhpcyBpcyBiYWQ"), iacTypes.NewTestMetadata()),
|
||||
RawKey: iacTypes.BytesTest([]byte("b2ggbm8gdGhpcyBpcyBiYWQ")),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -70,11 +65,9 @@ func Test_adaptDisks(t *testing.T) {
|
||||
}`,
|
||||
expected: []compute.Disk{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("disk #3", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("disk #3"),
|
||||
Encryption: compute.DiskEncryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
KMSKeyLink: iacTypes.String("google_kms_crypto_key.my_crypto_key", iacTypes.NewTestMetadata()),
|
||||
KMSKeyLink: iacTypes.StringTest("google_kms_crypto_key.my_crypto_key"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -57,39 +57,30 @@ func Test_adaptInstances(t *testing.T) {
|
||||
`,
|
||||
expected: []compute.Instance{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("test", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test"),
|
||||
NetworkInterfaces: []compute.NetworkInterface{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
HasPublicIP: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
NATIP: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
HasPublicIP: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
ShieldedVM: compute.ShieldedVMConfig{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
SecureBootEnabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
IntegrityMonitoringEnabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
VTPMEnabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
SecureBootEnabled: iacTypes.BoolTest(true),
|
||||
IntegrityMonitoringEnabled: iacTypes.BoolTest(true),
|
||||
VTPMEnabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
ServiceAccount: compute.ServiceAccount{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Email: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Scopes: []iacTypes.StringValue{
|
||||
iacTypes.String("cloud-platform", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("cloud-platform"),
|
||||
},
|
||||
IsDefault: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
CanIPForward: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
EnableProjectSSHKeyBlocking: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
EnableSerialPort: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
CanIPForward: iacTypes.BoolTest(true),
|
||||
EnableProjectSSHKeyBlocking: iacTypes.BoolTest(true),
|
||||
EnableSerialPort: iacTypes.BoolTest(true),
|
||||
BootDisks: []compute.Disk{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("boot-disk", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("boot-disk"),
|
||||
Encryption: compute.DiskEncryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
KMSKeyLink: iacTypes.String("something", iacTypes.NewTestMetadata()),
|
||||
KMSKeyLink: iacTypes.StringTest("something"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -104,23 +95,9 @@ func Test_adaptInstances(t *testing.T) {
|
||||
`,
|
||||
expected: []compute.Instance{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
ShieldedVM: compute.ShieldedVMConfig{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
SecureBootEnabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
IntegrityMonitoringEnabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
VTPMEnabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
ServiceAccount: compute.ServiceAccount{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Email: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
IsDefault: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
CanIPForward: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
OSLoginEnabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
EnableProjectSSHKeyBlocking: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
EnableSerialPort: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
ShieldedVM: compute.ShieldedVMConfig{},
|
||||
ServiceAccount: compute.ServiceAccount{},
|
||||
OSLoginEnabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -133,23 +110,11 @@ func Test_adaptInstances(t *testing.T) {
|
||||
`,
|
||||
expected: []compute.Instance{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
ShieldedVM: compute.ShieldedVMConfig{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
SecureBootEnabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
IntegrityMonitoringEnabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
VTPMEnabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
ShieldedVM: compute.ShieldedVMConfig{},
|
||||
ServiceAccount: compute.ServiceAccount{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Email: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
IsDefault: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
IsDefault: iacTypes.BoolTest(true),
|
||||
},
|
||||
CanIPForward: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
OSLoginEnabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
EnableProjectSSHKeyBlocking: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
EnableSerialPort: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
OSLoginEnabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -36,9 +36,7 @@ func Test_adaptProjectMetadata(t *testing.T) {
|
||||
}
|
||||
}
|
||||
`,
|
||||
expected: compute.ProjectMetadata{
|
||||
EnableOSLogin: iacTypes.BoolTest(false),
|
||||
},
|
||||
expected: compute.ProjectMetadata{},
|
||||
},
|
||||
{
|
||||
name: "handles metadata values in various formats",
|
||||
|
||||
@@ -46,18 +46,14 @@ func Test_adaptNetworks(t *testing.T) {
|
||||
`,
|
||||
expected: []compute.Network{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Firewall: &compute.Firewall{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("my-firewall-rule", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("my-firewall-rule"),
|
||||
IngressRules: []compute.IngressRule{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
FirewallRule: compute.FirewallRule{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IsAllow: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Protocol: iacTypes.String("icmp", iacTypes.NewTestMetadata()),
|
||||
Enforced: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
IsAllow: iacTypes.BoolTest(true),
|
||||
Protocol: iacTypes.StringTest("icmp"),
|
||||
Enforced: iacTypes.BoolTest(true),
|
||||
Ports: []common.PortRange{
|
||||
{
|
||||
Start: iacTypes.IntTest(80),
|
||||
@@ -74,17 +70,16 @@ func Test_adaptNetworks(t *testing.T) {
|
||||
},
|
||||
},
|
||||
SourceRanges: []iacTypes.StringValue{
|
||||
iacTypes.String("1.2.3.4/32", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("1.2.3.4/32"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Subnetworks: []compute.SubNetwork{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("test-subnetwork", iacTypes.NewTestMetadata()),
|
||||
EnableFlowLogs: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Purpose: iacTypes.StringDefault("PRIVATE_RFC_1918", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test-subnetwork"),
|
||||
EnableFlowLogs: iacTypes.BoolTest(true),
|
||||
Purpose: iacTypes.StringTest("PRIVATE_RFC_1918"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -107,17 +102,10 @@ func Test_adaptNetworks(t *testing.T) {
|
||||
`,
|
||||
expected: []compute.Network{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Firewall: &compute.Firewall{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Firewall: &compute.Firewall{},
|
||||
Subnetworks: []compute.SubNetwork{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
EnableFlowLogs: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Purpose: iacTypes.String("REGIONAL_MANAGED_PROXY", iacTypes.NewTestMetadata()),
|
||||
Purpose: iacTypes.StringTest("REGIONAL_MANAGED_PROXY"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -137,15 +125,11 @@ func Test_adaptNetworks(t *testing.T) {
|
||||
`,
|
||||
expected: []compute.Network{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Firewall: nil,
|
||||
Subnetworks: []compute.SubNetwork{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("test-subnetwork", iacTypes.NewTestMetadata()),
|
||||
Purpose: iacTypes.StringDefault("PRIVATE_RFC_1918", iacTypes.NewTestMetadata()),
|
||||
EnableFlowLogs: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
PrivateIPGoogleAccess: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("test-subnetwork"),
|
||||
Purpose: iacTypes.StringTest("PRIVATE_RFC_1918"),
|
||||
PrivateIPGoogleAccess: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -163,9 +147,7 @@ func Test_adaptNetworks(t *testing.T) {
|
||||
`,
|
||||
expected: []compute.Network{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Firewall: &compute.Firewall{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IngressRules: []compute.IngressRule{
|
||||
{
|
||||
FirewallRule: compute.FirewallRule{
|
||||
@@ -174,8 +156,7 @@ func Test_adaptNetworks(t *testing.T) {
|
||||
Protocol: iacTypes.StringTest("tcp"),
|
||||
Ports: []common.PortRange{
|
||||
{
|
||||
Start: iacTypes.IntTest(0),
|
||||
End: iacTypes.IntTest(65535),
|
||||
End: iacTypes.IntTest(65535),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -26,10 +26,9 @@ func Test_adaptSSLPolicies(t *testing.T) {
|
||||
`,
|
||||
expected: []compute.SSLPolicy{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("production-ssl-policy", iacTypes.NewTestMetadata()),
|
||||
Profile: iacTypes.String("MODERN", iacTypes.NewTestMetadata()),
|
||||
MinimumTLSVersion: iacTypes.String("TLS_1_2", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("production-ssl-policy"),
|
||||
Profile: iacTypes.StringTest("MODERN"),
|
||||
MinimumTLSVersion: iacTypes.StringTest("TLS_1_2"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -41,10 +40,7 @@ func Test_adaptSSLPolicies(t *testing.T) {
|
||||
`,
|
||||
expected: []compute.SSLPolicy{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Profile: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
MinimumTLSVersion: iacTypes.String("TLS_1_0", iacTypes.NewTestMetadata()),
|
||||
MinimumTLSVersion: iacTypes.StringTest("TLS_1_0"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -44,20 +44,17 @@ resource "google_dns_managed_zone" "example" {
|
||||
expected: dns.DNS{
|
||||
ManagedZones: []dns.ManagedZone{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Visibility: iacTypes.String("public", iacTypes.NewTestMetadata()),
|
||||
Visibility: iacTypes.StringTest("public"),
|
||||
DNSSec: dns.DNSSec{
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
DefaultKeySpecs: []dns.KeySpecs{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Algorithm: iacTypes.String("rsasha1", iacTypes.NewTestMetadata()),
|
||||
KeyType: iacTypes.String("keySigning", iacTypes.NewTestMetadata()),
|
||||
Algorithm: iacTypes.StringTest("rsasha1"),
|
||||
KeyType: iacTypes.StringTest("keySigning"),
|
||||
},
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Algorithm: iacTypes.String("rsasha1", iacTypes.NewTestMetadata()),
|
||||
KeyType: iacTypes.String("zoneSigning", iacTypes.NewTestMetadata()),
|
||||
Algorithm: iacTypes.StringTest("rsasha1"),
|
||||
KeyType: iacTypes.StringTest("zoneSigning"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -115,13 +115,10 @@ resource "google_container_node_pool" "primary_preemptible_nodes" {
|
||||
Clusters: []gke.Cluster{
|
||||
{
|
||||
NodeConfig: gke.NodeConfig{
|
||||
ImageType: iacTypes.String("COS_CONTAINERD", iacTypes.NewTestMetadata()),
|
||||
ImageType: iacTypes.StringTest("COS_CONTAINERD"),
|
||||
WorkloadMetadataConfig: gke.WorkloadMetadataConfig{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
NodeMetadata: iacTypes.String("GCE_METADATA", iacTypes.NewTestMetadata()),
|
||||
NodeMetadata: iacTypes.StringTest("GCE_METADATA"),
|
||||
},
|
||||
ServiceAccount: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
EnableLegacyEndpoints: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
AutoScaling: gke.AutoScaling{
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
@@ -137,56 +134,47 @@ resource "google_container_node_pool" "primary_preemptible_nodes" {
|
||||
NodePools: []gke.NodePool{
|
||||
{
|
||||
Management: gke.Management{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EnableAutoRepair: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
EnableAutoUpgrade: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
EnableAutoRepair: iacTypes.BoolTest(true),
|
||||
EnableAutoUpgrade: iacTypes.BoolTest(true),
|
||||
},
|
||||
NodeConfig: gke.NodeConfig{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ImageType: iacTypes.String("COS_CONTAINERD", iacTypes.NewTestMetadata()),
|
||||
ImageType: iacTypes.StringTest("COS_CONTAINERD"),
|
||||
WorkloadMetadataConfig: gke.WorkloadMetadataConfig{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
NodeMetadata: iacTypes.String("GCE_METADATA", iacTypes.NewTestMetadata()),
|
||||
NodeMetadata: iacTypes.StringTest("GCE_METADATA"),
|
||||
},
|
||||
ServiceAccount: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
EnableLegacyEndpoints: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
},
|
||||
},
|
||||
IPAllocationPolicy: gke.IPAllocationPolicy{
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
MasterAuthorizedNetworks: gke.MasterAuthorizedNetworks{
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
CIDRs: []iacTypes.StringValue{
|
||||
iacTypes.String("10.10.128.0/24", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("10.10.128.0/24"),
|
||||
},
|
||||
},
|
||||
NetworkPolicy: gke.NetworkPolicy{
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
DatapathProvider: iacTypes.String("ADVANCED_DATAPATH", iacTypes.NewTestMetadata()),
|
||||
DatapathProvider: iacTypes.StringTest("ADVANCED_DATAPATH"),
|
||||
PrivateCluster: gke.PrivateCluster{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EnablePrivateNodes: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
EnablePrivateNodes: iacTypes.BoolTest(true),
|
||||
},
|
||||
LoggingService: iacTypes.String("logging.googleapis.com/kubernetes", iacTypes.NewTestMetadata()),
|
||||
MonitoringService: iacTypes.String("monitoring.googleapis.com/kubernetes", iacTypes.NewTestMetadata()),
|
||||
LoggingService: iacTypes.StringTest("logging.googleapis.com/kubernetes"),
|
||||
MonitoringService: iacTypes.StringTest("monitoring.googleapis.com/kubernetes"),
|
||||
MasterAuth: gke.MasterAuth{
|
||||
ClientCertificate: gke.ClientCertificate{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IssueCertificate: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
IssueCertificate: iacTypes.BoolTest(true),
|
||||
},
|
||||
Username: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Password: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
EnableShieldedNodes: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
EnableLegacyABAC: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
ResourceLabels: iacTypes.Map(map[string]string{
|
||||
EnableShieldedNodes: iacTypes.BoolTest(true),
|
||||
EnableLegacyABAC: iacTypes.BoolTest(true),
|
||||
ResourceLabels: iacTypes.MapTest(map[string]string{
|
||||
"env": "staging",
|
||||
}, iacTypes.NewTestMetadata()),
|
||||
RemoveDefaultNodePool: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
EnableAutpilot: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
}),
|
||||
RemoveDefaultNodePool: iacTypes.BoolTest(true),
|
||||
EnableAutpilot: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -211,45 +199,27 @@ resource "google_container_cluster" "example" {
|
||||
Clusters: []gke.Cluster{
|
||||
{
|
||||
NodeConfig: gke.NodeConfig{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
ImageType: iacTypes.String("COS", iacTypes.NewTestMetadata()),
|
||||
ImageType: iacTypes.StringTest("COS"),
|
||||
WorkloadMetadataConfig: gke.WorkloadMetadataConfig{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
NodeMetadata: iacTypes.String("GCE_METADATA", iacTypes.NewTestMetadata()),
|
||||
NodeMetadata: iacTypes.StringTest("GCE_METADATA"),
|
||||
},
|
||||
ServiceAccount: iacTypes.String("service-account", iacTypes.NewTestMetadata()),
|
||||
EnableLegacyEndpoints: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
ServiceAccount: iacTypes.StringTest("service-account"),
|
||||
},
|
||||
|
||||
IPAllocationPolicy: gke.IPAllocationPolicy{
|
||||
Enabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
IPAllocationPolicy: gke.IPAllocationPolicy{},
|
||||
MasterAuthorizedNetworks: gke.MasterAuthorizedNetworks{
|
||||
Enabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
CIDRs: []iacTypes.StringValue{},
|
||||
CIDRs: []iacTypes.StringValue{},
|
||||
},
|
||||
NetworkPolicy: gke.NetworkPolicy{
|
||||
Enabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
DatapathProvider: iacTypes.StringDefault("DATAPATH_PROVIDER_UNSPECIFIED", iacTypes.NewTestMetadata()),
|
||||
PrivateCluster: gke.PrivateCluster{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
EnablePrivateNodes: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
LoggingService: iacTypes.String("logging.googleapis.com/kubernetes", iacTypes.NewTestMetadata()),
|
||||
MonitoringService: iacTypes.String("monitoring.googleapis.com/kubernetes", iacTypes.NewTestMetadata()),
|
||||
NetworkPolicy: gke.NetworkPolicy{},
|
||||
DatapathProvider: iacTypes.StringTest("DATAPATH_PROVIDER_UNSPECIFIED"),
|
||||
PrivateCluster: gke.PrivateCluster{},
|
||||
LoggingService: iacTypes.StringTest("logging.googleapis.com/kubernetes"),
|
||||
MonitoringService: iacTypes.StringTest("monitoring.googleapis.com/kubernetes"),
|
||||
MasterAuth: gke.MasterAuth{
|
||||
ClientCertificate: gke.ClientCertificate{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IssueCertificate: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Username: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Password: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
ClientCertificate: gke.ClientCertificate{},
|
||||
},
|
||||
EnableShieldedNodes: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
EnableLegacyABAC: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
ResourceLabels: iacTypes.Map(make(map[string]string), iacTypes.NewTestMetadata()),
|
||||
RemoveDefaultNodePool: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
EnableShieldedNodes: iacTypes.BoolTest(true),
|
||||
ResourceLabels: iacTypes.MapTest(make(map[string]string)),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -75,62 +75,50 @@ resource "google_iam_workload_identity_pool_provider" "example" {
|
||||
expected: iam.IAM{
|
||||
Projects: []iam.Project{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
AutoCreateNetwork: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
AutoCreateNetwork: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
Folders: []iam.Folder{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Members: []iam.Member{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Member: iacTypes.String("user:alice@gmail.com", iacTypes.NewTestMetadata()),
|
||||
Role: iacTypes.String("roles/editor", iacTypes.NewTestMetadata()),
|
||||
DefaultServiceAccount: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Member: iacTypes.StringTest("user:alice@gmail.com"),
|
||||
Role: iacTypes.StringTest("roles/editor"),
|
||||
},
|
||||
},
|
||||
Bindings: []iam.Binding{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Members: []iacTypes.StringValue{
|
||||
iacTypes.String("user:not-alice@gmail.com", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("user:not-alice@gmail.com"),
|
||||
},
|
||||
Role: iacTypes.String("roles/nothing", iacTypes.NewTestMetadata()),
|
||||
IncludesDefaultServiceAccount: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Role: iacTypes.StringTest("roles/nothing"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Organizations: []iam.Organization{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Members: []iam.Member{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Member: iacTypes.String("user:member@gmail.com", iacTypes.NewTestMetadata()),
|
||||
Role: iacTypes.String("roles/whatever", iacTypes.NewTestMetadata()),
|
||||
DefaultServiceAccount: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Member: iacTypes.StringTest("user:member@gmail.com"),
|
||||
Role: iacTypes.StringTest("roles/whatever"),
|
||||
},
|
||||
},
|
||||
Bindings: []iam.Binding{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Members: []iacTypes.StringValue{
|
||||
iacTypes.String("user:member_2@gmail.com", iacTypes.NewTestMetadata())},
|
||||
Role: iacTypes.String("roles/browser", iacTypes.NewTestMetadata()),
|
||||
IncludesDefaultServiceAccount: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("user:member_2@gmail.com")},
|
||||
Role: iacTypes.StringTest("roles/browser"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
WorkloadIdentityPoolProviders: []iam.WorkloadIdentityPoolProvider{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
|
||||
WorkloadIdentityPoolId: iacTypes.String("example-pool", iacTypes.NewTestMetadata()),
|
||||
WorkloadIdentityPoolProviderId: iacTypes.String("example-provider", iacTypes.NewTestMetadata()),
|
||||
AttributeCondition: iacTypes.String("assertion.repository_owner=='your-github-organization'", iacTypes.NewTestMetadata()),
|
||||
WorkloadIdentityPoolId: iacTypes.StringTest("example-pool"),
|
||||
WorkloadIdentityPoolProviderId: iacTypes.StringTest("example-provider"),
|
||||
AttributeCondition: iacTypes.StringTest("assertion.repository_owner=='your-github-organization'"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -198,11 +186,9 @@ data "google_iam_policy" "project_admin" {
|
||||
expected: iam.IAM{
|
||||
Folders: []iam.Folder{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Bindings: []iam.Binding{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Role: iacTypes.StringTest("roles/editor"),
|
||||
Role: iacTypes.StringTest("roles/editor"),
|
||||
Members: []iacTypes.StringValue{
|
||||
iacTypes.StringTest("user:jane@example.com"),
|
||||
},
|
||||
@@ -212,11 +198,9 @@ data "google_iam_policy" "project_admin" {
|
||||
},
|
||||
Organizations: []iam.Organization{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Bindings: []iam.Binding{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Role: iacTypes.StringTest("roles/editor"),
|
||||
Role: iacTypes.StringTest("roles/editor"),
|
||||
Members: []iacTypes.StringValue{
|
||||
iacTypes.StringTest("user:jane2@example.com"),
|
||||
},
|
||||
@@ -227,11 +211,9 @@ data "google_iam_policy" "project_admin" {
|
||||
Projects: []iam.Project{
|
||||
{
|
||||
AutoCreateNetwork: iacTypes.BoolTest(true),
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Bindings: []iam.Binding{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Role: iacTypes.StringTest("roles/editor"),
|
||||
Role: iacTypes.StringTest("roles/editor"),
|
||||
Members: []iacTypes.StringValue{
|
||||
iacTypes.StringTest("user:jane3@example.com"),
|
||||
},
|
||||
@@ -260,13 +242,11 @@ resource "google_project_iam_member" "project" {
|
||||
expected: iam.IAM{
|
||||
Projects: []iam.Project{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
AutoCreateNetwork: iacTypes.BoolTest(true),
|
||||
Members: []iam.Member{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Role: iacTypes.StringTest("roles/editor"),
|
||||
Member: iacTypes.StringTest("user:jane@example.com"),
|
||||
Role: iacTypes.StringTest("roles/editor"),
|
||||
Member: iacTypes.StringTest("user:jane@example.com"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -285,13 +265,10 @@ resource "google_project_iam_member" "project" {
|
||||
expected: iam.IAM{
|
||||
Projects: []iam.Project{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
AutoCreateNetwork: iacTypes.BoolTest(false),
|
||||
Members: []iam.Member{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Role: iacTypes.StringTest("roles/editor"),
|
||||
Member: iacTypes.StringTest("user:jane@example.com"),
|
||||
Role: iacTypes.StringTest("roles/editor"),
|
||||
Member: iacTypes.StringTest("user:jane@example.com"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -356,24 +333,18 @@ resource "google_folder_iam_audit_config" "folder_audit" {
|
||||
expected: iam.IAM{
|
||||
Projects: []iam.Project{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
AutoCreateNetwork: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
AuditConfigs: []iam.AuditConfig{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Service: iacTypes.String("allServices", iacTypes.NewTestMetadata()),
|
||||
Service: iacTypes.StringTest("allServices"),
|
||||
AuditLogConfigs: []iam.AuditLogConfig{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
LogType: iacTypes.String("ADMIN_READ", iacTypes.NewTestMetadata()),
|
||||
ExemptedMembers: nil,
|
||||
LogType: iacTypes.StringTest("ADMIN_READ"),
|
||||
},
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
LogType: iacTypes.String("DATA_WRITE", iacTypes.NewTestMetadata()),
|
||||
LogType: iacTypes.StringTest("DATA_WRITE"),
|
||||
ExemptedMembers: []iacTypes.StringValue{
|
||||
iacTypes.String("user:alice@example.com", iacTypes.NewTestMetadata()),
|
||||
iacTypes.String("serviceAccount:test@project.iam.gserviceaccount.com", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("user:alice@example.com"),
|
||||
iacTypes.StringTest("serviceAccount:test@project.iam.gserviceaccount.com"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -383,17 +354,14 @@ resource "google_folder_iam_audit_config" "folder_audit" {
|
||||
},
|
||||
Organizations: []iam.Organization{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
AuditConfigs: []iam.AuditConfig{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Service: iacTypes.String("storage.googleapis.com", iacTypes.NewTestMetadata()),
|
||||
Service: iacTypes.StringTest("storage.googleapis.com"),
|
||||
AuditLogConfigs: []iam.AuditLogConfig{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
LogType: iacTypes.String("DATA_READ", iacTypes.NewTestMetadata()),
|
||||
LogType: iacTypes.StringTest("DATA_READ"),
|
||||
ExemptedMembers: []iacTypes.StringValue{
|
||||
iacTypes.String("user:bob@example.com", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("user:bob@example.com"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -403,16 +371,12 @@ resource "google_folder_iam_audit_config" "folder_audit" {
|
||||
},
|
||||
Folders: []iam.Folder{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
AuditConfigs: []iam.AuditConfig{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Service: iacTypes.String("compute.googleapis.com", iacTypes.NewTestMetadata()),
|
||||
Service: iacTypes.StringTest("compute.googleapis.com"),
|
||||
AuditLogConfigs: []iam.AuditLogConfig{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
LogType: iacTypes.String("ADMIN_READ", iacTypes.NewTestMetadata()),
|
||||
ExemptedMembers: nil,
|
||||
LogType: iacTypes.StringTest("ADMIN_READ"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -33,11 +33,9 @@ func Test_adaptKeyRings(t *testing.T) {
|
||||
`,
|
||||
expected: []kms.KeyRing{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Keys: []kms.Key{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
RotationPeriodSeconds: iacTypes.Int(7776000, iacTypes.NewTestMetadata()),
|
||||
RotationPeriodSeconds: iacTypes.IntTest(7776000),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -52,9 +50,7 @@ func Test_adaptKeyRings(t *testing.T) {
|
||||
|
||||
`,
|
||||
expected: []kms.KeyRing{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
},
|
||||
{},
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -71,11 +67,9 @@ func Test_adaptKeyRings(t *testing.T) {
|
||||
`,
|
||||
expected: []kms.KeyRing{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Keys: []kms.Key{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
RotationPeriodSeconds: iacTypes.Int(-1, iacTypes.NewTestMetadata()),
|
||||
RotationPeriodSeconds: iacTypes.IntTest(-1),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -42,40 +42,27 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: sql.SQL{
|
||||
Instances: []sql.DatabaseInstance{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
IsReplica: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
DatabaseVersion: iacTypes.String("POSTGRES_12", iacTypes.NewTestMetadata()),
|
||||
DatabaseVersion: iacTypes.StringTest("POSTGRES_12"),
|
||||
Settings: sql.Settings{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Backups: sql.Backups{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
Flags: sql.Flags{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
LogMinDurationStatement: iacTypes.Int(-1, iacTypes.NewTestMetadata()),
|
||||
ContainedDatabaseAuthentication: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
CrossDBOwnershipChaining: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
LocalInFile: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
LogCheckpoints: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
LogConnections: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
LogDisconnections: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
LogLockWaits: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
LogMinMessages: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
LogTempFileSize: iacTypes.Int(-1, iacTypes.NewTestMetadata()),
|
||||
LogMinDurationStatement: iacTypes.IntTest(-1),
|
||||
ContainedDatabaseAuthentication: iacTypes.BoolTest(true),
|
||||
CrossDBOwnershipChaining: iacTypes.BoolTest(true),
|
||||
LogTempFileSize: iacTypes.IntTest(-1),
|
||||
},
|
||||
IPConfiguration: sql.IPConfiguration{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
RequireTLS: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
EnableIPv4: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
RequireTLS: iacTypes.BoolTest(true),
|
||||
SSLMode: iacTypes.StringTest("TRUSTED_CLIENT_CERTIFICATE_REQUIRED"),
|
||||
AuthorizedNetworks: []struct {
|
||||
Name iacTypes.StringValue
|
||||
CIDR iacTypes.StringValue
|
||||
}{
|
||||
{
|
||||
Name: iacTypes.String("internal", iacTypes.NewTestMetadata()),
|
||||
CIDR: iacTypes.String("108.12.12.0/24", iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("internal"),
|
||||
CIDR: iacTypes.StringTest("108.12.12.0/24"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -174,28 +161,22 @@ resource "google_sql_database_instance" "backup_source_instance" {
|
||||
`,
|
||||
expected: []sql.DatabaseInstance{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
DatabaseVersion: iacTypes.String("POSTGRES_11", iacTypes.NewTestMetadata()),
|
||||
IsReplica: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
DatabaseVersion: iacTypes.StringTest("POSTGRES_11"),
|
||||
Settings: sql.Settings{
|
||||
Backups: sql.Backups{
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
Flags: sql.Flags{
|
||||
LogConnections: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
LogTempFileSize: iacTypes.Int(0, iacTypes.NewTestMetadata()),
|
||||
LogCheckpoints: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
LogDisconnections: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
LogLockWaits: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
ContainedDatabaseAuthentication: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
CrossDBOwnershipChaining: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
LocalInFile: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
LogMinDurationStatement: iacTypes.Int(-1, iacTypes.NewTestMetadata()),
|
||||
LogMinMessages: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
LogConnections: iacTypes.BoolTest(true),
|
||||
LogCheckpoints: iacTypes.BoolTest(true),
|
||||
LogDisconnections: iacTypes.BoolTest(true),
|
||||
LogLockWaits: iacTypes.BoolTest(true),
|
||||
ContainedDatabaseAuthentication: iacTypes.BoolTest(true),
|
||||
CrossDBOwnershipChaining: iacTypes.BoolTest(true),
|
||||
LogMinDurationStatement: iacTypes.IntTest(-1),
|
||||
},
|
||||
IPConfiguration: sql.IPConfiguration{
|
||||
EnableIPv4: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
RequireTLS: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
RequireTLS: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -48,41 +48,28 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: storage.Storage{
|
||||
Buckets: []storage.Bucket{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("image-store.com", iacTypes.NewTestMetadata()),
|
||||
Location: iacTypes.String("EU", iacTypes.NewTestMetadata()),
|
||||
EnableUniformBucketLevelAccess: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Name: iacTypes.StringTest("image-store.com"),
|
||||
Location: iacTypes.StringTest("EU"),
|
||||
EnableUniformBucketLevelAccess: iacTypes.BoolTest(true),
|
||||
Bindings: []iam.Binding{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Members: []iacTypes.StringValue{
|
||||
iacTypes.String("group:test@example.com", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("group:test@example.com"),
|
||||
},
|
||||
Role: iacTypes.String("roles/storage.admin #1", iacTypes.NewTestMetadata()),
|
||||
IncludesDefaultServiceAccount: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Role: iacTypes.StringTest("roles/storage.admin #1"),
|
||||
},
|
||||
},
|
||||
Members: []iam.Member{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Member: iacTypes.String("serviceAccount:test@example.com", iacTypes.NewTestMetadata()),
|
||||
Role: iacTypes.String("roles/storage.admin #2", iacTypes.NewTestMetadata()),
|
||||
DefaultServiceAccount: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Member: iacTypes.StringTest("serviceAccount:test@example.com"),
|
||||
Role: iacTypes.StringTest("roles/storage.admin #2"),
|
||||
},
|
||||
},
|
||||
Encryption: storage.BucketEncryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
DefaultKMSKeyName: iacTypes.String("default-kms-key-name", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Logging: storage.BucketLogging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
LogBucket: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
LogObjectPrefix: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Versioning: storage.BucketVersioning{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
DefaultKMSKeyName: iacTypes.StringTest("default-kms-key-name"),
|
||||
},
|
||||
Logging: storage.BucketLogging{},
|
||||
Versioning: storage.BucketVersioning{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -103,38 +90,15 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: storage.Storage{
|
||||
Buckets: []storage.Bucket{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Location: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
EnableUniformBucketLevelAccess: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Bindings: []iam.Binding{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Role: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
IncludesDefaultServiceAccount: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
{},
|
||||
},
|
||||
Members: []iam.Member{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Member: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Role: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
DefaultServiceAccount: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
},
|
||||
},
|
||||
Encryption: storage.BucketEncryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
DefaultKMSKeyName: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Logging: storage.BucketLogging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
LogBucket: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
LogObjectPrefix: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Versioning: storage.BucketVersioning{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
{},
|
||||
},
|
||||
Encryption: storage.BucketEncryption{},
|
||||
Logging: storage.BucketLogging{},
|
||||
Versioning: storage.BucketVersioning{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -157,24 +121,14 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: storage.Storage{
|
||||
Buckets: []storage.Bucket{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("example-bucket", iacTypes.NewTestMetadata()),
|
||||
Location: iacTypes.String("US", iacTypes.NewTestMetadata()),
|
||||
EnableUniformBucketLevelAccess: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Members: nil,
|
||||
Bindings: nil,
|
||||
Encryption: storage.BucketEncryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
DefaultKMSKeyName: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Name: iacTypes.StringTest("example-bucket"),
|
||||
Location: iacTypes.StringTest("US"),
|
||||
Encryption: storage.BucketEncryption{},
|
||||
Logging: storage.BucketLogging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
LogBucket: iacTypes.String("access-logs-bucket", iacTypes.NewTestMetadata()),
|
||||
LogObjectPrefix: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
LogBucket: iacTypes.StringTest("access-logs-bucket"),
|
||||
},
|
||||
Versioning: storage.BucketVersioning{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -195,25 +149,14 @@ func Test_Adapt(t *testing.T) {
|
||||
expected: storage.Storage{
|
||||
Buckets: []storage.Bucket{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Name: iacTypes.String("example-bucket", iacTypes.NewTestMetadata()),
|
||||
Location: iacTypes.String("US", iacTypes.NewTestMetadata()),
|
||||
EnableUniformBucketLevelAccess: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
Members: nil,
|
||||
Bindings: nil,
|
||||
Encryption: storage.BucketEncryption{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
DefaultKMSKeyName: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Name: iacTypes.StringTest("example-bucket"),
|
||||
Location: iacTypes.StringTest("US"),
|
||||
Encryption: storage.BucketEncryption{},
|
||||
Logging: storage.BucketLogging{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
LogBucket: iacTypes.String("access-logs-bucket", iacTypes.NewTestMetadata()),
|
||||
LogObjectPrefix: iacTypes.String("access-logs/", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
Versioning: storage.BucketVersioning{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
LogBucket: iacTypes.StringTest("access-logs-bucket"),
|
||||
LogObjectPrefix: iacTypes.StringTest("access-logs/"),
|
||||
},
|
||||
Versioning: storage.BucketVersioning{},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -26,12 +26,10 @@ func Test_adaptInstances(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: []computing.Instance{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
SecurityGroup: iacTypes.String("example-security-group", iacTypes.NewTestMetadata()),
|
||||
SecurityGroup: iacTypes.StringTest("example-security-group"),
|
||||
NetworkInterfaces: []computing.NetworkInterface{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
NetworkID: iacTypes.String("net-COMMON_PRIVATE", iacTypes.NewTestMetadata()),
|
||||
NetworkID: iacTypes.StringTest("net-COMMON_PRIVATE"),
|
||||
},
|
||||
},
|
||||
}},
|
||||
@@ -46,13 +44,8 @@ func Test_adaptInstances(t *testing.T) {
|
||||
`,
|
||||
|
||||
expected: []computing.Instance{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
SecurityGroup: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
NetworkInterfaces: []computing.NetworkInterface{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
NetworkID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
{},
|
||||
},
|
||||
}},
|
||||
},
|
||||
|
||||
@@ -34,13 +34,11 @@ func Test_adaptSecurityGroups(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: []computing.SecurityGroup{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Description: iacTypes.String("memo", iacTypes.NewTestMetadata()),
|
||||
Description: iacTypes.StringTest("memo"),
|
||||
IngressRules: []computing.SecurityGroupRule{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
CIDR: iacTypes.String("1.2.3.4/32", iacTypes.NewTestMetadata()),
|
||||
Description: iacTypes.String("memo", iacTypes.NewTestMetadata()),
|
||||
CIDR: iacTypes.StringTest("1.2.3.4/32"),
|
||||
Description: iacTypes.StringTest("memo"),
|
||||
},
|
||||
},
|
||||
}},
|
||||
@@ -59,14 +57,8 @@ func Test_adaptSecurityGroups(t *testing.T) {
|
||||
`,
|
||||
|
||||
expected: []computing.SecurityGroup{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Description: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
IngressRules: []computing.SecurityGroupRule{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
CIDR: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Description: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
{},
|
||||
},
|
||||
}},
|
||||
},
|
||||
|
||||
@@ -24,9 +24,8 @@ func Test_adaptRecords(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: []dns.Record{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Type: iacTypes.String("A", iacTypes.NewTestMetadata()),
|
||||
Record: iacTypes.String("example-record", iacTypes.NewTestMetadata()),
|
||||
Type: iacTypes.StringTest("A"),
|
||||
Record: iacTypes.StringTest("example-record"),
|
||||
}},
|
||||
},
|
||||
{
|
||||
@@ -36,11 +35,7 @@ func Test_adaptRecords(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
|
||||
expected: []dns.Record{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Type: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Record: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
}},
|
||||
expected: []dns.Record{{}},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,7 @@ func Test_adaptNASInstances(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: []nas.NASInstance{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
NetworkID: iacTypes.String("example-network", iacTypes.NewTestMetadata()),
|
||||
NetworkID: iacTypes.StringTest("example-network"),
|
||||
}},
|
||||
},
|
||||
{
|
||||
@@ -35,8 +34,7 @@ func Test_adaptNASInstances(t *testing.T) {
|
||||
`,
|
||||
|
||||
expected: []nas.NASInstance{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
NetworkID: iacTypes.String("net-COMMON_PRIVATE", iacTypes.NewTestMetadata()),
|
||||
NetworkID: iacTypes.StringTest("net-COMMON_PRIVATE"),
|
||||
}},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -27,10 +27,9 @@ func Test_adaptNASSecurityGroups(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: []nas.NASSecurityGroup{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Description: iacTypes.String("memo", iacTypes.NewTestMetadata()),
|
||||
Description: iacTypes.StringTest("memo"),
|
||||
CIDRs: []iacTypes.StringValue{
|
||||
iacTypes.String("0.0.0.0/0", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("0.0.0.0/0"),
|
||||
},
|
||||
}},
|
||||
},
|
||||
@@ -44,10 +43,8 @@ func Test_adaptNASSecurityGroups(t *testing.T) {
|
||||
`,
|
||||
|
||||
expected: []nas.NASSecurityGroup{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Description: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
CIDRs: []iacTypes.StringValue{
|
||||
iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest(""),
|
||||
},
|
||||
}},
|
||||
},
|
||||
|
||||
@@ -33,22 +33,17 @@ func Test_adaptElasticLoadBalancers(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: []network.ElasticLoadBalancer{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
NetworkInterfaces: []network.NetworkInterface{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
NetworkID: iacTypes.String("net-COMMON_PRIVATE", iacTypes.NewTestMetadata()),
|
||||
IsVipNetwork: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
NetworkID: iacTypes.StringTest("net-COMMON_PRIVATE"),
|
||||
},
|
||||
},
|
||||
Listeners: []network.ElasticLoadBalancerListener{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Protocol: iacTypes.String("HTTP", iacTypes.NewTestMetadata()),
|
||||
Protocol: iacTypes.StringTest("HTTP"),
|
||||
},
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Protocol: iacTypes.String("HTTPS", iacTypes.NewTestMetadata()),
|
||||
Protocol: iacTypes.StringTest("HTTPS"),
|
||||
},
|
||||
},
|
||||
}},
|
||||
@@ -63,17 +58,12 @@ func Test_adaptElasticLoadBalancers(t *testing.T) {
|
||||
`,
|
||||
|
||||
expected: []network.ElasticLoadBalancer{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
NetworkInterfaces: []network.NetworkInterface{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
NetworkID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
IsVipNetwork: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
IsVipNetwork: iacTypes.BoolTest(true),
|
||||
},
|
||||
},
|
||||
Listeners: []network.ElasticLoadBalancerListener{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
}},
|
||||
Listeners: []network.ElasticLoadBalancerListener{{}},
|
||||
}},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -32,17 +32,14 @@ func Test_adaptLoadBalancers(t *testing.T) {
|
||||
|
||||
`,
|
||||
expected: []network.LoadBalancer{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Listeners: []network.LoadBalancerListener{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
TLSPolicy: iacTypes.String("example-ssl-policy-id", iacTypes.NewTestMetadata()),
|
||||
Protocol: iacTypes.String("HTTP", iacTypes.NewTestMetadata()),
|
||||
TLSPolicy: iacTypes.StringTest("example-ssl-policy-id"),
|
||||
Protocol: iacTypes.StringTest("HTTP"),
|
||||
},
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
TLSPolicy: iacTypes.String("example-ssl-policy-name", iacTypes.NewTestMetadata()),
|
||||
Protocol: iacTypes.String("HTTPS", iacTypes.NewTestMetadata()),
|
||||
TLSPolicy: iacTypes.StringTest("example-ssl-policy-name"),
|
||||
Protocol: iacTypes.StringTest("HTTPS"),
|
||||
},
|
||||
},
|
||||
}},
|
||||
@@ -55,10 +52,7 @@ func Test_adaptLoadBalancers(t *testing.T) {
|
||||
`,
|
||||
|
||||
expected: []network.LoadBalancer{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Listeners: []network.LoadBalancerListener{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
}},
|
||||
Listeners: []network.LoadBalancerListener{{}},
|
||||
}},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -26,12 +26,10 @@ func Test_adaptRouters(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: []network.Router{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
SecurityGroup: iacTypes.String("example-security-group", iacTypes.NewTestMetadata()),
|
||||
SecurityGroup: iacTypes.StringTest("example-security-group"),
|
||||
NetworkInterfaces: []network.NetworkInterface{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
NetworkID: iacTypes.String("net-COMMON_PRIVATE", iacTypes.NewTestMetadata()),
|
||||
NetworkID: iacTypes.StringTest("net-COMMON_PRIVATE"),
|
||||
},
|
||||
},
|
||||
}},
|
||||
@@ -46,13 +44,8 @@ func Test_adaptRouters(t *testing.T) {
|
||||
`,
|
||||
|
||||
expected: []network.Router{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
SecurityGroup: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
NetworkInterfaces: []network.NetworkInterface{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
NetworkID: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
{},
|
||||
},
|
||||
}},
|
||||
},
|
||||
|
||||
@@ -23,8 +23,7 @@ func Test_adaptVpnGateways(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: []network.VpnGateway{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
SecurityGroup: iacTypes.String("example-security-group", iacTypes.NewTestMetadata()),
|
||||
SecurityGroup: iacTypes.StringTest("example-security-group"),
|
||||
}},
|
||||
},
|
||||
{
|
||||
@@ -34,10 +33,7 @@ func Test_adaptVpnGateways(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
|
||||
expected: []network.VpnGateway{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
SecurityGroup: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
}},
|
||||
expected: []network.VpnGateway{{}},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -27,12 +27,10 @@ func Test_adaptDBInstances(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: []rdb.DBInstance{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
BackupRetentionPeriodDays: iacTypes.Int(2, iacTypes.NewTestMetadata()),
|
||||
Engine: iacTypes.String("MySQL", iacTypes.NewTestMetadata()),
|
||||
EngineVersion: iacTypes.String("5.7.15", iacTypes.NewTestMetadata()),
|
||||
NetworkID: iacTypes.String("example-network", iacTypes.NewTestMetadata()),
|
||||
PublicAccess: iacTypes.Bool(false, iacTypes.NewTestMetadata()),
|
||||
BackupRetentionPeriodDays: iacTypes.IntTest(2),
|
||||
Engine: iacTypes.StringTest("MySQL"),
|
||||
EngineVersion: iacTypes.StringTest("5.7.15"),
|
||||
NetworkID: iacTypes.StringTest("example-network"),
|
||||
}},
|
||||
},
|
||||
{
|
||||
@@ -43,12 +41,8 @@ func Test_adaptDBInstances(t *testing.T) {
|
||||
`,
|
||||
|
||||
expected: []rdb.DBInstance{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
BackupRetentionPeriodDays: iacTypes.Int(0, iacTypes.NewTestMetadata()),
|
||||
Engine: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
EngineVersion: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
NetworkID: iacTypes.String("net-COMMON_PRIVATE", iacTypes.NewTestMetadata()),
|
||||
PublicAccess: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
NetworkID: iacTypes.StringTest("net-COMMON_PRIVATE"),
|
||||
PublicAccess: iacTypes.BoolTest(true),
|
||||
}},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -27,10 +27,9 @@ func Test_adaptDBSecurityGroups(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: []rdb.DBSecurityGroup{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Description: iacTypes.String("memo", iacTypes.NewTestMetadata()),
|
||||
Description: iacTypes.StringTest("memo"),
|
||||
CIDRs: []iacTypes.StringValue{
|
||||
iacTypes.String("0.0.0.0/0", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest("0.0.0.0/0"),
|
||||
},
|
||||
}},
|
||||
},
|
||||
@@ -44,10 +43,8 @@ func Test_adaptDBSecurityGroups(t *testing.T) {
|
||||
`,
|
||||
|
||||
expected: []rdb.DBSecurityGroup{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Description: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
CIDRs: []iacTypes.StringValue{
|
||||
iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
iacTypes.StringTest(""),
|
||||
},
|
||||
}},
|
||||
},
|
||||
|
||||
@@ -39,11 +39,10 @@ func Test_adaptServerCertificates(t *testing.T) {
|
||||
}
|
||||
`,
|
||||
expected: []sslcertificate.ServerCertificate{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Expiration: iacTypes.Time(func(timeVal string) time.Time {
|
||||
Expiration: iacTypes.TimeTest(func(timeVal string) time.Time {
|
||||
parsed, _ := time.Parse(time.RFC3339, timeVal)
|
||||
return parsed
|
||||
}("2015-09-12T21:52:02Z"), iacTypes.NewTestMetadata()),
|
||||
}("2015-09-12T21:52:02Z")),
|
||||
}},
|
||||
},
|
||||
{
|
||||
@@ -54,8 +53,7 @@ func Test_adaptServerCertificates(t *testing.T) {
|
||||
`,
|
||||
|
||||
expected: []sslcertificate.ServerCertificate{{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Expiration: iacTypes.Time(time.Time{}, iacTypes.NewTestMetadata()),
|
||||
Expiration: iacTypes.TimeTest(time.Time{}),
|
||||
}},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -29,8 +29,7 @@ func TestFields(t *testing.T) {
|
||||
Compute: openstack.Compute{
|
||||
Instances: []openstack.Instance{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
AdminPassword: iacTypes.String("N0tSoS3cretP4ssw0rd", iacTypes.NewTestMetadata()),
|
||||
AdminPassword: iacTypes.StringTest("N0tSoS3cretP4ssw0rd"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -44,10 +43,7 @@ func TestFields(t *testing.T) {
|
||||
expected: openstack.OpenStack{
|
||||
Compute: openstack.Compute{
|
||||
Instances: []openstack.Instance{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
AdminPassword: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
},
|
||||
{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -68,12 +64,10 @@ func TestFields(t *testing.T) {
|
||||
Firewall: openstack.Firewall{
|
||||
AllowRules: []openstack.FirewallRule{
|
||||
{
|
||||
Metadata: iacTypes.NewTestMetadata(),
|
||||
Enabled: iacTypes.Bool(true, iacTypes.NewTestMetadata()),
|
||||
Destination: iacTypes.String("10.10.10.1", iacTypes.NewTestMetadata()),
|
||||
Source: iacTypes.String("10.10.10.2", iacTypes.NewTestMetadata()),
|
||||
DestinationPort: iacTypes.String("22", iacTypes.NewTestMetadata()),
|
||||
SourcePort: iacTypes.String("", iacTypes.NewTestMetadata()),
|
||||
Enabled: iacTypes.BoolTest(true),
|
||||
Destination: iacTypes.StringTest("10.10.10.1"),
|
||||
Source: iacTypes.StringTest("10.10.10.2"),
|
||||
DestinationPort: iacTypes.StringTest("22"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -26,8 +26,8 @@ func Test_SliceConversion(t *testing.T) {
|
||||
|
||||
func Test_SliceTypesConversion(t *testing.T) {
|
||||
input := []types.StringValue{
|
||||
types.String("test1", types.NewTestMetadata()),
|
||||
types.String("test2", types.NewTestMetadata()),
|
||||
types.StringTest("test1"),
|
||||
types.StringTest("test2"),
|
||||
}
|
||||
converted := SliceToRego(reflect.ValueOf(input))
|
||||
assert.Equal(t, []any{
|
||||
|
||||
@@ -87,6 +87,12 @@ func BytesUnresolvable(m Metadata) BytesValue {
|
||||
return b
|
||||
}
|
||||
|
||||
func BytesTest(value []byte) BytesValue {
|
||||
b := Bytes(value, NewTestMetadata())
|
||||
b.BaseAttribute.metadata.isUnresolvable = true
|
||||
return b
|
||||
}
|
||||
|
||||
func (b BytesValue) ToRego() any {
|
||||
m := b.metadata.ToRego().(map[string]any)
|
||||
m["value"] = string(b.Value())
|
||||
|
||||
@@ -65,6 +65,12 @@ func MapExplicit(value map[string]string, m Metadata) MapValue {
|
||||
return b
|
||||
}
|
||||
|
||||
func MapTest(value map[string]string) MapValue {
|
||||
b := Map(value, NewTestMetadata())
|
||||
b.BaseAttribute.metadata.isUnresolvable = true
|
||||
return b
|
||||
}
|
||||
|
||||
func (b MapValue) Value() map[string]string {
|
||||
return b.value
|
||||
}
|
||||
|
||||
@@ -66,6 +66,10 @@ func TimeUnresolvable(m Metadata) TimeValue {
|
||||
return b
|
||||
}
|
||||
|
||||
func TimeTest(value time.Time) TimeValue {
|
||||
return Time(value, NewTestMetadata())
|
||||
}
|
||||
|
||||
func (t TimeValue) Value() time.Time {
|
||||
return t.value
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user