-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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: Support inspector2 enabler in regions without LAMBDA_CODE #38254
fix: Support inspector2 enabler in regions without LAMBDA_CODE #38254
Conversation
Community NoteVoting for Prioritization
For Submitters
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome @omnibrian 👋
It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTOR guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.
Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.
Thanks again, and welcome to the community! 😃
4c59eb4
to
96acb4c
Compare
96acb4c
to
9da9a5c
Compare
Has this fallen through the cracks, perhaps? A simple fix to a rather significant bug, hasn't been touched for more than two months, not currently assigned to anyone, a fair few upvotes to boot... |
This reverts commit d9b03bb.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀.
% make testacc TESTARGS='-run=TestAccInspector2_serial/DelegatedAdminAccount' PKG=inspector2
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.7 test ./internal/service/inspector2/... -v -count 1 -parallel 20 -run=TestAccInspector2_serial/DelegatedAdminAccount -timeout 360m
=== RUN TestAccInspector2_serial
=== PAUSE TestAccInspector2_serial
=== CONT TestAccInspector2_serial
=== RUN TestAccInspector2_serial/DelegatedAdminAccount
=== RUN TestAccInspector2_serial/DelegatedAdminAccount/basic
=== RUN TestAccInspector2_serial/DelegatedAdminAccount/disappears
--- PASS: TestAccInspector2_serial (29.24s)
--- PASS: TestAccInspector2_serial/DelegatedAdminAccount (29.24s)
--- PASS: TestAccInspector2_serial/DelegatedAdminAccount/basic (16.35s)
--- PASS: TestAccInspector2_serial/DelegatedAdminAccount/disappears (12.88s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/inspector2 34.407s
% make testacc TESTARGS='-run=TestAccInspector2_serial/MemberAssociation' PKG=inspector2
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.7 test ./internal/service/inspector2/... -v -count 1 -parallel 20 -run=TestAccInspector2_serial/MemberAssociation -timeout 360m
=== RUN TestAccInspector2_serial
=== PAUSE TestAccInspector2_serial
=== CONT TestAccInspector2_serial
=== RUN TestAccInspector2_serial/MemberAssociation
=== RUN TestAccInspector2_serial/MemberAssociation/basic
=== RUN TestAccInspector2_serial/MemberAssociation/disappears
--- PASS: TestAccInspector2_serial (45.46s)
--- PASS: TestAccInspector2_serial/MemberAssociation (45.46s)
--- PASS: TestAccInspector2_serial/MemberAssociation/basic (24.94s)
--- PASS: TestAccInspector2_serial/MemberAssociation/disappears (20.51s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/inspector2 50.768s
% make testacc TESTARGS='-run=TestAccInspector2_serial/OrganizationConfiguration' PKG=inspector2
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.7 test ./internal/service/inspector2/... -v -count 1 -parallel 20 -run=TestAccInspector2_serial/OrganizationConfiguration -timeout 360m
=== RUN TestAccInspector2_serial
=== PAUSE TestAccInspector2_serial
=== CONT TestAccInspector2_serial
=== RUN TestAccInspector2_serial/OrganizationConfiguration
=== RUN TestAccInspector2_serial/OrganizationConfiguration/lambda
=== RUN TestAccInspector2_serial/OrganizationConfiguration/lambdaCode
=== RUN TestAccInspector2_serial/OrganizationConfiguration/basic
=== RUN TestAccInspector2_serial/OrganizationConfiguration/disappears
=== RUN TestAccInspector2_serial/OrganizationConfiguration/ec2ECR
--- PASS: TestAccInspector2_serial (68.40s)
--- PASS: TestAccInspector2_serial/OrganizationConfiguration (68.40s)
--- PASS: TestAccInspector2_serial/OrganizationConfiguration/lambda (14.28s)
--- PASS: TestAccInspector2_serial/OrganizationConfiguration/lambdaCode (13.35s)
--- PASS: TestAccInspector2_serial/OrganizationConfiguration/basic (13.26s)
--- PASS: TestAccInspector2_serial/OrganizationConfiguration/disappears (14.25s)
--- PASS: TestAccInspector2_serial/OrganizationConfiguration/ec2ECR (13.26s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/inspector2 73.944s
us-west-2
% make testacc TESTARGS='-run=TestAccInspector2_serial/Enabler/lambdaCode' PKG=inspector2
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.7 test ./internal/service/inspector2/... -v -count 1 -parallel 20 -run=TestAccInspector2_serial/Enabler/lambdaCode -timeout 360m
=== RUN TestAccInspector2_serial
=== PAUSE TestAccInspector2_serial
=== CONT TestAccInspector2_serial
=== RUN TestAccInspector2_serial/Enabler
=== RUN TestAccInspector2_serial/Enabler/lambdaCode
--- PASS: TestAccInspector2_serial (115.38s)
--- PASS: TestAccInspector2_serial/Enabler (115.38s)
--- PASS: TestAccInspector2_serial/Enabler/lambdaCode (115.38s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/inspector2 120.630s
us-west-1
% AWS_DEFAULT_REGION=us-west-1 make testacc TESTARGS='-run=TestAccInspector2_serial/Enabler/^lambda$$' PKG=inspector2
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.7 test ./internal/service/inspector2/... -v -count 1 -parallel 20 -run=TestAccInspector2_serial/Enabler/^lambda$ -timeout 360m
=== RUN TestAccInspector2_serial
=== PAUSE TestAccInspector2_serial
=== CONT TestAccInspector2_serial
=== RUN TestAccInspector2_serial/Enabler
=== RUN TestAccInspector2_serial/Enabler/lambda
--- PASS: TestAccInspector2_serial (82.12s)
--- PASS: TestAccInspector2_serial/Enabler (82.12s)
--- PASS: TestAccInspector2_serial/Enabler/lambda (82.12s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/inspector2 87.351s
Prior to the fix:
% AWS_DEFAULT_REGION=us-west-1 make testacc TESTARGS='-run=TestAccInspector2_serial/Enabler/^lambda$$' PKG=inspector2
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.7 test ./internal/service/inspector2/... -v -count 1 -parallel 20 -run=TestAccInspector2_serial/Enabler/^lambda$ -timeout 360m
=== RUN TestAccInspector2_serial
=== PAUSE TestAccInspector2_serial
=== CONT TestAccInspector2_serial
=== RUN TestAccInspector2_serial/Enabler
=== RUN TestAccInspector2_serial/Enabler/lambda
enabler_test.go:228: Step 1/1 error: Error running apply: exit status 1
Error: updating AWS Inspector Enabler (123456789012-LAMBDA): operation error Inspector2: Disable, https response error StatusCode: 403, RequestID: c5f79617-bd73-4809-8159-29b792d9f74f, AccessDeniedException: Lambda code scanning is not supported in us-west-1
with aws_inspector2_enabler.test,
on terraform_plugin_test.tf line 14, in resource "aws_inspector2_enabler" "test":
14: resource "aws_inspector2_enabler" "test" {
panic.go:629: Error running post-test destroy, there may be dangling resources: exit status 1
Error: deleting AWS Inspector Enabler (123456789012-LAMBDA): operation error Inspector2: Disable, https response error StatusCode: 403, RequestID: b366c116-5331-4523-bd67-2ab99da95ea1, AccessDeniedException: Lambda code scanning is not supported in us-west-1
--- FAIL: TestAccInspector2_serial (17.15s)
--- FAIL: TestAccInspector2_serial/Enabler (17.15s)
--- FAIL: TestAccInspector2_serial/Enabler/lambda (17.15s)
FAIL
FAIL github.com/hashicorp/terraform-provider-aws/internal/service/inspector2 22.428s
FAIL
make: *** [testacc] Error 1
This functionality has been released in v5.69.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! |
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. |
Description
I ran into issue #34039 when trying to use the
aws_inspector2_enabler
resource in the us-gov-west-1 region and saw that it was still open. This is attempting to fix the issue by avoid including resource types that are already disabled to cover any regions whereLAMBDA_CODE
isn't available.Relations
Closes #34039.
Closes #38845.
Closes #38895.
References
There is an internal call to disable any resource types not listed when creating the resource which fails in any region where lambda code scanning is not supported. This is the output from trying to create an
aws_inspector2_enabler
with only theEC2
andECR
resource types in us-gov-west-1:Output from Acceptance Testing
I don't have an org management account I can test in the commercial partition, but this is the before and after of the acceptance tests in the us-gov-west-1 region for a govcloud org management account.
Before
After