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

Rolesanywhere trustanchor resource #25779

Merged

Conversation

mattburgess
Copy link
Collaborator

@mattburgess mattburgess commented Jul 11, 2022

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

Relates #25727

Output from acceptance testing:

$ make testacc TESTS=TestAccRolesAnywhereTrustAnchor PKG=rolesanywhere
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/rolesanywhere/... -v -count 1 -parallel 20 -run='TestAccRolesAnywhereTrustAnchor'  -timeout 180m
=== RUN   TestAccRolesAnywhereTrustAnchor_basic
--- PASS: TestAccRolesAnywhereTrustAnchor_basic (24.65s)
=== RUN   TestAccRolesAnywhereTrustAnchor_tags
--- PASS: TestAccRolesAnywhereTrustAnchor_tags (40.93s)
=== RUN   TestAccRolesAnywhereTrustAnchor_disappears
--- PASS: TestAccRolesAnywhereTrustAnchor_disappears (17.69s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/rolesanywhere	83.333s

@github-actions github-actions bot added size/XL Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. generators Relates to code generators. provider Pertains to the provider itself, rather than any interaction with AWS. tags Pertains to resource tagging. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/rolesanywhere Issues and PRs that pertain to the rolesanywhere service. needs-triage Waiting for first response or review from a maintainer. labels Jul 11, 2022
@mattburgess mattburgess force-pushed the rolesanywhere-trustanchor-resource branch 2 times, most recently from b05e32a to 6ca1012 Compare July 12, 2022 07:28
@mattburgess
Copy link
Collaborator Author

I'm struggling a bit to understand what's going on with my acceptance tests. I used the kendra acctests as guidance, given my unfamiliarity with the changes with the AWS SDK v2 way of doing things:

$ make testacc TESTS=TestAccRolesAnywhere PKG=rolesanywhere
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/rolesanywhere/... -v -count 1 -parallel 20 -run='TestAccRolesAnywhere'  -timeout 180m
=== RUN   TestAccRolesAnywhereTrustAnchor_basic
--- FAIL: TestAccRolesAnywhereTrustAnchor_basic (0.52s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x741455]

goroutine 7 [running]:
testing.tRunner.func1.2({0x82ffb40, 0x10a2fa60})
	/usr/local/go/src/testing/testing.go:1209 +0x24e
testing.tRunner.func1()
	/usr/local/go/src/testing/testing.go:1212 +0x218
panic({0x82ffb40, 0x10a2fa60})
	/usr/local/go/src/runtime/panic.go:1038 +0x215
github.com/aws/aws-sdk-go-v2/service/rolesanywhere.(*Client).invokeOperation(0x0, {0xaa9c410, 0xc0000520c0}, {0x9940d47, 0xc001b29040}, {0x80b4c80, 0xc001b25410}, {0x0, 0x0, 0x0}, ...)
	/home/mattburgess/go/pkg/mod/github.com/aws/aws-sdk-go-v2/service/[email protected]/api_client.go:164 +0xd5
github.com/aws/aws-sdk-go-v2/service/rolesanywhere.(*Client).ListTrustAnchors(0x992c677, {0xaa9c410, 0xc0000520c0}, 0xc000000001, {0x0, 0xc001c0f9f0, 0xc001c0fa58})
	/home/mattburgess/go/pkg/mod/github.com/aws/aws-sdk-go-v2/service/[email protected]/api_op_ListTrustAnchors.go:22 +0x127
github.com/hashicorp/terraform-provider-aws/internal/service/rolesanywhere_test.testAccPreCheck(0xc0006169c0)
	/home/mattburgess/dev/terraform-provider-aws/internal/service/rolesanywhere/trust_anchor_test.go:277 +0x8b
github.com/hashicorp/terraform-provider-aws/internal/service/rolesanywhere_test.TestAccRolesAnywhereTrustAnchor_basic.func1()
	/home/mattburgess/dev/terraform-provider-aws/internal/service/rolesanywhere/trust_anchor_test.go:26 +0x2f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource.Test({0xac0ead8, 0xc0006169c0}, {0x0, 0xc001a850a0, 0xc001ac7200, 0x0, 0x0, 0x0, 0x0, 0x0, ...})
	/home/mattburgess/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/resource/testing.go:727 +0x476
github.com/hashicorp/terraform-provider-aws/internal/service/rolesanywhere_test.TestAccRolesAnywhereTrustAnchor_basic(0xc0006169c0)
	/home/mattburgess/dev/terraform-provider-aws/internal/service/rolesanywhere/trust_anchor_test.go:25 +0x567
testing.tRunner(0xc0006169c0, 0x9b21040)
	/usr/local/go/src/testing/testing.go:1259 +0x102
created by testing.(*T).Run
	/usr/local/go/src/testing/testing.go:1306 +0x35a
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/rolesanywhere	0.578s
FAIL
make: *** [GNUmakefile:52: testacc] Error 1

It looks as if it's crashing within the SDK, but I think I've got the provider configured correctly (the tests call acctest.PreCheck(t). Any help gratefully received!

@ewbankkit
Copy link
Contributor

@mattburgess It looks like RolesAnywhereConn isn't being initialized in internal/conns/config_gen.go and hence is nil, causing the panic.

@mattburgess
Copy link
Collaborator Author

@mattburgess It looks like RolesAnywhereConn isn't being initialized in internal/conns/config_gen.go and hence is nil, causing the panic.

Awesome, thanks @ewbankkit. I'd completely forgotten I'd had to mark client-gen to be skipped in the names csv file! I've followed the same pattern as Kendra in config.go and that's got things to the point where it's trying to actually create resources. I'm hoping to have this PR ready in the next couple of days.

@mattburgess mattburgess force-pushed the rolesanywhere-trustanchor-resource branch from 6ca1012 to a078082 Compare July 14, 2022 20:43
@github-actions github-actions bot added the client-connections Pertains to the AWS Client and service connections. label Jul 14, 2022
@mattburgess mattburgess marked this pull request as ready for review July 14, 2022 20:47
@mattburgess
Copy link
Collaborator Author

Marking as ready for review as it's passing the 3 "minimal" acceptance tests. I'll work on adding some more in due course, as this only currently tests ACM-PCA based Trust Anchors

@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Jul 15, 2022
Copy link
Contributor

@ewbankkit ewbankkit left a 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=TestAccRolesAnywhereTrustAnchor_' PKG=rolesanywhere ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/rolesanywhere/... -v -count 1 -parallel 2  -run=TestAccRolesAnywhereTrustAnchor_ -timeout 180m
=== RUN   TestAccRolesAnywhereTrustAnchor_basic
=== PAUSE TestAccRolesAnywhereTrustAnchor_basic
=== RUN   TestAccRolesAnywhereTrustAnchor_tags
=== PAUSE TestAccRolesAnywhereTrustAnchor_tags
=== RUN   TestAccRolesAnywhereTrustAnchor_disappears
=== PAUSE TestAccRolesAnywhereTrustAnchor_disappears
=== RUN   TestAccRolesAnywhereTrustAnchor_certificateBundle
=== PAUSE TestAccRolesAnywhereTrustAnchor_certificateBundle
=== CONT  TestAccRolesAnywhereTrustAnchor_basic
=== CONT  TestAccRolesAnywhereTrustAnchor_disappears
--- PASS: TestAccRolesAnywhereTrustAnchor_disappears (23.89s)
=== CONT  TestAccRolesAnywhereTrustAnchor_certificateBundle
--- PASS: TestAccRolesAnywhereTrustAnchor_basic (26.18s)
=== CONT  TestAccRolesAnywhereTrustAnchor_tags
--- PASS: TestAccRolesAnywhereTrustAnchor_certificateBundle (17.36s)
--- PASS: TestAccRolesAnywhereTrustAnchor_tags (51.61s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/rolesanywhere	81.945s

@ewbankkit
Copy link
Contributor

@mattburgess Thanks for the contribution 🎉 👏.
I added an acceptance test for the CERTIFICATE_BUNDLE case.

@ewbankkit
Copy link
Contributor

% make providerlint golangci-lint
==> Checking source code with providerlint...
==> Checking source code with golangci-lint...

@ewbankkit ewbankkit merged commit 618bd8c into hashicorp:main Jul 18, 2022
@github-actions github-actions bot added this to the v4.23.0 milestone Jul 18, 2022
@mattburgess mattburgess deleted the rolesanywhere-trustanchor-resource branch July 18, 2022 19:48
@ewbankkit ewbankkit mentioned this pull request Jul 19, 2022
3 tasks
@github-actions
Copy link

This functionality has been released in v4.23.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!

@github-actions
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 Aug 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
client-connections Pertains to the AWS Client and service connections. documentation Introduces or discusses updates to documentation. generators Relates to code generators. provider Pertains to the provider itself, rather than any interaction with AWS. service/rolesanywhere Issues and PRs that pertain to the rolesanywhere service. size/XL Managed by automation to categorize the size of a PR. tags Pertains to resource tagging. 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.

2 participants