Hi there,
Terraform v0.10.7
Please list the resources as a list, for example:
If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.
resource "kubernetes_secret" "regsecret" {
metadata {
name = "regsecret"
namespace = "${var.namespace}"
}
data {
docker-server = "${var.docker_server}"
docker-username = "${var.docker_username}"
docker-password = "${var.docker_password}"
docker-email = "${var.docker_email}"
}
type = "kubernetes.io/dockercfg"
}
create imagepullsecret
failed to create
Please list the steps required to reproduce the issue, for example:
terraform applyAre there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:
Any updates on this? I ran into the same issue.
Hi @shavo007 + @pycaster
As far as I know, secrets of type kubernetes.io/dockercfg can only contain a single data item named .dockercfg.
As documented - the kubectl tool is taking the individual docker auth params (server, user, email, password) and constructing the dockercfg json structure before submitting to the Kubernetes API as the value for the .dockercfg secret item.
I've used something like this in the past to create the image pull secrets structure:
locals {
dockercfg = {
"${var.docker_server}" = {
email = "${var.docker_email}"
username = "${var.docker_username}"
password = "${var.docker_password}"
}
}
}
resource "kubernetes_secret" "regsecret" {
metadata {
name = "regsecret"
}
data {
".dockercfg" = "${ jsonencode(local.dockercfg) }"
}
type = "kubernetes.io/dockercfg"
}
@sl1pm4t . Just the right recipe. Works great. Thanks.
@pycaster + @shavo007 can this issue be closed?
@sl1pm4t . Please do.
Haven't had a chance to test it out. If it works, all good.
its working.
Most helpful comment
Hi @shavo007 + @pycaster
As far as I know, secrets of type
kubernetes.io/dockercfgcan only contain a single data item named.dockercfg.As documented - the
kubectltool is taking the individual docker auth params (server, user, email, password) and constructing the dockercfg json structure before submitting to the Kubernetes API as the value for the.dockercfgsecret item.I've used something like this in the past to create the image pull secrets structure: