diff --git a/GNUmakefile b/GNUmakefile index fa14c06fa14..8c752c6c1af 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -104,6 +104,7 @@ lint: -V002 \ -V003 \ -V004 \ + -V005 \ -V006 \ -V007 \ -V008 \ diff --git a/aws/data_source_aws_lambda_invocation.go b/aws/data_source_aws_lambda_invocation.go index d896c109dbc..86600702960 100644 --- a/aws/data_source_aws_lambda_invocation.go +++ b/aws/data_source_aws_lambda_invocation.go @@ -34,7 +34,7 @@ func dataSourceAwsLambdaInvocation() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, }, "result": { diff --git a/aws/resource_aws_api_gateway_rest_api.go b/aws/resource_aws_api_gateway_rest_api.go index 2f65535b7f6..6872939d762 100644 --- a/aws/resource_aws_api_gateway_rest_api.go +++ b/aws/resource_aws_api_gateway_rest_api.go @@ -49,7 +49,7 @@ func resourceAwsApiGatewayRestApi() *schema.Resource { "policy": { Type: schema.TypeString, Optional: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs, }, diff --git a/aws/resource_aws_cloudformation_stack.go b/aws/resource_aws_cloudformation_stack.go index 68280373216..af964b67951 100644 --- a/aws/resource_aws_cloudformation_stack.go +++ b/aws/resource_aws_cloudformation_stack.go @@ -88,7 +88,7 @@ func resourceAwsCloudFormationStack() *schema.Resource { Type: schema.TypeString, Optional: true, Computed: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, StateFunc: func(v interface{}) string { json, _ := structure.NormalizeJsonString(v) return json diff --git a/aws/resource_aws_cloudwatch_dashboard.go b/aws/resource_aws_cloudwatch_dashboard.go index a7ff5aac312..04d742bed41 100644 --- a/aws/resource_aws_cloudwatch_dashboard.go +++ b/aws/resource_aws_cloudwatch_dashboard.go @@ -34,7 +34,7 @@ func resourceAwsCloudWatchDashboard() *schema.Resource { "dashboard_body": { Type: schema.TypeString, Required: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, StateFunc: func(v interface{}) string { json, _ := structure.NormalizeJsonString(v) return json diff --git a/aws/resource_aws_config_config_rule.go b/aws/resource_aws_config_config_rule.go index 2c552a85f32..aba4c393550 100644 --- a/aws/resource_aws_config_config_rule.go +++ b/aws/resource_aws_config_config_rule.go @@ -49,7 +49,7 @@ func resourceAwsConfigConfigRule() *schema.Resource { "input_parameters": { Type: schema.TypeString, Optional: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, }, "maximum_execution_frequency": { Type: schema.TypeString, diff --git a/aws/resource_aws_config_organization_custom_rule.go b/aws/resource_aws_config_organization_custom_rule.go index c4ddc2fd56e..04f3941bee5 100644 --- a/aws/resource_aws_config_organization_custom_rule.go +++ b/aws/resource_aws_config_organization_custom_rule.go @@ -53,7 +53,7 @@ func resourceAwsConfigOrganizationCustomRule() *schema.Resource { DiffSuppressFunc: suppressEquivalentJsonDiffs, ValidateFunc: validation.All( validation.StringLenBetween(0, 2048), - validation.ValidateJsonString, + validation.StringIsJSON, ), }, "lambda_function_arn": { diff --git a/aws/resource_aws_config_organization_managed_rule.go b/aws/resource_aws_config_organization_managed_rule.go index b37f6d7999d..0868caedf79 100644 --- a/aws/resource_aws_config_organization_managed_rule.go +++ b/aws/resource_aws_config_organization_managed_rule.go @@ -53,7 +53,7 @@ func resourceAwsConfigOrganizationManagedRule() *schema.Resource { DiffSuppressFunc: suppressEquivalentJsonDiffs, ValidateFunc: validation.All( validation.StringLenBetween(0, 2048), - validation.ValidateJsonString, + validation.StringIsJSON, ), }, "maximum_execution_frequency": { diff --git a/aws/resource_aws_dms_replication_task.go b/aws/resource_aws_dms_replication_task.go index b8ee831df9c..4884795b95f 100644 --- a/aws/resource_aws_dms_replication_task.go +++ b/aws/resource_aws_dms_replication_task.go @@ -60,7 +60,7 @@ func resourceAwsDmsReplicationTask() *schema.Resource { "replication_task_settings": { Type: schema.TypeString, Optional: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: suppressEquivalentJsonDiffs, }, "source_endpoint_arn": { @@ -72,7 +72,7 @@ func resourceAwsDmsReplicationTask() *schema.Resource { "table_mappings": { Type: schema.TypeString, Required: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: suppressEquivalentJsonDiffs, }, "tags": tagsSchema(), diff --git a/aws/resource_aws_ecr_lifecycle_policy.go b/aws/resource_aws_ecr_lifecycle_policy.go index 3ff36581c5c..643a5e15593 100644 --- a/aws/resource_aws_ecr_lifecycle_policy.go +++ b/aws/resource_aws_ecr_lifecycle_policy.go @@ -27,7 +27,7 @@ func resourceAwsEcrLifecyclePolicy() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: suppressEquivalentJsonDiffs, }, "registry_id": { diff --git a/aws/resource_aws_elasticsearch_domain.go b/aws/resource_aws_elasticsearch_domain.go index 169e6275dfd..30a1df464bd 100644 --- a/aws/resource_aws_elasticsearch_domain.go +++ b/aws/resource_aws_elasticsearch_domain.go @@ -58,7 +58,7 @@ func resourceAwsElasticSearchDomain() *schema.Resource { Type: schema.TypeString, Optional: true, Computed: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs, }, "advanced_options": { diff --git a/aws/resource_aws_emr_cluster.go b/aws/resource_aws_emr_cluster.go index 3e4d689f79d..0655a9c8ab1 100644 --- a/aws/resource_aws_emr_cluster.go +++ b/aws/resource_aws_emr_cluster.go @@ -111,7 +111,7 @@ func resourceAwsEMRCluster() *schema.Resource { Type: schema.TypeString, Optional: true, ForceNew: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: suppressEquivalentJsonDiffs, StateFunc: func(v interface{}) string { json, _ := structure.NormalizeJsonString(v) @@ -276,7 +276,7 @@ func resourceAwsEMRCluster() *schema.Resource { Type: schema.TypeString, Optional: true, DiffSuppressFunc: suppressEquivalentJsonDiffs, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, }, "bid_price": { Type: schema.TypeString, @@ -460,7 +460,7 @@ func resourceAwsEMRCluster() *schema.Resource { Type: schema.TypeString, Optional: true, DiffSuppressFunc: suppressEquivalentJsonDiffs, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, StateFunc: func(v interface{}) string { jsonString, _ := structure.NormalizeJsonString(v) return jsonString @@ -585,7 +585,7 @@ func resourceAwsEMRCluster() *schema.Resource { Optional: true, ForceNew: true, ConflictsWith: []string{"configurations"}, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: suppressEquivalentJsonDiffs, StateFunc: func(v interface{}) string { json, _ := structure.NormalizeJsonString(v) diff --git a/aws/resource_aws_emr_instance_group.go b/aws/resource_aws_emr_instance_group.go index 172c3fc2b4c..2e9a4c57dbd 100644 --- a/aws/resource_aws_emr_instance_group.go +++ b/aws/resource_aws_emr_instance_group.go @@ -44,7 +44,7 @@ func resourceAwsEMRInstanceGroup() *schema.Resource { Type: schema.TypeString, Optional: true, DiffSuppressFunc: suppressEquivalentJsonDiffs, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, }, "bid_price": { Type: schema.TypeString, @@ -60,7 +60,7 @@ func resourceAwsEMRInstanceGroup() *schema.Resource { Type: schema.TypeString, Optional: true, ForceNew: false, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: suppressEquivalentJsonDiffs, StateFunc: func(v interface{}) string { json, _ := structure.NormalizeJsonString(v) diff --git a/aws/resource_aws_emr_security_configuration.go b/aws/resource_aws_emr_security_configuration.go index a30d6f0247d..1783adbbadf 100644 --- a/aws/resource_aws_emr_security_configuration.go +++ b/aws/resource_aws_emr_security_configuration.go @@ -41,7 +41,7 @@ func resourceAwsEMRSecurityConfiguration() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, }, "creation_date": { diff --git a/aws/resource_aws_glacier_vault.go b/aws/resource_aws_glacier_vault.go index 840e22df449..a31827d15b0 100644 --- a/aws/resource_aws_glacier_vault.go +++ b/aws/resource_aws_glacier_vault.go @@ -58,7 +58,7 @@ func resourceAwsGlacierVault() *schema.Resource { "access_policy": { Type: schema.TypeString, Optional: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, StateFunc: func(v interface{}) string { json, _ := structure.NormalizeJsonString(v) return json diff --git a/aws/resource_aws_glue_crawler.go b/aws/resource_aws_glue_crawler.go index 8d7e16adc25..b7df0863b30 100644 --- a/aws/resource_aws_glue_crawler.go +++ b/aws/resource_aws_glue_crawler.go @@ -186,7 +186,7 @@ func resourceAwsGlueCrawler() *schema.Resource { json, _ := structure.NormalizeJsonString(v) return json }, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, }, "security_configuration": { Type: schema.TypeString, diff --git a/aws/resource_aws_iam_role.go b/aws/resource_aws_iam_role.go index 60f03f8dc02..8a4d72e33cf 100644 --- a/aws/resource_aws_iam_role.go +++ b/aws/resource_aws_iam_role.go @@ -101,7 +101,7 @@ func resourceAwsIamRole() *schema.Resource { Type: schema.TypeString, Required: true, DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, }, "force_detach_policies": { diff --git a/aws/resource_aws_kms_external_key.go b/aws/resource_aws_kms_external_key.go index 981bfffd4b1..a636ee26407 100644 --- a/aws/resource_aws_kms_external_key.go +++ b/aws/resource_aws_kms_external_key.go @@ -76,7 +76,7 @@ func resourceAwsKmsExternalKey() *schema.Resource { DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs, ValidateFunc: validation.All( validation.StringLenBetween(0, 32768), - validation.ValidateJsonString, + validation.StringIsJSON, ), }, "tags": tagsSchema(), diff --git a/aws/resource_aws_kms_key.go b/aws/resource_aws_kms_key.go index 13f1d664000..6345c67e5cc 100644 --- a/aws/resource_aws_kms_key.go +++ b/aws/resource_aws_kms_key.go @@ -71,7 +71,7 @@ func resourceAwsKmsKey() *schema.Resource { Type: schema.TypeString, Optional: true, Computed: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs, }, "is_enabled": { diff --git a/aws/resource_aws_organizations_policy.go b/aws/resource_aws_organizations_policy.go index 739a7448a7a..0bd1bb7415a 100644 --- a/aws/resource_aws_organizations_policy.go +++ b/aws/resource_aws_organizations_policy.go @@ -31,7 +31,7 @@ func resourceAwsOrganizationsPolicy() *schema.Resource { Type: schema.TypeString, Required: true, DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, }, "description": { Type: schema.TypeString, diff --git a/aws/resource_aws_s3_bucket.go b/aws/resource_aws_s3_bucket.go index 40f1ed8254d..18e3cbdb9f3 100644 --- a/aws/resource_aws_s3_bucket.go +++ b/aws/resource_aws_s3_bucket.go @@ -121,7 +121,7 @@ func resourceAwsS3Bucket() *schema.Resource { "policy": { Type: schema.TypeString, Optional: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs, }, @@ -187,7 +187,7 @@ func resourceAwsS3Bucket() *schema.Resource { "routing_rules": { Type: schema.TypeString, Optional: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, StateFunc: func(v interface{}) string { json, _ := structure.NormalizeJsonString(v) return json diff --git a/aws/resource_aws_s3_bucket_policy.go b/aws/resource_aws_s3_bucket_policy.go index bc651406f3d..89e7bd9dfe4 100644 --- a/aws/resource_aws_s3_bucket_policy.go +++ b/aws/resource_aws_s3_bucket_policy.go @@ -33,7 +33,7 @@ func resourceAwsS3BucketPolicy() *schema.Resource { "policy": { Type: schema.TypeString, Required: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs, }, }, diff --git a/aws/resource_aws_secretsmanager_secret.go b/aws/resource_aws_secretsmanager_secret.go index 7395059f16e..345f3c8360a 100644 --- a/aws/resource_aws_secretsmanager_secret.go +++ b/aws/resource_aws_secretsmanager_secret.go @@ -56,7 +56,7 @@ func resourceAwsSecretsManagerSecret() *schema.Resource { "policy": { Type: schema.TypeString, Optional: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs, }, "recovery_window_in_days": { diff --git a/aws/resource_aws_ses_identity_policy.go b/aws/resource_aws_ses_identity_policy.go index fc16d8a56d7..68262c941c0 100644 --- a/aws/resource_aws_ses_identity_policy.go +++ b/aws/resource_aws_ses_identity_policy.go @@ -40,7 +40,7 @@ func resourceAwsSesIdentityPolicy() *schema.Resource { "policy": { Type: schema.TypeString, Required: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs, }, }, diff --git a/aws/resource_aws_sns_topic.go b/aws/resource_aws_sns_topic.go index 271aafad90b..6bcd4641000 100644 --- a/aws/resource_aws_sns_topic.go +++ b/aws/resource_aws_sns_topic.go @@ -67,7 +67,7 @@ func resourceAwsSnsTopic() *schema.Resource { Type: schema.TypeString, Optional: true, Computed: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs, StateFunc: func(v interface{}) string { json, _ := structure.NormalizeJsonString(v) @@ -78,7 +78,7 @@ func resourceAwsSnsTopic() *schema.Resource { Type: schema.TypeString, Optional: true, ForceNew: false, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: suppressEquivalentJsonDiffs, StateFunc: func(v interface{}) string { json, _ := structure.NormalizeJsonString(v) diff --git a/aws/resource_aws_sns_topic_policy.go b/aws/resource_aws_sns_topic_policy.go index 9d8d915b222..200a45ce7ed 100644 --- a/aws/resource_aws_sns_topic_policy.go +++ b/aws/resource_aws_sns_topic_policy.go @@ -33,7 +33,7 @@ func resourceAwsSnsTopicPolicy() *schema.Resource { "policy": { Type: schema.TypeString, Required: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs, }, }, diff --git a/aws/resource_aws_sns_topic_subscription.go b/aws/resource_aws_sns_topic_subscription.go index 9c422dddb5a..2f665448675 100644 --- a/aws/resource_aws_sns_topic_subscription.go +++ b/aws/resource_aws_sns_topic_subscription.go @@ -71,7 +71,7 @@ func resourceAwsSnsTopicSubscription() *schema.Resource { "delivery_policy": { Type: schema.TypeString, Optional: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: suppressEquivalentSnsTopicSubscriptionDeliveryPolicy, }, "raw_message_delivery": { @@ -86,7 +86,7 @@ func resourceAwsSnsTopicSubscription() *schema.Resource { "filter_policy": { Type: schema.TypeString, Optional: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: suppressEquivalentJsonDiffs, StateFunc: func(v interface{}) string { json, _ := structure.NormalizeJsonString(v) diff --git a/aws/resource_aws_sqs_queue.go b/aws/resource_aws_sqs_queue.go index 6d55747ec19..18cd860fdb1 100644 --- a/aws/resource_aws_sqs_queue.go +++ b/aws/resource_aws_sqs_queue.go @@ -91,13 +91,13 @@ func resourceAwsSqsQueue() *schema.Resource { Type: schema.TypeString, Optional: true, Computed: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs, }, "redrive_policy": { Type: schema.TypeString, Optional: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, StateFunc: func(v interface{}) string { json, _ := structure.NormalizeJsonString(v) return json diff --git a/aws/resource_aws_sqs_queue_policy.go b/aws/resource_aws_sqs_queue_policy.go index 20fd51da67a..3c7e3c56f4e 100644 --- a/aws/resource_aws_sqs_queue_policy.go +++ b/aws/resource_aws_sqs_queue_policy.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" - "github.com/jen20/awspolicyequivalence" + awspolicy "github.com/jen20/awspolicyequivalence" ) func resourceAwsSqsQueuePolicy() *schema.Resource { @@ -35,7 +35,7 @@ func resourceAwsSqsQueuePolicy() *schema.Resource { "policy": { Type: schema.TypeString, Required: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs, }, }, diff --git a/aws/resource_aws_vpc_endpoint.go b/aws/resource_aws_vpc_endpoint.go index c9623b13be4..8a26cf59b27 100644 --- a/aws/resource_aws_vpc_endpoint.go +++ b/aws/resource_aws_vpc_endpoint.go @@ -65,7 +65,7 @@ func resourceAwsVpcEndpoint() *schema.Resource { Type: schema.TypeString, Optional: true, Computed: true, - ValidateFunc: validation.ValidateJsonString, + ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs, StateFunc: func(v interface{}) string { json, _ := structure.NormalizeJsonString(v)