Skip to content

Fix repository authentication when updating a helm_release with temporary credentials - #1687

Open
kevinfrommelt wants to merge 5 commits into
hashicorp:mainfrom
kevinfrommelt:fix-repo-auth
Open

Fix repository authentication when updating a helm_release with temporary credentials#1687
kevinfrommelt wants to merge 5 commits into
hashicorp:mainfrom
kevinfrommelt:fix-repo-auth

Conversation

@kevinfrommelt

@kevinfrommelt kevinfrommelt commented Jul 31, 2025

Copy link
Copy Markdown

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the library.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

No

Description

Repository login currently fails during updates when using temporary credentials because the credentials are being pulled from the state rather than from the current plan.

│ Error: OCI Registry Login Failed
│ 
│   with helm_release.karpenter,
│   on main.tf line 325, in resource "helm_release" "karpenter":
│  325: resource "helm_release" "karpenter" {
│ 
│ Failed to log in to OCI registry "oci://public.ecr.aws/karpenter": could
│ not login to OCI registry "public.ecr.aws": login attempt to
│ https://public.ecr.aws/v2/ failed with status: 403 Forbidden

This PR changes Update() to use the credentials from the plan model instead of the state model.

Acceptance tests

  • Have you added an acceptance test for the functionality being added?

Release Note

Release note for CHANGELOG:

Fixed repository authentication when updating a helm_release and using temporary credentials

References

Fixes #1660

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

@kevinfrommelt
kevinfrommelt requested a review from a team as a code owner July 31, 2025 14:42
@hashicorp-cla-app

hashicorp-cla-app Bot commented Jul 31, 2025

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@hashicorp-cla-app

Copy link
Copy Markdown

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

Comment on lines -739 to +740
var state HelmReleaseModel
diags := req.Plan.Get(ctx, &state)
var plan HelmReleaseModel
diags := req.Plan.Get(ctx, &plan)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I renamed this variable to plan for clarity, since it is using the plan model.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Just wondering this is going to change the credentials to be used from the plan and removes it from the state? I assume this is the issue many people are having now where credentials are being saved in state and ephemeral tokens are timing out causing failures?

@kevinfrommelt kevinfrommelt Aug 14, 2025

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The issue is actually at the bottom of the diff in the Update() function. It's getting the login credentials from the previously applied state, rather than using the currently fetched credentials.

https://github.com/hashicorp/terraform-provider-helm/pull/1687/files#diff-c548ca21c915d6a4918945eb9741a292966d795ca0a4e9e6dfa4f8c8106f5691L1069-R1069

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Ah I see it now, thank you for the clarification. Appreciate you submitting this!

@kevinfrommelt kevinfrommelt changed the title Fix repository authentication when updating a helm_release Fix repository authentication when updating a helm_release with temporary credentials Jul 31, 2025
@sylr

sylr commented Aug 4, 2025

Copy link
Copy Markdown

I've built and tested this locally successfully. It resolved the problem I've been having with public.ecr.aws.

@jrhouston could you please review this and have it part of a patch release soon ? Thank you.

@sylr

sylr commented Oct 2, 2025

Copy link
Copy Markdown

Ping @jrhouston @jaylonmcshan19-x

@akorp

akorp commented Oct 7, 2025

Copy link
Copy Markdown

Can this pls be prioritized 🙏. This been an issue for few months now and affecting meny people #1660. Everyone does manual delete/import as an workaround for helm modules on expired secrets.

@veronikaBu

Copy link
Copy Markdown

Hey, any updates here?

@agusl88

agusl88 commented Nov 7, 2025

Copy link
Copy Markdown

any update from the maintainers? this bug has been going for months and it affects a core functionality of the provider

@MotwaniM

Copy link
Copy Markdown

@jrhouston Hi, could you look into this PR? It's blocking a migration to the latest version of this provider.

return
}
ociDiags := OCIRegistryLogin(ctx, meta, actionConfig, meta.RegistryClient, state.Repository.ValueString(), state.Chart.ValueString(), state.RepositoryUsername.ValueString(), state.RepositoryPassword.ValueString())
ociDiags := OCIRegistryLogin(ctx, meta, actionConfig, meta.RegistryClient, plan.Repository.ValueString(), plan.Chart.ValueString(), plan.RepositoryUsername.ValueString(), plan.RepositoryPassword.ValueString())

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Use the credentials provided in the plan instead of the state. Users may have provided new credentials, especially when using temporary credentials that have a short expiration.

@veronikaBu

Copy link
Copy Markdown

Any updates? It causes many issues

@Amansethi967

Copy link
Copy Markdown

@jrhouston Hi, could you look into this PR? It's blocking us for a long time.

@veronikaBu

Copy link
Copy Markdown

Hi, any updates here?

@vebu42

vebu42 commented Apr 9, 2026

Copy link
Copy Markdown

Can this pls be prioritized?

@dylanmtaylor

Copy link
Copy Markdown

This is breaking my helm deployments from my ECR repository. Can we get a maintainer to review this or a workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OCI Registry login failure since 3.0.0

10 participants