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

Implement credential_arn for ecr pull cache through rules #34475

Merged
merged 17 commits into from
Feb 14, 2024

Conversation

Baachi
Copy link
Contributor

@Baachi Baachi commented Nov 20, 2023

Description

As mentioned in #34466, AWS released the support for authenticated docker registries in ECR. This MR adds the new credentialArn to the terraform datasource and resource.

Relations

Closes #34466

References

https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_CreatePullThroughCacheRule.html
https://docs.aws.amazon.com/AmazonECR/latest/userguide/pull-through-cache-creating-rule.html

Output from Acceptance Testing

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


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

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/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/ecr Issues and PRs that pertain to the ecr service. labels Nov 20, 2023
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Nov 20, 2023
Copy link

Thank you for your contribution! 🚀

Please note that typically Go dependency changes are handled in this repository by dependabot or the maintainers. This is to prevent pull request merge conflicts and further delay reviews of contributions. Remove any changes to the go.mod or go.sum files and commit them into this pull request.

Additional details:

  • Check open pull requests with the dependencies label to view other dependency updates.
  • If this pull request includes an update the AWS Go SDK (or any other dependency) version, only updates submitted via dependabot will be merged. This pull request will need to remove these changes and will need to be rebased after the existing dependency update via dependabot has been merged for this pull request to be reviewed.
  • If this pull request is for supporting a new AWS service:
    • Ensure the new AWS service changes are following the Contributing Guide section on new services, in particular that the dependency addition and initial provider support are in a separate pull request from other changes (e.g. new resources). Contributions not following this item will not be reviewed until the changes are split.
    • If this pull request is already a separate pull request from the above item, you can ignore this message.

@Baachi Baachi force-pushed the feature/ecr-pull-through-credentials branch from 24627ca to 16498fb Compare November 20, 2023 13:11
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 @Baachi 👋

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

@Baachi Baachi force-pushed the feature/ecr-pull-through-credentials branch from 16498fb to 5725d87 Compare November 21, 2023 11:09
@Baachi Baachi changed the title [WIP] Implement credential_arn for ecr pull cache through rules Implement credential_arn for ecr pull cache through rules Nov 21, 2023
@Baachi
Copy link
Contributor Author

Baachi commented Nov 21, 2023

MR is ready for review!

@justinretzolk justinretzolk added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Dec 6, 2023
@AdamTylerLynch
Copy link
Collaborator

Related: #34716

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.

This is a wonderful PR! Thank you so much for your contribution! I'm requesting a few small additions (documentation for the resource and datasource) and some small linting modifications.

Please include documentation updates:

  1. /website/docs/r/ecr_pull_through_cache_rule.html.markdown
  2. /website/docs/d/ecr_pull_through_cache_rule.html.markdown

@Baachi Baachi force-pushed the feature/ecr-pull-through-credentials branch 2 times, most recently from 4cdb36a to ca733e1 Compare December 11, 2023 20:56
@Baachi
Copy link
Contributor Author

Baachi commented Dec 11, 2023

Hey @AdamTylerLynch ,

thanks for the review! I fixed all your comments (or I hope at least.) 😁

@Baachi
Copy link
Contributor Author

Baachi commented Dec 15, 2023

Any updates here?

@blakepettersson
Copy link

@Baachi seems like that there are some merge conflicts now

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.

Last requested change

internal/service/ecr/pull_through_cache_rule.go Outdated Show resolved Hide resolved
@Baachi Baachi force-pushed the feature/ecr-pull-through-credentials branch from ebf44a4 to 2995756 Compare January 3, 2024 12:23
@Baachi
Copy link
Contributor Author

Baachi commented Jan 4, 2024

@AdamTylerLynch fixed your comment and rebased against master :)

@sharovmerk
Copy link

btw. don't you know, if it possible to create aws_ecr_pull_through_cache_rule for dockerhub without credentials?

@kvendingoldo
Copy link
Contributor

btw. can you add an example of secret_string for aws_secretsmanager_secret_version?

@eugenetaranov
Copy link

btw. don't you know, if it possible to create aws_ecr_pull_through_cache_rule for dockerhub without credentials?

afaik no, dockerhub now requires everyone to be authenticated

@kvendingoldo
Copy link
Contributor

kvendingoldo commented Jan 29, 2024

afaik no, dockerhub now requires everyone to be authenticated

Yep, I have already checked docs. It's a little bit painful that I users can't use proxy without auth for public repositories.

@sharovmerk
Copy link

@ewbankkit can you check the PR, pls? It's really important feature for the production.

@ben-bertrands-hs
Copy link

@Baachi I think you're good to merge this in

@ben-bertrands-hs
Copy link

@honarkhah can you help merge this in?

@Baachi
Copy link
Contributor Author

Baachi commented Feb 14, 2024

Im not a maintainer, so I can't merge it :)

@ben-bertrands-hs
Copy link

Im not a maintainer, so I can't merge it :)

Yeah sorry, I was a bit to quick commenting there 😅

@ewbankkit ewbankkit self-assigned this Feb 14, 2024
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=TestAccECRPullThroughCacheRuleDataSource_\|TestAccECRPullThroughCacheRule_' PKG=ecr ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ecr/... -v -count 1 -parallel 3  -run=TestAccECRPullThroughCacheRuleDataSource_\|TestAccECRPullThroughCacheRule_ -timeout 360m
=== RUN   TestAccECRPullThroughCacheRuleDataSource_basic
=== PAUSE TestAccECRPullThroughCacheRuleDataSource_basic
=== RUN   TestAccECRPullThroughCacheRuleDataSource_repositoryPrefixWithSlash
=== PAUSE TestAccECRPullThroughCacheRuleDataSource_repositoryPrefixWithSlash
=== RUN   TestAccECRPullThroughCacheRuleDataSource_credential
=== PAUSE TestAccECRPullThroughCacheRuleDataSource_credential
=== RUN   TestAccECRPullThroughCacheRule_basic
=== PAUSE TestAccECRPullThroughCacheRule_basic
=== RUN   TestAccECRPullThroughCacheRule_credentialARN
=== PAUSE TestAccECRPullThroughCacheRule_credentialARN
=== RUN   TestAccECRPullThroughCacheRule_disappears
=== PAUSE TestAccECRPullThroughCacheRule_disappears
=== RUN   TestAccECRPullThroughCacheRule_failWhenAlreadyExists
=== PAUSE TestAccECRPullThroughCacheRule_failWhenAlreadyExists
=== RUN   TestAccECRPullThroughCacheRule_repositoryPrefixWithSlash
=== PAUSE TestAccECRPullThroughCacheRule_repositoryPrefixWithSlash
=== CONT  TestAccECRPullThroughCacheRuleDataSource_basic
=== CONT  TestAccECRPullThroughCacheRule_credentialARN
=== CONT  TestAccECRPullThroughCacheRule_failWhenAlreadyExists
--- PASS: TestAccECRPullThroughCacheRule_failWhenAlreadyExists (25.43s)
=== CONT  TestAccECRPullThroughCacheRuleDataSource_credential
--- PASS: TestAccECRPullThroughCacheRuleDataSource_basic (36.58s)
=== CONT  TestAccECRPullThroughCacheRule_basic
--- PASS: TestAccECRPullThroughCacheRule_credentialARN (41.44s)
=== CONT  TestAccECRPullThroughCacheRuleDataSource_repositoryPrefixWithSlash
--- PASS: TestAccECRPullThroughCacheRuleDataSource_credential (23.19s)
=== CONT  TestAccECRPullThroughCacheRule_disappears
--- PASS: TestAccECRPullThroughCacheRule_basic (21.31s)
=== CONT  TestAccECRPullThroughCacheRule_repositoryPrefixWithSlash
--- PASS: TestAccECRPullThroughCacheRuleDataSource_repositoryPrefixWithSlash (17.94s)
--- PASS: TestAccECRPullThroughCacheRule_disappears (17.97s)
--- PASS: TestAccECRPullThroughCacheRule_repositoryPrefixWithSlash (16.18s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ecr	85.729s

@terraform-aws-provider terraform-aws-provider bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Feb 14, 2024
@ewbankkit
Copy link
Contributor

@Baachi Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit aa44dc4 into hashicorp:main Feb 14, 2024
62 checks passed
@github-actions github-actions bot added this to the v5.37.0 milestone Feb 14, 2024
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Feb 15, 2024
Copy link

This functionality has been released in v5.37.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 Mar 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ecr Issues and PRs that pertain to the ecr service. size/M 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.

[Enhancement]: aws_ecr_pull_through_cache_rule support CredentialArn and UpstreamRegistry