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

data source/service: Add data source for service #16640

Merged
merged 12 commits into from
Feb 10, 2022
Merged

Conversation

YakDriver
Copy link
Member

@YakDriver YakDriver commented Dec 8, 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 #16641

Output from acceptance tests (us-west-2):

% make testacc TESTS=TestAccMetaService_ PKG=meta
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/meta/... -v -count 1 -parallel 20 -run='TestAccMetaService_'  -timeout 180m
--- PASS: TestAccMetaService_unsupported (12.21s)
--- PASS: TestAccMetaService_byParts (12.21s)
--- PASS: TestAccMetaService_byDNSName (12.21s)
--- PASS: TestAccMetaService_basic (12.21s)
--- PASS: TestAccMetaService_byReverseDNSName (12.22s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/meta	13.586s
% make testacc TESTS=TestInvert PKG=meta
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/meta/... -v -count 1 -parallel 20 -run='TestInvert'  -timeout 180m
--- PASS: TestInvertStringSlice (0.00s)
    --- PASS: TestInvertStringSlice/DNS_Suffix (0.00s)
    --- PASS: TestInvertStringSlice/Ordered_List (0.00s)
    --- PASS: TestInvertStringSlice/Unordered_List (0.00s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/meta	1.309s

Output from acceptance tests (GovCloud):

% make testacc TESTS='TestAccMetaService_|TestInvert' PKG=meta
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/meta/... -v -count 1 -parallel 20 -run='TestAccMetaService_|TestInvert'  -timeout 180m
--- PASS: TestInvertStringSlice (0.00s)
    --- PASS: TestInvertStringSlice/DNS_Suffix (0.00s)
    --- PASS: TestInvertStringSlice/Ordered_List (0.00s)
    --- PASS: TestInvertStringSlice/Unordered_List (0.00s)
--- PASS: TestAccMetaService_byDNSName (12.10s)
--- PASS: TestAccMetaService_byReverseDNSName (12.10s)
--- PASS: TestAccMetaService_unsupported (12.10s)
--- PASS: TestAccMetaService_basic (12.11s)
--- PASS: TestAccMetaService_byParts (12.11s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/meta	13.423s

@YakDriver YakDriver requested a review from a team as a code owner December 8, 2020 00:03
@ghost ghost added size/L Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Dec 8, 2020
@YakDriver YakDriver added the partition/aws-us-gov Pertains to the aws-us-gov partition. label Dec 8, 2020
@bflad bflad self-assigned this Jan 6, 2021
@bflad
Copy link
Contributor

bflad commented Jan 6, 2021

Let's clear up #16641 (comment) before continuing here. We may also want to clarify the attributes better since this should not be EC2 specific and support forward and reverse DNS information.

@ghost ghost added size/XL Managed by automation to categorize the size of a PR. and removed size/L Managed by automation to categorize the size of a PR. labels Jan 11, 2021
Base automatically changed from master to main January 23, 2021 00:59
@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.

@YakDriver YakDriver changed the title data source/service_name: Add data source for service names data source/service: Add data source for service names Feb 10, 2022
@YakDriver YakDriver changed the title data source/service: Add data source for service names data source/service: Add data source for service Feb 10, 2022
@YakDriver
Copy link
Member Author

Let's clear up #16641 (comment) before continuing here. We may also want to clarify the attributes better since this should not be EC2 specific and support forward and reverse DNS information.

All of these items have been addressed.

@gdavison gdavison self-assigned this Feb 10, 2022
Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

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

Looks good! 🚀

One comment

Comment on lines 83 to 85
if _, ok := d.GetOk("service_id"); !ok {
d.Set("service_id", endpoints.Ec2ServiceID)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not a fan of adding a default here: if the practitioner is looking up a specific service, they should specify it.

@YakDriver YakDriver merged commit d932e11 into main Feb 10, 2022
@YakDriver YakDriver deleted the f-ds-service-name branch February 10, 2022 22:33
@github-actions github-actions bot added this to the v4.1.0 milestone Feb 10, 2022
github-actions bot pushed a commit that referenced this pull request Feb 10, 2022
@github-actions
Copy link

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

@antonbabenko
Copy link
Contributor

antonbabenko commented Feb 17, 2022

Can we also have dns_prefix added (value - amazonaws.com)? It would be helpful to generate global AWS Service Names like this - https://github.com/kubernetes-sigs/aws-load-balancer-controller/blob/694a0b14184e388806f9f34be0dd9075aa8fb0a7/docs/install/iam_policy.json#L12

Here is where we need it - https://github.com/terraform-aws-modules/terraform-aws-iam/pull/189/files/aa480435226ed9f9b4fc4a247ee9f6cabe1938ad#diff-eaa3db68ce5b0e6250b8b884997ba06f95e89312aee5c8bac7d9b703c7732257R507

@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 May 17, 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. partition/aws-us-gov Pertains to the aws-us-gov partition. provider Pertains to the provider itself, rather than any interaction with AWS. size/XL Managed by automation to categorize the size of a PR. 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.

data source/service: Add a service data source
5 participants