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

Support CodeStar Connection data source lookup by name #19262

Conversation

wedge-jarrad
Copy link
Contributor

Update aws_codestarconnections_connection data source to allow lookups by name.

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 #15453

Output from acceptance testing:

$ gmake testacc TESTARGS='-run=TestAccDataSourceAwsCodeStarConnectionsConnection'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccDataSourceAwsCodeStarConnectionsConnection -timeout 180m
=== RUN   TestAccDataSourceAwsCodeStarConnectionsConnection_basic
=== PAUSE TestAccDataSourceAwsCodeStarConnectionsConnection_basic
=== RUN   TestAccDataSourceAwsCodeStarConnectionsConnection_tags
=== PAUSE TestAccDataSourceAwsCodeStarConnectionsConnection_tags
=== CONT  TestAccDataSourceAwsCodeStarConnectionsConnection_basic
=== CONT  TestAccDataSourceAwsCodeStarConnectionsConnection_tags
--- PASS: TestAccDataSourceAwsCodeStarConnectionsConnection_tags (18.09s)
--- PASS: TestAccDataSourceAwsCodeStarConnectionsConnection_basic (18.17s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	18.249s

@wedge-jarrad wedge-jarrad requested a review from a team as a code owner May 6, 2021 06:58
@ghost ghost added size/M Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. service/codestarconnections Issues and PRs that pertain to the codestarconnections service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels May 6, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label May 6, 2021
@breathingdust breathingdust removed the needs-triage Waiting for first response or review from a maintainer. label Sep 4, 2021
@zhelding
Copy link
Contributor

Pull request #21306 has significantly refactored the AWS Provider codebase. As a result, most PRs opened prior to the refactor now have merge conflicts that must be resolved before proceeding.

Specifically, PR #21306 relocated the code for all AWS resources and data sources from a single aws directory to a large number of separate directories in internal/service, each corresponding to a particular AWS service. This separation of code has also allowed for us to simplify the names of underlying functions -- while still avoiding namespace collisions.

We recognize that many pull requests have been open for some time without yet being addressed by our maintainers. Therefore, we want to make it clear that resolving these conflicts in no way affects the prioritization of a particular pull request. Once a pull request has been prioritized for review, the necessary changes will be made by a maintainer -- either directly or in collaboration with the pull request author.

For a more complete description of this refactor, including examples of how old filepaths and function names correspond to their new counterparts: please refer to issue #20000.

For a quick guide on how to amend your pull request to resolve the merge conflicts resulting from this refactor and bring it in line with our new code patterns: please refer to our Service Package Refactor Pull Request Guide.

…urce-by-name

Fix merge conflicts caused by the hashicorp#21306 armageddon :)
@wedge-jarrad
Copy link
Contributor Author

Updated acceptance test run after the merge:

$ gmake testacc TESTARGS='-run=TestAccCodeStarConnectionsConnectionDataSource' PKG_NAME=internal/service/codestarconnections
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/codestarconnections/... -v -count 1 -parallel 20 -run=TestAccCodeStarConnectionsConnectionDataSource -timeout 180m
=== RUN   TestAccCodeStarConnectionsConnectionDataSource_basic
=== PAUSE TestAccCodeStarConnectionsConnectionDataSource_basic
=== RUN   TestAccCodeStarConnectionsConnectionDataSource_tags
=== PAUSE TestAccCodeStarConnectionsConnectionDataSource_tags
=== CONT  TestAccCodeStarConnectionsConnectionDataSource_basic
=== CONT  TestAccCodeStarConnectionsConnectionDataSource_tags
--- PASS: TestAccCodeStarConnectionsConnectionDataSource_tags (13.77s)
--- PASS: TestAccCodeStarConnectionsConnectionDataSource_basic (13.92s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/codestarconnections	13.983s

ewbankkit added 5 commits May 6, 2022 13:32
Acceptance test output:

% make testacc TESTS=TestAccCodeStarConnectionsConnection_ PKG=codestarconnections ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/codestarconnections/... -v -count 1 -parallel 2 -run='TestAccCodeStarConnectionsConnection_'  -timeout 180m
=== RUN   TestAccCodeStarConnectionsConnection_basic
=== PAUSE TestAccCodeStarConnectionsConnection_basic
=== RUN   TestAccCodeStarConnectionsConnection_hostARN
=== PAUSE TestAccCodeStarConnectionsConnection_hostARN
=== RUN   TestAccCodeStarConnectionsConnection_disappears
=== PAUSE TestAccCodeStarConnectionsConnection_disappears
=== RUN   TestAccCodeStarConnectionsConnection_tags
=== PAUSE TestAccCodeStarConnectionsConnection_tags
=== CONT  TestAccCodeStarConnectionsConnection_basic
=== CONT  TestAccCodeStarConnectionsConnection_hostARN
--- PASS: TestAccCodeStarConnectionsConnection_basic (24.10s)
=== CONT  TestAccCodeStarConnectionsConnection_disappears
--- PASS: TestAccCodeStarConnectionsConnection_hostARN (24.83s)
=== CONT  TestAccCodeStarConnectionsConnection_tags
--- PASS: TestAccCodeStarConnectionsConnection_disappears (13.57s)
--- PASS: TestAccCodeStarConnectionsConnection_tags (45.08s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/codestarconnections	76.514s
Acceptance test output:

% make testacc TESTS=TestAccCodeStarConnectionsConnectionDataSource_ PKG=codestarconnections ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/codestarconnections/... -v -count 1 -parallel 2 -run='TestAccCodeStarConnectionsConnectionDataSource_'  -timeout 180m
=== RUN   TestAccCodeStarConnectionsConnectionDataSource_basic
=== PAUSE TestAccCodeStarConnectionsConnectionDataSource_basic
=== RUN   TestAccCodeStarConnectionsConnectionDataSource_tags
=== PAUSE TestAccCodeStarConnectionsConnectionDataSource_tags
=== CONT  TestAccCodeStarConnectionsConnectionDataSource_basic
=== CONT  TestAccCodeStarConnectionsConnectionDataSource_tags
--- PASS: TestAccCodeStarConnectionsConnectionDataSource_tags (19.78s)
--- PASS: TestAccCodeStarConnectionsConnectionDataSource_basic (20.26s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/codestarconnections	27.885s
Acceptance test output:

% make testacc TESTS=TestAccCodeStarConnectionsHost_basic PKG=codestarconnections
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/codestarconnections/... -v -count 1 -parallel 20 -run='TestAccCodeStarConnectionsHost_basic'  -timeout 180m
=== RUN   TestAccCodeStarConnectionsHost_basic
=== PAUSE TestAccCodeStarConnectionsHost_basic
=== CONT  TestAccCodeStarConnectionsHost_basic
--- PASS: TestAccCodeStarConnectionsHost_basic (26.92s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/codestarconnections	35.254s
Acceptance test output:

% make sweep SWEEPARGS=-sweep-run=aws_codestarconnections_host
WARNING: This will destroy infrastructure. Use only in development accounts.
go test ./internal/sweep -v -tags=sweep -sweep=us-west-2,us-east-1,us-east-2 -sweep-run=aws_codestarconnections_host -timeout 60m
2022/05/06 14:24:53 [DEBUG] Running Sweepers for region (us-west-2):
2022/05/06 14:24:53 [DEBUG] Sweeper (aws_codestarconnections_host) has dependency (aws_codestarconnections_connection), running..
2022/05/06 14:24:53 [DEBUG] Running Sweeper (aws_codestarconnections_connection) in region (us-west-2)
2022/05/06 14:24:53 [INFO] Retrieved credentials from "EnvConfigCredentials"
2022/05/06 14:24:53 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2022/05/06 14:24:54 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2022/05/06 14:24:56 [DEBUG] Completed Sweeper (aws_codestarconnections_connection) in region (us-west-2) in 3.204716576s
2022/05/06 14:24:56 [DEBUG] Running Sweeper (aws_codestarconnections_host) in region (us-west-2)
2022/05/06 14:24:56 [DEBUG] Completed Sweeper (aws_codestarconnections_host) in region (us-west-2) in 182.956826ms
2022/05/06 14:24:56 [DEBUG] Sweeper (aws_codestarconnections_connection) already ran in region (us-west-2)
2022/05/06 14:24:56 Completed Sweepers for region (us-west-2) in 3.387883982s
2022/05/06 14:24:56 Sweeper Tests for region (us-west-2) ran successfully:
	- aws_codestarconnections_connection
	- aws_codestarconnections_host
2022/05/06 14:24:56 [DEBUG] Running Sweepers for region (us-east-1):
2022/05/06 14:24:56 [DEBUG] Sweeper (aws_codestarconnections_host) has dependency (aws_codestarconnections_connection), running..
2022/05/06 14:24:56 [DEBUG] Running Sweeper (aws_codestarconnections_connection) in region (us-east-1)
2022/05/06 14:24:56 [INFO] Retrieved credentials from "EnvConfigCredentials"
2022/05/06 14:24:56 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2022/05/06 14:24:57 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2022/05/06 14:24:59 [DEBUG] Completed Sweeper (aws_codestarconnections_connection) in region (us-east-1) in 2.588793075s
2022/05/06 14:24:59 [DEBUG] Running Sweeper (aws_codestarconnections_host) in region (us-east-1)
2022/05/06 14:24:59 [DEBUG] Completed Sweeper (aws_codestarconnections_host) in region (us-east-1) in 46.946309ms
2022/05/06 14:24:59 [DEBUG] Sweeper (aws_codestarconnections_connection) already ran in region (us-east-1)
2022/05/06 14:24:59 Completed Sweepers for region (us-east-1) in 2.635781717s
2022/05/06 14:24:59 Sweeper Tests for region (us-east-1) ran successfully:
	- aws_codestarconnections_connection
	- aws_codestarconnections_host
2022/05/06 14:24:59 [DEBUG] Running Sweepers for region (us-east-2):
2022/05/06 14:24:59 [DEBUG] Running Sweeper (aws_codestarconnections_connection) in region (us-east-2)
2022/05/06 14:24:59 [INFO] Retrieved credentials from "EnvConfigCredentials"
2022/05/06 14:24:59 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2022/05/06 14:24:59 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2022/05/06 14:24:59 [DEBUG] Completed Sweeper (aws_codestarconnections_connection) in region (us-east-2) in 655.334506ms
2022/05/06 14:24:59 [DEBUG] Sweeper (aws_codestarconnections_host) has dependency (aws_codestarconnections_connection), running..
2022/05/06 14:24:59 [DEBUG] Sweeper (aws_codestarconnections_connection) already ran in region (us-east-2)
2022/05/06 14:24:59 [DEBUG] Running Sweeper (aws_codestarconnections_host) in region (us-east-2)
2022/05/06 14:24:59 [DEBUG] Completed Sweeper (aws_codestarconnections_host) in region (us-east-2) in 64.874316ms
2022/05/06 14:24:59 Completed Sweepers for region (us-east-2) in 720.25378ms
2022/05/06 14:24:59 Sweeper Tests for region (us-east-2) ran successfully:
	- aws_codestarconnections_connection
	- aws_codestarconnections_host
ok  	github.com/hashicorp/terraform-provider-aws/internal/sweep	10.453s
@ewbankkit ewbankkit added the enhancement Requests to existing resources that expand the functionality or scope. label May 6, 2022
@github-actions github-actions bot added sweeper Pertains to changes to or issues with the sweeper. size/XL Managed by automation to categorize the size of a PR. and removed size/M Managed by automation to categorize the size of a PR. labels May 6, 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 sweep SWEEPARGS=-sweep-run=aws_codestarconnections_host
# make sweep SWEEPARGS=-sweep-run=aws_example_thing
WARNING: This will destroy infrastructure. Use only in development accounts.
go test ./internal/sweep -v -tags=sweep -sweep=us-west-2,us-east-1,us-east-2 -sweep-run=aws_codestarconnections_host -timeout 60m
2022/05/06 14:24:53 [DEBUG] Running Sweepers for region (us-west-2):
2022/05/06 14:24:53 [DEBUG] Sweeper (aws_codestarconnections_host) has dependency (aws_codestarconnections_connection), running..
2022/05/06 14:24:53 [DEBUG] Running Sweeper (aws_codestarconnections_connection) in region (us-west-2)
2022/05/06 14:24:53 [INFO] Retrieved credentials from "EnvConfigCredentials"
2022/05/06 14:24:53 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2022/05/06 14:24:54 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2022/05/06 14:24:56 [DEBUG] Completed Sweeper (aws_codestarconnections_connection) in region (us-west-2) in 3.204716576s
2022/05/06 14:24:56 [DEBUG] Running Sweeper (aws_codestarconnections_host) in region (us-west-2)
2022/05/06 14:24:56 [DEBUG] Completed Sweeper (aws_codestarconnections_host) in region (us-west-2) in 182.956826ms
2022/05/06 14:24:56 [DEBUG] Sweeper (aws_codestarconnections_connection) already ran in region (us-west-2)
2022/05/06 14:24:56 Completed Sweepers for region (us-west-2) in 3.387883982s
2022/05/06 14:24:56 Sweeper Tests for region (us-west-2) ran successfully:
	- aws_codestarconnections_connection
	- aws_codestarconnections_host
2022/05/06 14:24:56 [DEBUG] Running Sweepers for region (us-east-1):
2022/05/06 14:24:56 [DEBUG] Sweeper (aws_codestarconnections_host) has dependency (aws_codestarconnections_connection), running..
2022/05/06 14:24:56 [DEBUG] Running Sweeper (aws_codestarconnections_connection) in region (us-east-1)
2022/05/06 14:24:56 [INFO] Retrieved credentials from "EnvConfigCredentials"
2022/05/06 14:24:56 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2022/05/06 14:24:57 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2022/05/06 14:24:59 [DEBUG] Completed Sweeper (aws_codestarconnections_connection) in region (us-east-1) in 2.588793075s
2022/05/06 14:24:59 [DEBUG] Running Sweeper (aws_codestarconnections_host) in region (us-east-1)
2022/05/06 14:24:59 [DEBUG] Completed Sweeper (aws_codestarconnections_host) in region (us-east-1) in 46.946309ms
2022/05/06 14:24:59 [DEBUG] Sweeper (aws_codestarconnections_connection) already ran in region (us-east-1)
2022/05/06 14:24:59 Completed Sweepers for region (us-east-1) in 2.635781717s
2022/05/06 14:24:59 Sweeper Tests for region (us-east-1) ran successfully:
	- aws_codestarconnections_connection
	- aws_codestarconnections_host
2022/05/06 14:24:59 [DEBUG] Running Sweepers for region (us-east-2):
2022/05/06 14:24:59 [DEBUG] Running Sweeper (aws_codestarconnections_connection) in region (us-east-2)
2022/05/06 14:24:59 [INFO] Retrieved credentials from "EnvConfigCredentials"
2022/05/06 14:24:59 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2022/05/06 14:24:59 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2022/05/06 14:24:59 [DEBUG] Completed Sweeper (aws_codestarconnections_connection) in region (us-east-2) in 655.334506ms
2022/05/06 14:24:59 [DEBUG] Sweeper (aws_codestarconnections_host) has dependency (aws_codestarconnections_connection), running..
2022/05/06 14:24:59 [DEBUG] Sweeper (aws_codestarconnections_connection) already ran in region (us-east-2)
2022/05/06 14:24:59 [DEBUG] Running Sweeper (aws_codestarconnections_host) in region (us-east-2)
2022/05/06 14:24:59 [DEBUG] Completed Sweeper (aws_codestarconnections_host) in region (us-east-2) in 64.874316ms
2022/05/06 14:24:59 Completed Sweepers for region (us-east-2) in 720.25378ms
2022/05/06 14:24:59 Sweeper Tests for region (us-east-2) ran successfully:
	- aws_codestarconnections_connection
	- aws_codestarconnections_host
ok  	github.com/hashicorp/terraform-provider-aws/internal/sweep	10.453s
% make testacc TESTS=TestAccCodeStarConnectionsConnectionDataSource_ PKG=codestarconnections ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/codestarconnections/... -v -count 1 -parallel 2 -run='TestAccCodeStarConnectionsConnectionDataSource_'  -timeout 180m
=== RUN   TestAccCodeStarConnectionsConnectionDataSource_basic
=== PAUSE TestAccCodeStarConnectionsConnectionDataSource_basic
=== RUN   TestAccCodeStarConnectionsConnectionDataSource_tags
=== PAUSE TestAccCodeStarConnectionsConnectionDataSource_tags
=== CONT  TestAccCodeStarConnectionsConnectionDataSource_basic
=== CONT  TestAccCodeStarConnectionsConnectionDataSource_tags
--- PASS: TestAccCodeStarConnectionsConnectionDataSource_basic (20.49s)
--- PASS: TestAccCodeStarConnectionsConnectionDataSource_tags (20.54s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/codestarconnections	28.602s
% make testacc TESTS=TestAccCodeStarConnectionsConnection_ PKG=codestarconnections ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/codestarconnections/... -v -count 1 -parallel 2 -run='TestAccCodeStarConnectionsConnection_'  -timeout 180m
=== RUN   TestAccCodeStarConnectionsConnection_basic
=== PAUSE TestAccCodeStarConnectionsConnection_basic
=== RUN   TestAccCodeStarConnectionsConnection_hostARN
=== PAUSE TestAccCodeStarConnectionsConnection_hostARN
=== RUN   TestAccCodeStarConnectionsConnection_disappears
=== PAUSE TestAccCodeStarConnectionsConnection_disappears
=== RUN   TestAccCodeStarConnectionsConnection_tags
=== PAUSE TestAccCodeStarConnectionsConnection_tags
=== CONT  TestAccCodeStarConnectionsConnection_basic
=== CONT  TestAccCodeStarConnectionsConnection_disappears
--- PASS: TestAccCodeStarConnectionsConnection_disappears (15.25s)
=== CONT  TestAccCodeStarConnectionsConnection_hostARN
--- PASS: TestAccCodeStarConnectionsConnection_basic (20.50s)
=== CONT  TestAccCodeStarConnectionsConnection_tags
--- PASS: TestAccCodeStarConnectionsConnection_hostARN (19.74s)
--- PASS: TestAccCodeStarConnectionsConnection_tags (47.90s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/codestarconnections	76.514s
% make testacc TESTS=TestAccCodeStarConnectionsHost_ PKG=codestarconnections ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/codestarconnections/... -v -count 1 -parallel 2 -run='TestAccCodeStarConnectionsHost_'  -timeout 180m
=== RUN   TestAccCodeStarConnectionsHost_basic
=== PAUSE TestAccCodeStarConnectionsHost_basic
=== RUN   TestAccCodeStarConnectionsHost_disappears
=== PAUSE TestAccCodeStarConnectionsHost_disappears
=== RUN   TestAccCodeStarConnectionsHost_vpc
=== PAUSE TestAccCodeStarConnectionsHost_vpc
=== CONT  TestAccCodeStarConnectionsHost_basic
=== CONT  TestAccCodeStarConnectionsHost_vpc
--- PASS: TestAccCodeStarConnectionsHost_basic (21.62s)
=== CONT  TestAccCodeStarConnectionsHost_disappears
--- PASS: TestAccCodeStarConnectionsHost_disappears (15.86s)
--- PASS: TestAccCodeStarConnectionsHost_vpc (494.45s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/codestarconnections	500.765s

@ewbankkit
Copy link
Contributor

@wedge-jarrad Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit cffbd38 into hashicorp:main May 6, 2022
@github-actions github-actions bot added this to the v4.14.0 milestone May 6, 2022
@github-actions
Copy link

This functionality has been released in v4.14.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 Jun 13, 2022
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. enhancement Requests to existing resources that expand the functionality or scope. service/codestarconnections Issues and PRs that pertain to the codestarconnections service. size/XL Managed by automation to categorize the size of a PR. sweeper Pertains to changes to or issues with the sweeper. 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.

4 participants