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 S031 check: Computed only schema should not configure MaxItems #11869

Closed
bflad opened this issue Feb 3, 2020 · 2 comments · Fixed by #12234
Closed
Labels
good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. linter Pertains to changes to or issues with the various linters. technical-debt Addresses areas of the codebase that need refactoring or redesign.
Milestone

Comments

@bflad
Copy link
Contributor

bflad commented Feb 3, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

The MaxItems should be removed from these schema attributes. See also: https://github.com/bflad/tfproviderlint/blob/master/passes/S031/README.md

e.g.

/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_cloudhsm2_cluster.go:38:28: S031: schema should not only enable Computed and configure MaxItems
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_dynamodb_table.go:149:11: S031: schema should not only enable Computed and configure MaxItems
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_dynamodb_table.go:192:30: S031: schema should not only enable Computed and configure MaxItems
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_efs_file_system.go:62:24: S031: schema should not only enable Computed and configure MaxItems
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_eks_cluster.go:23:29: S031: schema should not only enable Computed and configure MaxItems
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_eks_cluster.go:89:18: S031: schema should not only enable Computed and configure MaxItems
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_elastic_beanstalk_application.go:29:28: S031: schema should not only enable Computed and configure MaxItems
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_elb.go:27:19: S031: schema should not only enable Computed and configure MaxItems
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_elb.go:80:20: S031: schema should not only enable Computed and configure MaxItems
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_lambda_function.go:31:26: S031: schema should not only enable Computed and configure MaxItems
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_lambda_function.go:49:14: S031: schema should not only enable Computed and configure MaxItems
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_lambda_function.go:81:18: S031: schema should not only enable Computed and configure MaxItems
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_lambda_function.go:130:19: S031: schema should not only enable Computed and configure MaxItems
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_lambda_function.go:144:22: S031: schema should not only enable Computed and configure MaxItems
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_lambda_layer_version.go:34:27: S031: schema should not only enable Computed and configure MaxItems
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_lb.go:74:19: S031: schema should not only enable Computed and configure MaxItems
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_lb_target_group.go:73:18: S031: schema should not only enable Computed and configure MaxItems
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_lb_target_group.go:95:20: S031: schema should not only enable Computed and configure MaxItems
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_mq_broker.go:37:21: S031: schema should not only enable Computed and configure MaxItems
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_mq_broker.go:131:37: S031: schema should not only enable Computed and configure MaxItems
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_api_gateway_account.go:29:25: S031: schema should not only enable Computed and configure MaxItems
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_cloudhsm2_cluster.go:64:28: S031: schema should not only enable Computed and configure MaxItems
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_eks_cluster.go:47:29: S031: schema should not only enable Computed and configure MaxItems

Definition of Done

  • Fix S031 reports
  • In GNUmakefile, add -S031 to tfproviderlint command under lint target and have TravisCI testing pass
@bflad bflad added good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. technical-debt Addresses areas of the codebase that need refactoring or redesign. labels Feb 3, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Feb 3, 2020
@bflad bflad removed the needs-triage Waiting for first response or review from a maintainer. label Feb 3, 2020
bflad added a commit that referenced this issue Feb 3, 2020
Gaps in `tfproviderlint` checking are covered by the following issues:

Reference: #9950 (fix and enable AT003)
Reference: #11862 (fix and enable AT005)
Reference: #9951 (fix and enable R001)
Reference: #9952 (fix and enable R002)
Reference: #9953 (fix and enable R003)
Reference: #9954 (fix and enable R004)
Reference: #11863 (fix and enable R005)
Reference: #11864 (fix and enable R006)
Reference: #9955 (fix and enable S006)
Reference: #9956 (fix and enable S018)
Reference: #11865 (fix and enable S020)
Reference: #11866 (fix and enable S022)
Reference: #11867 (fix and enable S023)
Reference: #11868 (fix and enable S024)
Reference: #11869 (fix and enable S031)
Reference: #11870 (fix and enable S032)
Reference: #11871 (fix and enable S033)
Reference: #11872 (fix and enable V001)
Reference: #11844 (fix and enable V002, V004, V005, V007, V008)
bflad added a commit that referenced this issue Feb 4, 2020
Gaps in `tfproviderlint` checking are covered by the following issues:

Reference: #9950 (fix and enable AT003)
Reference: #11862 (fix and enable AT005)
Reference: #9951 (fix and enable R001)
Reference: #9952 (fix and enable R002)
Reference: #9953 (fix and enable R003)
Reference: #9954 (fix and enable R004)
Reference: #11863 (fix and enable R005)
Reference: #11864 (fix and enable R006)
Reference: #9955 (fix and enable S006)
Reference: #9956 (fix and enable S018)
Reference: #11865 (fix and enable S020)
Reference: #11866 (fix and enable S022)
Reference: #11867 (fix and enable S023)
Reference: #11868 (fix and enable S024)
Reference: #11869 (fix and enable S031)
Reference: #11870 (fix and enable S032)
Reference: #11871 (fix and enable S033)
Reference: #11872 (fix and enable V001)
Reference: #11844 (fix and enable V002, V004, V005, V007, V008)
bflad added a commit that referenced this issue Feb 19, 2020
Reference: #12074

Gaps in `tfproviderlint`/`awsproviderlint` checking are covered by the following issues:

Reference: #11888 (fix and enable AWSAT001)
Reference: #9950 (fix and enable AT003)
Reference: #11862 (fix and enable AT005)
Reference: #9951 (fix and enable R001)
Reference: #9952 (fix and enable R002)
Reference: #9953 (fix and enable R003)
Reference: #11863 (fix and enable R005)
Reference: #11864 (fix and enable R006)
Reference: #12083 (fix and enable R007, R008)
Reference: #9955 (fix and enable S006)
Reference: #9956 (fix and enable S018)
Reference: #11865 (fix and enable S020)
Reference: #11866 (fix and enable S022)
Reference: #11867 (fix and enable S023)
Reference: #11868 (fix and enable S024)
Reference: #11869 (fix and enable S031)
Reference: #11870 (fix and enable S032)
Reference: #11871 (fix and enable S033)
Reference: #11872 (fix and enable V001)
Reference: #11844 (fix and enable V002, V004, V005, V007, V008)
bflad added a commit that referenced this issue Mar 3, 2020
Reference: #12087
Reference: #11869 (fix and enable S031)
Reference: #11870 (fix and enable S032)
Reference: #11871 (fix and enable S033)

Previously:

```
aws/data_source_aws_cloudhsm2_cluster.go:38:28: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_dynamodb_table.go:149:11: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_dynamodb_table.go:192:30: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_efs_file_system.go:62:24: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_eks_cluster.go:23:29: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_eks_cluster.go:89:18: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_elastic_beanstalk_application.go:29:28: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_elb.go:27:19: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_elb.go:80:20: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lambda_function.go:130:19: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lambda_function.go:144:22: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lambda_function.go:31:26: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lambda_function.go:49:14: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lambda_function.go:81:18: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lambda_layer_version.go:34:27: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lb.go:74:19: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lb_target_group.go:73:18: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lb_target_group.go:95:20: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_mq_broker.go:131:37: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_mq_broker.go:37:21: S031: schema should not only enable Computed and configure MaxItems
aws/resource_aws_api_gateway_account.go:29:25: S031: schema should not only enable Computed and configure MaxItems
aws/resource_aws_cloudhsm2_cluster.go:64:28: S031: schema should not only enable Computed and configure MaxItems
aws/resource_aws_eks_cluster.go:47:29: S031: schema should not only enable Computed and configure MaxItems

aws/data_source_aws_lambda_function.go:31:26: S032: schema should not only enable Computed and configure MinItems

aws/data_source_aws_cloudformation_stack.go:22:21: S033: schema should not only enable Computed and configure StateFunc
aws/data_source_aws_dynamodb_table.go:140:24: S033: schema should not only enable Computed and configure StateFunc
aws/data_source_aws_rds_cluster.go:120:36: S033: schema should not only enable Computed and configure StateFunc
```

Output from acceptance testing:

```
--- PASS: TestAccAWSAPIGatewayAccount_basic (116.01s)

--- PASS: TestAccAWSCloudFormationStack_dataSource_basic (74.98s)
--- PASS: TestAccAWSCloudFormationStack_dataSource_yaml (74.96s)

--- PASS: TestAccAWSCloudHsm2Cluster_basic (292.57s)
--- PASS: TestAccAWSCloudHsm2Cluster_Tags (340.49s)

--- PASS: TestAccAWSEksCluster_basic (1204.53s)
--- PASS: TestAccAWSEksCluster_Logging (1300.14s)
--- PASS: TestAccAWSEksCluster_Tags (1280.00s)
--- PASS: TestAccAWSEksCluster_Version (2452.84s)
--- PASS: TestAccAWSEksCluster_VpcConfig_EndpointPrivateAccess (2435.44s)
--- PASS: TestAccAWSEksCluster_VpcConfig_EndpointPublicAccess (1720.71s)
--- PASS: TestAccAWSEksCluster_VpcConfig_PublicAccessCidrs (1587.49s)
--- PASS: TestAccAWSEksCluster_VpcConfig_SecurityGroupIds (1186.78s)
--- PASS: TestAccAWSEksClusterDataSource_basic (1239.69s)

--- PASS: TestAccAwsElasticBeanstalkApplicationDataSource_basic (21.56s)

--- PASS: TestAccDataSourceAWSALBTargetGroup_basic (175.08s)

--- PASS: TestAccDataSourceAwsDynamoDbTable_basic (44.81s)

--- PASS: TestAccDataSourceAwsEfsFileSystem_id (29.06s)
--- PASS: TestAccDataSourceAwsEfsFileSystem_name (28.39s)

--- PASS: TestAccDataSourceAWSELB_basic (53.87s)

--- PASS: TestAccDataSourceAWSLambdaFunction_alias (65.51s)
--- PASS: TestAccDataSourceAWSLambdaFunction_basic (49.09s)
--- PASS: TestAccDataSourceAWSLambdaFunction_environment (59.75s)
--- PASS: TestAccDataSourceAWSLambdaFunction_layers (71.91s)
--- PASS: TestAccDataSourceAWSLambdaFunction_version (41.88s)
--- PASS: TestAccDataSourceAWSLambdaFunction_vpc (1838.06s)
--- PASS: TestAccDataSourceAWSLambdaLayerVersion_basic (19.83s)
--- PASS: TestAccDataSourceAWSLambdaLayerVersion_runtime (46.22s)
--- PASS: TestAccDataSourceAWSLambdaLayerVersion_version (35.61s)

--- PASS: TestAccDataSourceAWSLB_basic (211.76s)

--- PASS: TestAccDataSourceAWSMqBroker_basic (1232.73s)

--- PASS: TestAccDataSourceAWSRDSCluster_basic (135.85s)

--- PASS: TestAccDataSourceCloudHsm2Cluster_basic (267.05s)
```
bflad added a commit that referenced this issue Mar 10, 2020
Reference: #12074

Gaps in `tfproviderlint`/`awsproviderlint` checking are covered by the following issues:

Reference: #11888 (fix and enable AWSAT001)
Reference: #9950 (fix and enable AT003)
Reference: #11862 (fix and enable AT005)
Reference: #9951 (fix and enable R001)
Reference: #9952 (fix and enable R002)
Reference: #9953 (fix and enable R003)
Reference: #11863 (fix and enable R005)
Reference: #11864 (fix and enable R006)
Reference: #12083 (fix and enable R007, R008)
Reference: #9955 (fix and enable S006)
Reference: #9956 (fix and enable S018)
Reference: #11865 (fix and enable S020)
Reference: #11866 (fix and enable S022)
Reference: #11867 (fix and enable S023)
Reference: #11868 (fix and enable S024)
Reference: #11869 (fix and enable S031)
Reference: #11870 (fix and enable S032)
Reference: #11871 (fix and enable S033)
Reference: #11872 (fix and enable V001)
Reference: #11844 (fix and enable V002, V004, V005, V007, V008)
@bflad bflad added this to the v2.53.0 milestone Mar 10, 2020
bflad added a commit that referenced this issue Mar 10, 2020
Reference: #12087
Reference: #11869 (fix and enable S031)
Reference: #11870 (fix and enable S032)
Reference: #11871 (fix and enable S033)

Previously:

```
aws/data_source_aws_cloudhsm2_cluster.go:38:28: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_dynamodb_table.go:149:11: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_dynamodb_table.go:192:30: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_efs_file_system.go:62:24: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_eks_cluster.go:23:29: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_eks_cluster.go:89:18: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_elastic_beanstalk_application.go:29:28: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_elb.go:27:19: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_elb.go:80:20: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lambda_function.go:130:19: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lambda_function.go:144:22: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lambda_function.go:31:26: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lambda_function.go:49:14: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lambda_function.go:81:18: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lambda_layer_version.go:34:27: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lb.go:74:19: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lb_target_group.go:73:18: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lb_target_group.go:95:20: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_mq_broker.go:131:37: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_mq_broker.go:37:21: S031: schema should not only enable Computed and configure MaxItems
aws/resource_aws_api_gateway_account.go:29:25: S031: schema should not only enable Computed and configure MaxItems
aws/resource_aws_cloudhsm2_cluster.go:64:28: S031: schema should not only enable Computed and configure MaxItems
aws/resource_aws_eks_cluster.go:47:29: S031: schema should not only enable Computed and configure MaxItems

aws/data_source_aws_lambda_function.go:31:26: S032: schema should not only enable Computed and configure MinItems

aws/data_source_aws_cloudformation_stack.go:22:21: S033: schema should not only enable Computed and configure StateFunc
aws/data_source_aws_dynamodb_table.go:140:24: S033: schema should not only enable Computed and configure StateFunc
aws/data_source_aws_rds_cluster.go:120:36: S033: schema should not only enable Computed and configure StateFunc
```

Output from acceptance testing:

```
--- PASS: TestAccAWSAPIGatewayAccount_basic (116.01s)

--- PASS: TestAccAWSCloudFormationStack_dataSource_basic (74.98s)
--- PASS: TestAccAWSCloudFormationStack_dataSource_yaml (74.96s)

--- PASS: TestAccAWSCloudHsm2Cluster_basic (292.57s)
--- PASS: TestAccAWSCloudHsm2Cluster_Tags (340.49s)

--- PASS: TestAccAWSEksCluster_basic (1204.53s)
--- PASS: TestAccAWSEksCluster_Logging (1300.14s)
--- PASS: TestAccAWSEksCluster_Tags (1280.00s)
--- PASS: TestAccAWSEksCluster_Version (2452.84s)
--- PASS: TestAccAWSEksCluster_VpcConfig_EndpointPrivateAccess (2435.44s)
--- PASS: TestAccAWSEksCluster_VpcConfig_EndpointPublicAccess (1720.71s)
--- PASS: TestAccAWSEksCluster_VpcConfig_PublicAccessCidrs (1587.49s)
--- PASS: TestAccAWSEksCluster_VpcConfig_SecurityGroupIds (1186.78s)
--- PASS: TestAccAWSEksClusterDataSource_basic (1239.69s)

--- PASS: TestAccAwsElasticBeanstalkApplicationDataSource_basic (21.56s)

--- PASS: TestAccDataSourceAWSALBTargetGroup_basic (175.08s)

--- PASS: TestAccDataSourceAwsDynamoDbTable_basic (44.81s)

--- PASS: TestAccDataSourceAwsEfsFileSystem_id (29.06s)
--- PASS: TestAccDataSourceAwsEfsFileSystem_name (28.39s)

--- PASS: TestAccDataSourceAWSELB_basic (53.87s)

--- PASS: TestAccDataSourceAWSLambdaFunction_alias (65.51s)
--- PASS: TestAccDataSourceAWSLambdaFunction_basic (49.09s)
--- PASS: TestAccDataSourceAWSLambdaFunction_environment (59.75s)
--- PASS: TestAccDataSourceAWSLambdaFunction_layers (71.91s)
--- PASS: TestAccDataSourceAWSLambdaFunction_version (41.88s)
--- PASS: TestAccDataSourceAWSLambdaFunction_vpc (1838.06s)
--- PASS: TestAccDataSourceAWSLambdaLayerVersion_basic (19.83s)
--- PASS: TestAccDataSourceAWSLambdaLayerVersion_runtime (46.22s)
--- PASS: TestAccDataSourceAWSLambdaLayerVersion_version (35.61s)

--- PASS: TestAccDataSourceAWSLB_basic (211.76s)

--- PASS: TestAccDataSourceAWSMqBroker_basic (1232.73s)

--- PASS: TestAccDataSourceAWSRDSCluster_basic (135.85s)

--- PASS: TestAccDataSourceCloudHsm2Cluster_basic (267.05s)
```
@ghost
Copy link

ghost commented Mar 12, 2020

This has been released in version 2.53.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Apr 10, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 10, 2020
@breathingdust breathingdust added the linter Pertains to changes to or issues with the various linters. label Oct 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. linter Pertains to changes to or issues with the various linters. technical-debt Addresses areas of the codebase that need refactoring or redesign.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants