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

r/aws_inspector2_enabler: Correctly handle LambdaCode scan type #33935

Merged
merged 3 commits into from
Oct 13, 2023
Merged

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented Oct 13, 2023

Description

Replaces #33348.

Relations

Closes #33348.
Closes #32334.

Output from Acceptance Testing

Before

% make testacc TESTARGS='-run=TestAccInspector2_serial/Enabler' PKG=inspector2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/inspector2/... -v -count 1 -parallel 20  -run=TestAccInspector2_serial/Enabler -timeout 360m
=== RUN   TestAccInspector2_serial
=== PAUSE TestAccInspector2_serial
=== CONT  TestAccInspector2_serial
=== RUN   TestAccInspector2_serial/Enabler
=== RUN   TestAccInspector2_serial/Enabler/lambda
    enabler_test.go:229: Step 1/1 error: Error running apply: exit status 1
        
        Error: updating Amazon Inspector Enabler (123456789012-LAMBDA): operation error Inspector2: Disable, https response error StatusCode: 400, RequestID: 1e386999-91b3-4a01-bbea-d0adc8100ced, ValidationException: 1 validation error detected: Value at 'resourceTypes' failed to satisfy constraint: Member must satisfy constraint: [Member must satisfy enum value set: [LAMBDA_CODE, LAMBDA, ECR, EC2]]
        
          with aws_inspector2_enabler.test,
          on terraform_plugin_test.tf line 4, in resource "aws_inspector2_enabler" "test":
           4: resource "aws_inspector2_enabler" "test" {
        
=== RUN   TestAccInspector2_serial/Enabler/updateResourceTypes_disjoint
    enabler_test.go:186: Step 1/2 error: Error running apply: exit status 1
        
        Error: updating Amazon Inspector Enabler (123456789012-EC2): operation error Inspector2: Disable, https response error StatusCode: 400, RequestID: e755c7ed-6e32-428b-8ffa-a15693d6774f, ValidationException: 1 validation error detected: Value at 'resourceTypes' failed to satisfy constraint: Member must satisfy constraint: [Member must satisfy enum value set: [LAMBDA_CODE, LAMBDA, ECR, EC2]]
        
          with aws_inspector2_enabler.test,
          on terraform_plugin_test.tf line 4, in resource "aws_inspector2_enabler" "test":
           4: resource "aws_inspector2_enabler" "test" {
        
=== RUN   TestAccInspector2_serial/Enabler/memberAccount_basic
    enabler_test.go:263: Step 1/1 error: Error running apply: exit status 1
        
        Error: updating Amazon Inspector Enabler (123456789012-ECR): operation error Inspector2: Disable, https response error StatusCode: 400, RequestID: ba068ef0-e792-44ef-9843-857509ba7f4a, ValidationException: 1 validation error detected: Value at 'resourceTypes' failed to satisfy constraint: Member must satisfy constraint: [Member must satisfy enum value set: [LAMBDA_CODE, LAMBDA, ECR, EC2]]
        
          with aws_inspector2_enabler.member,
          on terraform_plugin_test.tf line 14, in resource "aws_inspector2_enabler" "member":
          14: resource "aws_inspector2_enabler" "member" {
        
=== RUN   TestAccInspector2_serial/Enabler/memberAccount_multiple
    enabler_test.go:330: Step 1/1 error: Error running apply: exit status 1
        
        Error: creating Amazon Inspector Member Association (123456789012): operation error Inspector2: AssociateMember, https response error StatusCode: 400, RequestID: 7fb565c5-f5f4-4be7-a969-ed0d757ac34c, ValidationException: The request is rejected because the given account ID is already a member or associated member of the current account.
        
          with aws_inspector2_member_association.members[1],
          on terraform_plugin_test.tf line 38, in resource "aws_inspector2_member_association" "members":
          38: resource "aws_inspector2_member_association" "members" {
        
=== RUN   TestAccInspector2_serial/Enabler/memberAccount_disappearsMemberAssociation
    enabler_test.go:298: Step 1/1 error: Error running apply: exit status 1
        
        Error: updating Amazon Inspector Enabler (123456789012-ECR): operation error Inspector2: Disable, https response error StatusCode: 400, RequestID: 97cbde0a-44da-412e-ae04-f09f26961c15, ValidationException: 1 validation error detected: Value at 'resourceTypes' failed to satisfy constraint: Member must satisfy constraint: [Member must satisfy enum value set: [LAMBDA_CODE, LAMBDA, ECR, EC2]]
        
          with aws_inspector2_enabler.member,
          on terraform_plugin_test.tf line 14, in resource "aws_inspector2_enabler" "member":
          14: resource "aws_inspector2_enabler" "member" {
        
=== RUN   TestAccInspector2_serial/Enabler/accountID
    enabler_test.go:66: Step 1/1 error: Error running apply: exit status 1
        
        Error: updating Amazon Inspector Enabler (123456789012-EC2:ECR): operation error Inspector2: Disable, https response error StatusCode: 400, RequestID: f4f60400-5e19-4ba8-9159-cfa0f510ecf4, ValidationException: 1 validation error detected: Value at 'resourceTypes' failed to satisfy constraint: Member must satisfy constraint: [Member must satisfy enum value set: [LAMBDA_CODE, LAMBDA, ECR, EC2]]
        
          with aws_inspector2_enabler.test,
          on terraform_plugin_test.tf line 4, in resource "aws_inspector2_enabler" "test":
           4: resource "aws_inspector2_enabler" "test" {
        
=== RUN   TestAccInspector2_serial/Enabler/disappears
    enabler_test.go:99: Step 1/1 error: Error running apply: exit status 1
        
        Error: updating Amazon Inspector Enabler (123456789012-ECR): operation error Inspector2: Disable, https response error StatusCode: 400, RequestID: f75bab49-4cdf-457e-93c5-bb2007fc324d, ValidationException: 1 validation error detected: Value at 'resourceTypes' failed to satisfy constraint: Member must satisfy constraint: [Member must satisfy enum value set: [LAMBDA_CODE, LAMBDA, ECR, EC2]]
        
          with aws_inspector2_enabler.test,
          on terraform_plugin_test.tf line 4, in resource "aws_inspector2_enabler" "test":
           4: resource "aws_inspector2_enabler" "test" {
        
=== RUN   TestAccInspector2_serial/Enabler/updateResourceTypes
    enabler_test.go:130: Step 1/3 error: Error running apply: exit status 1
        
        Error: updating Amazon Inspector Enabler (123456789012-EC2): operation error Inspector2: Disable, https response error StatusCode: 400, RequestID: 32800827-8334-42c7-a326-b2b7a7dd68e5, ValidationException: 1 validation error detected: Value at 'resourceTypes' failed to satisfy constraint: Member must satisfy constraint: [Member must satisfy enum value set: [LAMBDA_CODE, LAMBDA, ECR, EC2]]
        
          with aws_inspector2_enabler.test,
          on terraform_plugin_test.tf line 4, in resource "aws_inspector2_enabler" "test":
           4: resource "aws_inspector2_enabler" "test" {
        
=== RUN   TestAccInspector2_serial/Enabler/memberAccount_updateMemberAccounts
    enabler_test.go:370: Step 1/3 error: Error running apply: exit status 1
        
        Error: updating Amazon Inspector Enabler (123456789012-ECR): operation error Inspector2: Disable, https response error StatusCode: 400, RequestID: 40eb0dce-ccf6-4249-bfb2-61d3c5e3152b, ValidationException: 1 validation error detected: Value at 'resourceTypes' failed to satisfy constraint: Member must satisfy constraint: [Member must satisfy enum value set: [LAMBDA_CODE, LAMBDA, ECR, EC2]]
        
          with aws_inspector2_enabler.members,
          on terraform_plugin_test.tf line 26, in resource "aws_inspector2_enabler" "members":
          26: resource "aws_inspector2_enabler" "members" {
        
=== RUN   TestAccInspector2_serial/Enabler/memberAccount_updateMemberAccountsAndScanTypes
    enabler_test.go:438: Step 1/3 error: Error running apply: exit status 1
        
        Error: updating Amazon Inspector Enabler (123456789012-EC2): operation error Inspector2: Disable, https response error StatusCode: 400, RequestID: e109fff3-7324-4c5b-badb-79057727cb5d, ValidationException: 1 validation error detected: Value at 'resourceTypes' failed to satisfy constraint: Member must satisfy constraint: [Member must satisfy enum value set: [LAMBDA_CODE, LAMBDA, ECR, EC2]]
        
          with aws_inspector2_enabler.members,
          on terraform_plugin_test.tf line 26, in resource "aws_inspector2_enabler" "members":
          26: resource "aws_inspector2_enabler" "members" {
        
=== RUN   TestAccInspector2_serial/Enabler/basic
    enabler_test.go:34: Step 1/1 error: Error running apply: exit status 1
        
        Error: updating Amazon Inspector Enabler (123456789012-ECR): operation error Inspector2: Disable, https response error StatusCode: 400, RequestID: a8e73e5a-0dfa-46fc-8aa0-ee841a8ad4df, ValidationException: 1 validation error detected: Value at 'resourceTypes' failed to satisfy constraint: Member must satisfy constraint: [Member must satisfy enum value set: [LAMBDA_CODE, LAMBDA, ECR, EC2]]
        
          with aws_inspector2_enabler.test,
          on terraform_plugin_test.tf line 4, in resource "aws_inspector2_enabler" "test":
           4: resource "aws_inspector2_enabler" "test" {
        
--- FAIL: TestAccInspector2_serial (923.38s)
    --- FAIL: TestAccInspector2_serial/Enabler (923.38s)
        --- FAIL: TestAccInspector2_serial/Enabler/lambda (56.83s)
        --- FAIL: TestAccInspector2_serial/Enabler/updateResourceTypes_disjoint (291.41s)
        --- FAIL: TestAccInspector2_serial/Enabler/memberAccount_basic (84.58s)
        --- FAIL: TestAccInspector2_serial/Enabler/memberAccount_multiple (20.68s)
        --- FAIL: TestAccInspector2_serial/Enabler/memberAccount_disappearsMemberAssociation (69.11s)
        --- FAIL: TestAccInspector2_serial/Enabler/accountID (86.22s)
        --- FAIL: TestAccInspector2_serial/Enabler/disappears (38.84s)
        --- FAIL: TestAccInspector2_serial/Enabler/updateResourceTypes (56.05s)
        --- FAIL: TestAccInspector2_serial/Enabler/memberAccount_updateMemberAccounts (93.63s)
        --- FAIL: TestAccInspector2_serial/Enabler/memberAccount_updateMemberAccountsAndScanTypes (86.93s)
        --- FAIL: TestAccInspector2_serial/Enabler/basic (39.10s)
FAIL
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/inspector2	928.633s
FAIL
make: *** [testacc] Error 1

After

% make testacc TESTARGS='-run=TestAccInspector2_serial/Enabler' PKG=inspector2    
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/inspector2/... -v -count 1 -parallel 20  -run=TestAccInspector2_serial/Enabler -timeout 360m
=== RUN   TestAccInspector2_serial
=== PAUSE TestAccInspector2_serial
=== CONT  TestAccInspector2_serial
=== RUN   TestAccInspector2_serial/Enabler
=== RUN   TestAccInspector2_serial/Enabler/memberAccount_disappearsMemberAssociation
=== RUN   TestAccInspector2_serial/Enabler/updateResourceTypes
=== RUN   TestAccInspector2_serial/Enabler/updateResourceTypes_disjoint
=== RUN   TestAccInspector2_serial/Enabler/memberAccount_basic
=== RUN   TestAccInspector2_serial/Enabler/memberAccount_updateMemberAccounts
    enabler_test.go:370: Step 2/3 error: Error running apply: exit status 1
        
        Error: creating Amazon Inspector Member Association (858154385941): operation error Inspector2: AssociateMember, https response error StatusCode: 400, RequestID: 6fe97a61-3668-4fcb-bfea-9a47ed3d512b, ValidationException: The request is rejected because the given account ID is already a member or associated member of the current account.
        
          with aws_inspector2_member_association.members[1],
          on terraform_plugin_test.tf line 38, in resource "aws_inspector2_member_association" "members":
          38: resource "aws_inspector2_member_association" "members" {
        
=== RUN   TestAccInspector2_serial/Enabler/memberAccount_updateMemberAccountsAndScanTypes
    enabler_test.go:438: Step 2/3 error: Error running apply: exit status 1
        
        Error: creating Amazon Inspector Member Association (858154385941): operation error Inspector2: AssociateMember, https response error StatusCode: 400, RequestID: 877ee85c-c3de-4e92-8023-b1e4eeca609e, ValidationException: The request is rejected because the given account ID is already a member or associated member of the current account.
        
          with aws_inspector2_member_association.members[1],
          on terraform_plugin_test.tf line 38, in resource "aws_inspector2_member_association" "members":
          38: resource "aws_inspector2_member_association" "members" {
        
=== RUN   TestAccInspector2_serial/Enabler/basic
=== RUN   TestAccInspector2_serial/Enabler/accountID
=== RUN   TestAccInspector2_serial/Enabler/disappears
=== RUN   TestAccInspector2_serial/Enabler/lambda
=== RUN   TestAccInspector2_serial/Enabler/memberAccount_multiple
    enabler_test.go:330: Step 1/1 error: Error running apply: exit status 1
        
        Error: creating Amazon Inspector Member Association (858154385941): operation error Inspector2: AssociateMember, https response error StatusCode: 400, RequestID: b6ea4fe1-6769-4fe0-946c-ffb9b3fc54b0, ValidationException: The request is rejected because the given account ID is already a member or associated member of the current account.
        
          with aws_inspector2_member_association.members[1],
          on terraform_plugin_test.tf line 38, in resource "aws_inspector2_member_association" "members":
          38: resource "aws_inspector2_member_association" "members" {
        
--- FAIL: TestAccInspector2_serial (1141.45s)
    --- FAIL: TestAccInspector2_serial/Enabler (1141.45s)
        --- PASS: TestAccInspector2_serial/Enabler/memberAccount_disappearsMemberAssociation (50.46s)
        --- PASS: TestAccInspector2_serial/Enabler/updateResourceTypes (222.45s)
        --- PASS: TestAccInspector2_serial/Enabler/updateResourceTypes_disjoint (184.62s)
        --- PASS: TestAccInspector2_serial/Enabler/memberAccount_basic (66.00s)
        --- FAIL: TestAccInspector2_serial/Enabler/memberAccount_updateMemberAccounts (78.50s)
        --- FAIL: TestAccInspector2_serial/Enabler/memberAccount_updateMemberAccountsAndScanTypes (225.12s)
        --- PASS: TestAccInspector2_serial/Enabler/basic (63.88s)
        --- PASS: TestAccInspector2_serial/Enabler/accountID (107.97s)
        --- PASS: TestAccInspector2_serial/Enabler/disappears (57.91s)
        --- PASS: TestAccInspector2_serial/Enabler/lambda (63.58s)
        --- FAIL: TestAccInspector2_serial/Enabler/memberAccount_multiple (20.96s)
FAIL
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/inspector2	1147.472s
FAIL
make: *** [testacc] Error 1

Failures are unrelated to this change.

@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • 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.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added size/XS Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. service/inspector2 Issues and PRs that pertain to the inspector2 service. labels Oct 13, 2023
@terraform-aws-provider terraform-aws-provider bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Oct 13, 2023
@ewbankkit ewbankkit merged commit 827d2c3 into main Oct 13, 2023
70 checks passed
@ewbankkit ewbankkit deleted the b-33348 branch October 13, 2023 19:47
@ewbankkit ewbankkit added the bug Addresses a defect in current functionality. label Oct 13, 2023
@github-actions github-actions bot added this to the v5.22.0 milestone Oct 13, 2023
github-actions bot pushed a commit that referenced this pull request Oct 13, 2023
@github-actions github-actions bot removed the bug Addresses a defect in current functionality. label Oct 20, 2023
@github-actions
Copy link

This functionality has been released in v5.22.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. Thank you!

Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. service/inspector2 Issues and PRs that pertain to the inspector2 service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: aws_inspector2_enabler fails to create on 5.6.0 due to incorrect resource type constant
1 participant