Terraform, Provider, Kubernetes and Helm Versions
Terraform version: Terraform v1.9.5
Provider version: helm v3.0.2
Kubernetes version: Provider kubernetes v2.37.1/ cluster is on 1.31.9
Affected Resource(s)
Terraform Configuration Files
# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.
# Install cert-manager
# --------------------
###Resource
resource "helm_release" "cert_manager" {
name = "cert-manager"
repository = "oci://ouracr.azurecr.io/helm/oem/safe"
chart = "cert-manager"
version = "v1.15.3"
repository_username = "00000000-0000-0000-0000-000000000000"
repository_password = data.external.acr_token.result.accessToken
pass_credentials = false
namespace = var.system_namespace
set = [{
name = "image.tag"
value = "v1.15.3"
},
{
name = "image.repository"
value = "ouracr.azurecr.io/oem/clean/cert-manager-controller"
},
# This provides the ClusterIssuer and Certifikate kinds used in the k8s YAML
{
name = "crds.enabled"
value = "true"
},
# Before cert-manager passes the TXT DNS challenge off to letsencrypt, it first checks to ensure the TXT record exists.
# This is a problem because the default DNS is the Azure internal DNS (this is the assumed problem rather than a known
# problem)... because the TXT record *must* exist on the public entry for letsencrypt to see it, we need to override
# the default DNS to a public DNS service.
{
name = "extraArgs"
value = "{--dns01-recursive-nameservers-only,--dns01-recursive-nameservers=8.8.8.8:53\\,1.1.1.1:53}"
}]
depends_on = [azurerm_role_assignment.dns_zone_contributor_aks_mi]
lifecycle {
ignore_changes = [repository_password]
}
}
# Put in a 1 min sleep because otherwise cert-manager isn't ready in time for certificate creation
# ------------------------------------------------------------------------------------------------
resource "time_sleep" "cert_manager_postcreate" {
create_duration = "1m"
depends_on = [helm_release.cert_manager]
}
###Provider file excerpt
provider "helm" {
kubernetes = {
host = data.azurerm_kubernetes_cluster.aks.kube_config.0.host
username = data.azurerm_kubernetes_cluster.aks.kube_config.0.username
password = data.azurerm_kubernetes_cluster.aks.kube_config.0.password
client_key = base64decode(data.azurerm_kubernetes_cluster.aks.kube_admin_config.0.client_key)
client_certificate = base64decode(data.azurerm_kubernetes_cluster.aks.kube_admin_config.0.client_certificate)
cluster_ca_certificate = base64decode(data.azurerm_kubernetes_cluster.aks.kube_admin_config.0.cluster_ca_certificate)
}
registries = [
{
url = "oci://ouracr.azurecr.io"
username = "00000000-0000-0000-0000-000000000000"
password = data.external.acr_token.result.accessToken
}
]
}
Debug Output
NOTE: In addition to Terraform debugging, please set HELM_DEBUG=1 to enable debugging info from helm.
You can apply this plan to save these new output values to the Terraform state, without changing any real infrastructure.
╷
│ Error: OCI Registry Login Failed
│
│ with helm_release.cert_manager,
│ on helm.cert-manager.tf line 14, in resource "helm_release" "cert_manager":
│ 14: resource "helm_release" "cert_manager" {
│
│ Failed to log in to OCI registry "oci://ouracr.azurecr.io/helm/oem/safe": could not login to OCI registry "ouracr.azurecr.io": Get "https://ouracr.azurecr.io/v2/": unauthorized:
│ {"errors":[{"code":"UNAUTHORIZED","message":"authentication required, visit https://aka.ms/acr/authorization for more information. CorrelationId: 2ad5aab6-fb80-4ce4-8ec9-39f52e108e78"}]}
╵
╷
│ Error: OCI Registry Login Failed
│
│ with helm_release.sealed-secrets,
│ on helm.sealedsecrets.tf line 1, in resource "helm_release" "sealed-secrets":
│ 1: resource "helm_release" "sealed-secrets" {
│
│ Failed to log in to OCI registry "oci://ouracr.azurecr.io/helm/oem/safe": could not login to OCI registry "ouracr.azurecr.io": Get "https://ouracr.azurecr.io/v2/": unauthorized:
│ {"errors":[{"code":"UNAUTHORIZED","message":"authentication required, visit https://aka.ms/acr/authorization for more information. CorrelationId: 9a6f2a50-f990-454c-9755-1e40f1ce25a2"}]}
Panic Output
Steps to Reproduce
terraform apply --var-file=ourvars.common.tfvars
Expected Behavior
Plan with 2 resources to change
Actual Behavior
│ Error: OCI Registry Login Failed
│
│ with helm_release.cert_manager,
│ on helm.cert-manager.tf line 14, in resource "helm_release" "cert_manager":
│ 14: resource "helm_release" "cert_manager" {
│
│ Failed to log in to OCI registry "oci://ouracr.azurecr.io/helm/oem/safe": could not login to OCI registry "ouracr.azurecr.io": Get "https://ouracr.azurecr.io/v2/": unauthorized:
│ {"errors":[{"code":"UNAUTHORIZED","message":"authentication required, visit https://aka.ms/acr/authorization for more information. CorrelationId: 2ad5aab6-fb80-4ce4-8ec9-39f52e108e78"}]}
╵
╷
│ Error: OCI Registry Login Failed
│
│ with helm_release.sealed-secrets,
│ on helm.sealedsecrets.tf line 1, in resource "helm_release" "sealed-secrets":
│ 1: resource "helm_release" "sealed-secrets" {
│
│ Failed to log in to OCI registry "oci://ouracr.azurecr.io/helm/oem/safe": could not login to OCI registry "ouracr.azurecr.io": Get "https://ouracr.azurecr.io/v2/": unauthorized:
│ {"errors":[{"code":"UNAUTHORIZED","message":"authentication required, visit https://aka.ms/acr/authorization for more information. CorrelationId: 9a6f2a50-f990-454c-9755-1e40f1ce25a2"}]}
Important Factoids
Important to note that if I comment out the registries block, it fails at plan. If I uncomment it, and I comment out registry_username and registry_password, it plans as expected but when I apply it throws the exact same error as seen above.
I have tried the Get "https://ouracr.azurecr.io/v2/" via postman using the exact token we have and I see a clean response. When I try without the token I get the exact error thrown above, please see below screenshots
With

Without

References
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
Terraform, Provider, Kubernetes and Helm Versions
Affected Resource(s)
Terraform Configuration Files
Debug Output
NOTE: In addition to Terraform debugging, please set HELM_DEBUG=1 to enable debugging info from helm.
You can apply this plan to save these new output values to the Terraform state, without changing any real infrastructure.
╷
│ Error: OCI Registry Login Failed
│
│ with helm_release.cert_manager,
│ on helm.cert-manager.tf line 14, in resource "helm_release" "cert_manager":
│ 14: resource "helm_release" "cert_manager" {
│
│ Failed to log in to OCI registry "oci://ouracr.azurecr.io/helm/oem/safe": could not login to OCI registry "ouracr.azurecr.io": Get "https://ouracr.azurecr.io/v2/": unauthorized:
│ {"errors":[{"code":"UNAUTHORIZED","message":"authentication required, visit https://aka.ms/acr/authorization for more information. CorrelationId: 2ad5aab6-fb80-4ce4-8ec9-39f52e108e78"}]}
╵
╷
│ Error: OCI Registry Login Failed
│
│ with helm_release.sealed-secrets,
│ on helm.sealedsecrets.tf line 1, in resource "helm_release" "sealed-secrets":
│ 1: resource "helm_release" "sealed-secrets" {
│
│ Failed to log in to OCI registry "oci://ouracr.azurecr.io/helm/oem/safe": could not login to OCI registry "ouracr.azurecr.io": Get "https://ouracr.azurecr.io/v2/": unauthorized:
│ {"errors":[{"code":"UNAUTHORIZED","message":"authentication required, visit https://aka.ms/acr/authorization for more information. CorrelationId: 9a6f2a50-f990-454c-9755-1e40f1ce25a2"}]}
Panic Output
Steps to Reproduce
terraform apply --var-file=ourvars.common.tfvarsExpected Behavior
Plan with 2 resources to change
Actual Behavior
│ Error: OCI Registry Login Failed
│
│ with helm_release.cert_manager,
│ on helm.cert-manager.tf line 14, in resource "helm_release" "cert_manager":
│ 14: resource "helm_release" "cert_manager" {
│
│ Failed to log in to OCI registry "oci://ouracr.azurecr.io/helm/oem/safe": could not login to OCI registry "ouracr.azurecr.io": Get "https://ouracr.azurecr.io/v2/": unauthorized:
│ {"errors":[{"code":"UNAUTHORIZED","message":"authentication required, visit https://aka.ms/acr/authorization for more information. CorrelationId: 2ad5aab6-fb80-4ce4-8ec9-39f52e108e78"}]}
╵
╷
│ Error: OCI Registry Login Failed
│
│ with helm_release.sealed-secrets,
│ on helm.sealedsecrets.tf line 1, in resource "helm_release" "sealed-secrets":
│ 1: resource "helm_release" "sealed-secrets" {
│
│ Failed to log in to OCI registry "oci://ouracr.azurecr.io/helm/oem/safe": could not login to OCI registry "ouracr.azurecr.io": Get "https://ouracr.azurecr.io/v2/": unauthorized:
│ {"errors":[{"code":"UNAUTHORIZED","message":"authentication required, visit https://aka.ms/acr/authorization for more information. CorrelationId: 9a6f2a50-f990-454c-9755-1e40f1ce25a2"}]}
Important Factoids
Important to note that if I comment out the registries block, it fails at plan. If I uncomment it, and I comment out registry_username and registry_password, it plans as expected but when I apply it throws the exact same error as seen above.
I have tried the Get "https://ouracr.azurecr.io/v2/" via postman using the exact token we have and I see a clean response. When I try without the token I get the exact error thrown above, please see below screenshots
With
Without
References
Community Note