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

correct linting errors for typelist/max_items schema attributes #13090

Closed
wants to merge 10 commits into from

Conversation

anGie44
Copy link
Contributor

@anGie44 anGie44 commented Apr 29, 2020

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment 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 pull request followers and do not help prioritize the request

Closes #9956

Release note for CHANGELOG:

correct typeset usage with typelist in cases where max_items is 1

Output from acceptance testing:

PASS: TestAccAWSFsxWindowsFileSystem
PASS: TestAccAWSFsxLustreFileSystem
PASS: TestAccAWSAPIGatewayUsagePlan
PASS: TestAccAWSCloudFrontDistribution
PASS: TestAccAWSAPIGatewayVpcLink
PASS: TestAccAWSEcsService
PASS: TestAccAWSEcsServiceDataSource
PASS: TestAccAWSS3Bucket
PASS: TestAccAWSS3BucketMetric
PASS: TestAWSS3BucketName 
PASS: TestAccAWSS3BucketInventory
PASS: TestAccAWSS3BucketPolicy
PASS: TestAccAWSS3BucketPublicAccessBlock
PASS: TestAccAWSCodeBuildProject
PASS: TestAccAWSWafByteMatchSet
PASS: TestAccAWSS3BucketObject
PASS: TestAWSWafSqlInjectionMatchSet
PASS: TestAWSWafWebAcl
PASS: TestAccAWSWafByteMatchSet
PASS: TestAccAWSS3BucketNotification
PASS: TestAccAWSVPCPeeringConnection
PASS: TestAccAWSVPCPeeringConnectionAccepter
PASS: TestAccAWSS3BucketPublicAccessBlock
PASS: TestAccAWSS3BucketAnalyticsConfiguration
PASS: TestAccAWSElasticTranscoderPipeline
PASS: TestAccAWSElasticTranscoderPreset
PASS: TestWebsiteEndpoint
PASS: TestBucketRegionalDomainName
PASS: TestAccAWSKinesisFirehoseDeliveryStream
PASS: TestAccAWSSESEventDestination
FAIL: TestAccAWSS3Bucket_LifecycleRule_Expiration_EmptyConfigurationBlock

@anGie44 anGie44 requested a review from a team April 29, 2020 22:09
@ghost ghost added size/M Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. provider Pertains to the provider itself, rather than any interaction with AWS. service/apigateway Issues and PRs that pertain to the apigateway service. service/appmesh Issues and PRs that pertain to the appmesh service. service/cloudfront Issues and PRs that pertain to the cloudfront service. service/codebuild Issues and PRs that pertain to the codebuild service. service/ec2 Issues and PRs that pertain to the ec2 service. service/ecs Issues and PRs that pertain to the ecs service. service/eks Issues and PRs that pertain to the eks service. service/elastic-transcoder service/firehose Issues and PRs that pertain to the firehose service. service/fsx Issues and PRs that pertain to the fsx service. service/s3 Issues and PRs that pertain to the s3 service. service/ses Issues and PRs that pertain to the ses service. service/waf Issues and PRs that pertain to the waf service. labels Apr 29, 2020
@anGie44 anGie44 marked this pull request as draft April 29, 2020 22:31
@ghost ghost added size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. and removed size/M Managed by automation to categorize the size of a PR. labels Apr 30, 2020
@anGie44 anGie44 marked this pull request as ready for review April 30, 2020 17:06
@gdavison gdavison added technical-debt Addresses areas of the codebase that need refactoring or redesign. and removed needs-triage Waiting for first response or review from a maintainer. labels Apr 30, 2020
@gdavison gdavison self-assigned this Apr 30, 2020
@@ -2191,33 +2186,38 @@ func resourceAwsS3BucketLifecycleUpdate(s3conn *s3.S3, d *schema.ResourceData) e
}

// Expiration
expiration := d.Get(fmt.Sprintf("lifecycle_rule.%d.expiration", i)).(*schema.Set).List()
expiration := d.Get(fmt.Sprintf("lifecycle_rule.%d.expiration", i)).([]interface{})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wondering if this is the correct way to get the expiration value from the resource b/c I noticed if expiration is passed in as empty expiration {} block for example in a TF config, the value of this expiration variable is [ nil ], requiring the 2 if checks below..while previously only 1 if was needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value extracted here and in nc_expiration at L2212 could also explain new test failure seen in TestAccAWSS3Bucket_LifecycleRule_Expiration_EmptyConfigurationBlock...though following the logic, the error seems to makes sense to me as nothing in the rule object will be populated in terms of an action if one were to pass just the enabled and id params to lifecycle_rule

}

// NoncurrentVersionExpiration
nc_expiration := d.Get(fmt.Sprintf("lifecycle_rule.%d.noncurrent_version_expiration", i)).(*schema.Set).List()
nc_expiration := d.Get(fmt.Sprintf("lifecycle_rule.%d.noncurrent_version_expiration", i)).([]interface{})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as above

@anGie44 anGie44 marked this pull request as draft May 14, 2020 20:45
@ghost ghost added size/L Managed by automation to categorize the size of a PR. and removed size/XL Managed by automation to categorize the size of a PR. labels May 15, 2020
@anGie44 anGie44 removed service/s3 Issues and PRs that pertain to the s3 service. service/codebuild Issues and PRs that pertain to the codebuild service. labels May 15, 2020
@bflad
Copy link
Contributor

bflad commented May 15, 2020

Not sure how @gdavison feels on the subject, but can you please split this up per resource or service? Some of these are going to be a lot harder to review/fix than others and also for some of these we can close out a laundry list of issues (e.g. aws_codebuild_project), so it would be nice to iteratively get these fixes in. Thanks so much!

@anGie44
Copy link
Contributor Author

anGie44 commented May 15, 2020

sure thing! I was just starting to pull out 3 resources b/c of test failures and was thinking to myself I should of split things up more 😅

@anGie44 anGie44 closed this May 15, 2020
@anGie44 anGie44 deleted the ap_ensure_typelist branch May 15, 2020 06:31
@ghost
Copy link

ghost commented Jun 14, 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 Jun 14, 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
linter Pertains to changes to or issues with the various linters. provider Pertains to the provider itself, rather than any interaction with AWS. service/apigateway Issues and PRs that pertain to the apigateway service. service/appmesh Issues and PRs that pertain to the appmesh service. service/cloudfront Issues and PRs that pertain to the cloudfront service. service/ec2 Issues and PRs that pertain to the ec2 service. service/ecs Issues and PRs that pertain to the ecs service. service/eks Issues and PRs that pertain to the eks service. service/firehose Issues and PRs that pertain to the firehose service. service/fsx Issues and PRs that pertain to the fsx service. service/ses Issues and PRs that pertain to the ses service. service/waf Issues and PRs that pertain to the waf service. size/L Managed by automation to categorize the size of a PR. technical-debt Addresses areas of the codebase that need refactoring or redesign. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix and enable tfproviderlint S018 check: Use TypeList and MaxItems: 1
4 participants