Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and enable tfproviderlint S024 check: ForceNew is extraneous in data source schema attributes #12778

Merged
merged 3 commits into from
Apr 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ lint:
-S019 \
-S020 \
-S021 \
-S024 \
-S025 \
-S026 \
-S027 \
Expand Down
3 changes: 0 additions & 3 deletions aws/data_source_aws_ami.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,17 @@ func dataSourceAwsAmi() *schema.Resource {
"executable_users": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"name_regex": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringIsValidRegExp,
},
"most_recent": {
Type: schema.TypeBool,
Optional: true,
Default: false,
ForceNew: true,
},
"owners": {
Type: schema.TypeList,
Expand Down
2 changes: 0 additions & 2 deletions aws/data_source_aws_ami_ids.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@ func dataSourceAwsAmiIds() *schema.Resource {
"executable_users": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"name_regex": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringIsValidRegExp,
},
"owners": {
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_autoscaling_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ func dataSourceAwsAutoscalingGroup() *schema.Resource {
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"arn": {
Type: schema.TypeString,
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_batch_compute_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ func dataSourceAwsBatchComputeEnvironment() *schema.Resource {
"compute_environment_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},

"arn": {
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_batch_job_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ func dataSourceAwsBatchJobQueue() *schema.Resource {
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},

"arn": {
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_codecommit_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ func dataSourceAwsCodeCommitRepository() *schema.Resource {
"repository_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringLenBetween(0, 100),
},

Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_common_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ func dataSourceFiltersSchema() *schema.Schema {
return &schema.Schema{
Type: schema.TypeSet,
Optional: true,
ForceNew: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_db_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ func dataSourceAwsDbInstance() *schema.Resource {
"db_instance_identifier": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},

"tags": tagsSchemaComputed(),
Expand Down
6 changes: 0 additions & 6 deletions aws/data_source_aws_db_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,33 @@ func dataSourceAwsDbSnapshot() *schema.Resource {
"db_instance_identifier": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},

"db_snapshot_identifier": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},

"snapshot_type": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},

"include_shared": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
Default: false,
},

"include_public": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
Default: false,
},
"most_recent": {
Type: schema.TypeBool,
Optional: true,
Default: false,
ForceNew: true,
},

//Computed values returned
Expand Down
4 changes: 0 additions & 4 deletions aws/data_source_aws_ebs_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,20 @@ func dataSourceAwsEbsSnapshot() *schema.Resource {
Type: schema.TypeBool,
Optional: true,
Default: false,
ForceNew: true,
},
"owners": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"snapshot_ids": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"restorable_by_user_ids": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
//Computed values returned
Expand Down
2 changes: 0 additions & 2 deletions aws/data_source_aws_ebs_snapshot_ids.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ func dataSourceAwsEbsSnapshotIds() *schema.Resource {
"owners": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"restorable_by_user_ids": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"ids": {
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_ebs_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ func dataSourceAwsEbsVolume() *schema.Resource {
Type: schema.TypeBool,
Optional: true,
Default: false,
ForceNew: true,
},
"arn": {
Type: schema.TypeString,
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_ecr_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ func dataSourceAwsEcrRepository() *schema.Resource {
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"arn": {
Type: schema.TypeString,
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_ecs_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ func dataSourceAwsEcsCluster() *schema.Resource {
"cluster_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},

"arn": {
Expand Down
2 changes: 0 additions & 2 deletions aws/data_source_aws_ecs_container_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ func dataSourceAwsEcsContainerDefinition() *schema.Resource {
"task_definition": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"container_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
// Computed values.
"image": {
Expand Down
2 changes: 0 additions & 2 deletions aws/data_source_aws_ecs_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ func dataSourceAwsEcsService() *schema.Resource {
"service_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"arn": {
Type: schema.TypeString,
Expand All @@ -26,7 +25,6 @@ func dataSourceAwsEcsService() *schema.Resource {
"cluster_arn": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"desired_count": {
Type: schema.TypeInt,
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_ecs_task_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ func dataSourceAwsEcsTaskDefinition() *schema.Resource {
"task_definition": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
// Computed values.
"family": {
Expand Down
2 changes: 0 additions & 2 deletions aws/data_source_aws_efs_file_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ func dataSourceAwsEfsFileSystem() *schema.Resource {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ValidateFunc: validation.StringLenBetween(0, 64),
},
"encrypted": {
Expand All @@ -36,7 +35,6 @@ func dataSourceAwsEfsFileSystem() *schema.Resource {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"kms_key_id": {
Type: schema.TypeString,
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_efs_mount_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ func dataSourceAwsEfsMountTarget() *schema.Resource {
"mount_target_id": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"file_system_arn": {
Type: schema.TypeString,
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_eks_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ func dataSourceAwsEksCluster() *schema.Resource {
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.NoZeroValues,
},
"platform_version": {
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_elastic_beanstalk_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ func dataSourceAwsElasticBeanstalkApplication() *schema.Resource {
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"description": {
Type: schema.TypeString,
Expand Down
2 changes: 0 additions & 2 deletions aws/data_source_aws_elastic_beanstalk_solution_stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ func dataSourceAwsElasticBeanstalkSolutionStack() *schema.Resource {
"name_regex": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringIsValidRegExp,
},
"most_recent": {
Type: schema.TypeBool,
Optional: true,
Default: false,
ForceNew: true,
},
// Computed values.
"name": {
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_elasticache_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ func dataSourceAwsElastiCacheCluster() *schema.Resource {
"cluster_id": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
StateFunc: func(v interface{}) string {
value := v.(string)
return strings.ToLower(value)
Expand Down
4 changes: 0 additions & 4 deletions aws/data_source_aws_iam_server_certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,25 @@ func dataSourceAwsIAMServerCertificate() *schema.Resource {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ConflictsWith: []string{"name_prefix"},
ValidateFunc: validation.StringLenBetween(0, 128),
},

"name_prefix": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ConflictsWith: []string{"name"},
ValidateFunc: validation.StringLenBetween(0, 128-resource.UniqueIDSuffixLength),
},

"path_prefix": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},

"latest": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
Default: false,
},

Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ func dataSourceAwsInstance() *schema.Resource {
"instance_id": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"ami": {
Type: schema.TypeString,
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_kms_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ func dataSourceAwsKmsSecret() *schema.Resource {
"secret": {
Type: schema.TypeSet,
Required: true,
ForceNew: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_kms_secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ func dataSourceAwsKmsSecrets() *schema.Resource {
"secret": {
Type: schema.TypeSet,
Required: true,
ForceNew: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Expand Down
3 changes: 0 additions & 3 deletions aws/data_source_aws_lambda_invocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,17 @@ func dataSourceAwsLambdaInvocation() *schema.Resource {
"function_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},

"qualifier": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Default: "$LATEST",
},

"input": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.ValidateJsonString,
},

Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_secretsmanager_secret_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ func dataSourceAwsSecretsManagerSecretVersion() *schema.Resource {
"secret_id": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"secret_string": {
Type: schema.TypeString,
Expand Down