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

feat: implement apprunner_hosted_zone_id #36288

Merged
merged 7 commits into from
Mar 11, 2024

Conversation

mussinbenarbia
Copy link

@mussinbenarbia mussinbenarbia commented Mar 10, 2024

Description

Adds a Data Source to get the HostedZoneId of an AWS App Runner service.
This can be consumed for the purpose of using it in an AWS Route53 Alias record, when associating a custom domain with a service.

Similar to https://github.com/hashicorp/terraform-provider-aws/blob/main/internal/service/elbv2/hosted_zone_id_data_source.go

Relations

There is currently no issue for this. Should I open one?
Closes #36359.

References

https://docs.aws.amazon.com/apprunner/latest/dg/manage-custom-domains-route53.html
https://docs.aws.amazon.com/general/latest/gr/apprunner.html

Output from Acceptance Testing

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

Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added size/L Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/apprunner Issues and PRs that pertain to the apprunner service. generators Relates to code generators. labels Mar 10, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Mar 10, 2024
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 @mussinbenarbia 👋

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

@mussinbenarbia
Copy link
Author

Hello, this is my first contribution, please pardon any oversights. I read and tried to follow the raising a pull request guide and I have a couple of questions:

Implicit ID

The guide mentions:

Skips id Attribute: The id attribute is implicit for all Terraform resources and does not need to be defined in the schema.

Does this apply to this data source? I feel like the resource id the guide refers to, and the hosted zone ID this data source aims to provide are slightly different. Should the field have a different name? I tried following the existing https://github.com/hashicorp/terraform-provider-aws/blob/main/internal/service/elbv2/hosted_zone_id_data_source.go

Should I use SetID and Set()?

I just noticed the guide recommends using d.Set() and d.SetId(). Maybe related the question above but does d.SetId() apply to this use case?

I'll address any comments as soon as possible. Thank you!

@ewbankkit ewbankkit added new-data-source Introduces a new data source. and removed needs-triage Waiting for first response or review from a maintainer. labels Mar 11, 2024
@ewbankkit
Copy link
Contributor

@mussinbenarbia Thanks for the contribution 🎉 👏.
There is no need to a open an Issue for this.
Could you please add something to https://github.com/hashicorp/terraform-provider-aws/blob/main/docs/add-a-new-region.md#update-region-specific-values-in-static-data-sources for this new data source.

@mussinbenarbia
Copy link
Author

@ewbankkit Thank you for taking a look!

  1. Added an entry to the document as requested in 3c124a4
  2. Addressed this action failure in bec7cec
  3. Addressed this action failure in 7ff2cf7

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

@ewbankkit
Copy link
Contributor

@mussinbenarbia Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 0e38f28 into hashicorp:main Mar 11, 2024
45 of 46 checks passed
@github-actions github-actions bot added this to the v5.41.0 milestone Mar 11, 2024
Copy link

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

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 Apr 14, 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. generators Relates to code generators. new-data-source Introduces a new data source. service/apprunner Issues and PRs that pertain to the apprunner 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.

[New Data Source]: aws_apprunner_service.zone_id
2 participants