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

add: new data source aws_lb_hosted_zone_id #24749

Merged
merged 18 commits into from
May 18, 2022

Conversation

wellsiau-aws
Copy link
Contributor

@wellsiau-aws wellsiau-aws commented May 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

Closes #7988

Output from acceptance testing:

$ make testacc PKG=elbv2 TESTS=TestAccLBHostedZoneIDDataSource_basic
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/elbv2/... -v -count 1 -parallel 20 -run='TestAccLBHostedZoneIDDataSource_basic'  -timeout 180m
=== RUN   TestAccLBHostedZoneIDDataSource_basic
=== PAUSE TestAccLBHostedZoneIDDataSource_basic
=== CONT  TestAccLBHostedZoneIDDataSource_basic
--- PASS: TestAccLBHostedZoneIDDataSource_basic (17.18s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/elbv2      36.388s
...

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS. service/elbv2 Issues and PRs that pertain to the elbv2 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/L Managed by automation to categorize the size of a PR. labels May 11, 2022
@wellsiau-aws
Copy link
Contributor Author

Since network load balancer is supported on elbv2, I believe the right approach is to add new data source under elbv2: aws_lb_hosted_zone_id

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome @wellsiau-aws 👋

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 CONTRIBUTING 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! 😃

Copy link
Collaborator

@GlennChia GlennChia left a comment

Choose a reason for hiding this comment

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

Really great first PR! Welcome to the community!

internal/provider/provider.go Show resolved Hide resolved
internal/service/elbv2/hosted_zone_id_data_source.go Outdated Show resolved Hide resolved
internal/service/elbv2/hosted_zone_id_data_source.go Outdated Show resolved Hide resolved
internal/service/elbv2/hosted_zone_id_data_source.go Outdated Show resolved Hide resolved
internal/service/elbv2/hosted_zone_id_data_source.go Outdated Show resolved Hide resolved
internal/service/elbv2/hosted_zone_id_data_source_test.go Outdated Show resolved Hide resolved
internal/service/elbv2/hosted_zone_id_data_source_test.go Outdated Show resolved Hide resolved
website/docs/d/lb_hosted_zone_id.html.markdown Outdated Show resolved Hide resolved
@wellsiau-aws
Copy link
Contributor Author

thanks for the feedback @GlennChia , see my response above

@AdamTylerLynch
Copy link
Collaborator

We would appreciate one final run of the AccTests with the output pasted here now that you have made changes.

Once you post that, I’ll mark this as ready for merge.

nice job!

@drewmullen
Copy link
Collaborator

to pass terrafmt you can run:

$ find ./internal/service/<service name> -type f -name '<your test file name>_test.go' \
    | sort -u \
    | xargs -I {} terrafmt fmt --fmtcompat {}

fill in where i have <>

@YoSuperG
Copy link

@justinretzolk ☝️

@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label May 12, 2022
@wellsiau-aws
Copy link
Contributor Author

Re-run textacc after the last commit

$ make testacc PKG=elbv2 TESTS=TestAccLBHostedZoneIDDataSource_basic
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/elbv2/... -v -count 1 -parallel 20 -run='TestAccLBHostedZoneIDDataSource_basic'  -timeout 180m
=== RUN   TestAccLBHostedZoneIDDataSource_basic
=== PAUSE TestAccLBHostedZoneIDDataSource_basic
=== CONT  TestAccLBHostedZoneIDDataSource_basic
--- PASS: TestAccLBHostedZoneIDDataSource_basic (22.95s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/elbv2      42.378s

@wellsiau-aws
Copy link
Contributor Author

go generate failed because it can't find prefix for lb_hosted_zone_id

The available prefixes : [lb\. lb_listener lb_target_group]

What would the convention? should I add general prefix lb_?

@wellsiau-aws
Copy link
Contributor Author

made minor fix for terrafmt and removing unused fmt.Errorf

@wellsiau-aws
Copy link
Contributor Author

Test re-run

$ make testacc PKG=elb TESTS=TestAccELBHostedZoneIDDataSource_basic
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/elb/... -v -count 1 -parallel 20 -run='TestAccELBHostedZoneIDDataSource_basic'  -timeout 180m
=== RUN   TestAccELBHostedZoneIDDataSource_basic
=== PAUSE TestAccELBHostedZoneIDDataSource_basic
=== CONT  TestAccELBHostedZoneIDDataSource_basic
--- PASS: TestAccELBHostedZoneIDDataSource_basic (10.75s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/elb        32.939s

Copy link
Collaborator

@AdamTylerLynch AdamTylerLynch left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

internal/provider/provider.go Show resolved Hide resolved
@ewbankkit
Copy link
Contributor

@wellsiau-aws Those prefixes are defined in names/names_data.csv.
Maybe @YakDriver can give some advice about what the long-term strategy should be for naming these ELBv2 resources/data sources?

@wellsiau-aws
Copy link
Contributor Author

@YakDriver , for now I added new prefix in names/names_data.csv for lb_hosted (under DocPrefix)

@ewbankkit
Copy link
Contributor

@wellsiau-aws Could you please also add a line about this new DS to https://github.com/hashicorp/terraform-provider-aws/blob/main/docs/contributing/contribution-checklists.md#new-region? Thanks.

@github-actions github-actions bot added github_actions Pull requests that update Github_actions code repository Repository modifications; GitHub Actions, developer docs, issue templates, codeowners, changelog. labels May 18, 2022
@wellsiau-aws
Copy link
Contributor Author

I had some issue with my local machine running make providerlint which I think attributed to my Go version go version go1.18.1 darwin/amd64

$ make lint
==> Checking source code with golangci-lint...
==> Checking source code with providerlint...
providerlint: internal error: package "fmt" without types was imported from "github.com/hashicorp/terraform-provider-aws/internal/service/iotevents"
make: *** [providerlint] Error 1

However, I believe I have addressed the linting issue. I will run test on separate machine shortly. Here is the latest test:

$ make testacc PKG=elb TESTS=TestAccELBHostedZoneIDDataSource_basic
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/elb/... -v -count 1 -parallel 20 -run='TestAccELBHostedZoneIDDataSource_basic'  -timeout 180m
=== RUN   TestAccELBHostedZoneIDDataSource_basic
=== PAUSE TestAccELBHostedZoneIDDataSource_basic
=== CONT  TestAccELBHostedZoneIDDataSource_basic
--- PASS: TestAccELBHostedZoneIDDataSource_basic (10.89s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/elb        13.574s

@ewbankkit
Copy link
Contributor

% make providerlint
==> Checking source code with providerlint...

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=TestAccLBHostedZoneIDDataSource_' PKG=elbv2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/elbv2/... -v -count 1 -parallel 20  -run=TestAccLBHostedZoneIDDataSource_ -timeout 180m
=== RUN   TestAccLBHostedZoneIDDataSource_basic
=== PAUSE TestAccLBHostedZoneIDDataSource_basic
=== CONT  TestAccLBHostedZoneIDDataSource_basic
--- PASS: TestAccLBHostedZoneIDDataSource_basic (46.15s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/elbv2	53.995s

@ewbankkit
Copy link
Contributor

@wellsiau-aws Thanks for the contribution 🎉 👏.

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

This functionality has been released in v4.15.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 20, 2022
@justinretzolk justinretzolk added the partner Contribution from a partner. label May 8, 2024
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. github_actions Pull requests that update Github_actions code partner Contribution from a partner. provider Pertains to the provider itself, rather than any interaction with AWS. repository Repository modifications; GitHub Actions, developer docs, issue templates, codeowners, changelog. service/elbv2 Issues and PRs that pertain to the elbv2 service. size/L 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.

aws_elb_hosted_zone_id data source doesn't support Network Load Balancers
7 participants