Skip to content

Commit

Permalink
provider: Replace deprecated helper/validation.ValidateJsonString fun…
Browse files Browse the repository at this point in the history
…ction

Reference: #11844
Reference: #12087

Output from acceptance testing:

```
Pending in TeamCity
```
  • Loading branch information
bflad committed Mar 13, 2020
1 parent b1193a5 commit 47fc541
Show file tree
Hide file tree
Showing 30 changed files with 40 additions and 39 deletions.
1 change: 1 addition & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ lint:
-V002 \
-V003 \
-V004 \
-V005 \
-V006 \
-V007 \
-V008 \
Expand Down
2 changes: 1 addition & 1 deletion aws/data_source_aws_lambda_invocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func dataSourceAwsLambdaInvocation() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.ValidateJsonString,
ValidateFunc: validation.StringIsJSON,
},

"result": {
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_api_gateway_rest_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func resourceAwsApiGatewayRestApi() *schema.Resource {
"policy": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.ValidateJsonString,
ValidateFunc: validation.StringIsJSON,
DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs,
},

Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_cloudformation_stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_cloudwatch_dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_config_config_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_config_organization_custom_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func resourceAwsConfigOrganizationCustomRule() *schema.Resource {
DiffSuppressFunc: suppressEquivalentJsonDiffs,
ValidateFunc: validation.All(
validation.StringLenBetween(0, 2048),
validation.ValidateJsonString,
validation.StringIsJSON,
),
},
"lambda_function_arn": {
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_config_organization_managed_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func resourceAwsConfigOrganizationManagedRule() *schema.Resource {
DiffSuppressFunc: suppressEquivalentJsonDiffs,
ValidateFunc: validation.All(
validation.StringLenBetween(0, 2048),
validation.ValidateJsonString,
validation.StringIsJSON,
),
},
"maximum_execution_frequency": {
Expand Down
4 changes: 2 additions & 2 deletions aws/resource_aws_dms_replication_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_ecr_lifecycle_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_elasticsearch_domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
8 changes: 4 additions & 4 deletions aws/resource_aws_emr_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions aws/resource_aws_emr_instance_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_emr_security_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func resourceAwsEMRSecurityConfiguration() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.ValidateJsonString,
ValidateFunc: validation.StringIsJSON,
},

"creation_date": {
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_glacier_vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_glue_crawler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_iam_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func resourceAwsIamRole() *schema.Resource {
Type: schema.TypeString,
Required: true,
DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs,
ValidateFunc: validation.ValidateJsonString,
ValidateFunc: validation.StringIsJSON,
},

"force_detach_policies": {
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_kms_external_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func resourceAwsKmsExternalKey() *schema.Resource {
DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs,
ValidateFunc: validation.All(
validation.StringLenBetween(0, 32768),
validation.ValidateJsonString,
validation.StringIsJSON,
),
},
"tags": tagsSchema(),
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_kms_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_organizations_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions aws/resource_aws_s3_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func resourceAwsS3Bucket() *schema.Resource {
"policy": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.ValidateJsonString,
ValidateFunc: validation.StringIsJSON,
DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs,
},

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_s3_bucket_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func resourceAwsS3BucketPolicy() *schema.Resource {
"policy": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.ValidateJsonString,
ValidateFunc: validation.StringIsJSON,
DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs,
},
},
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_secretsmanager_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_ses_identity_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func resourceAwsSesIdentityPolicy() *schema.Resource {
"policy": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.ValidateJsonString,
ValidateFunc: validation.StringIsJSON,
DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs,
},
},
Expand Down
4 changes: 2 additions & 2 deletions aws/resource_aws_sns_topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_sns_topic_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func resourceAwsSnsTopicPolicy() *schema.Resource {
"policy": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.ValidateJsonString,
ValidateFunc: validation.StringIsJSON,
DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs,
},
},
Expand Down
4 changes: 2 additions & 2 deletions aws/resource_aws_sns_topic_subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions aws/resource_aws_sqs_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions aws/resource_aws_sqs_queue_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -35,7 +35,7 @@ func resourceAwsSqsQueuePolicy() *schema.Resource {
"policy": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.ValidateJsonString,
ValidateFunc: validation.StringIsJSON,
DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs,
},
},
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_vpc_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 47fc541

Please sign in to comment.