<p>I have an image to pull from a private registry. I did all the configs and added the secret to the pod config under pod.spec.image_pull_secrets. But I am getting an error like</p>
<p>An argument named &quot;image_pull_secrets&quot; is not expected here. Did you mean to define a block of type &quot;image_pull_secrets&quot;?</p>
<p>As per documentation this should be ok.
<a href="https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/pod#nested-blocks" rel="nofollow noreferrer">https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/pod#nested-blocks</a></p>
<pre><code>resource &quot;kubernetes_pod&quot; &quot;main&quot; {
  count = data.coder_workspace.me.start_count
  metadata {
    name = &quot;coder-${lower(data.coder_workspace.me.owner)}-${lower(data.coder_workspace.me.name)}&quot;
    namespace = var.workspaces_namespace
  }
  spec {
      image_pull_secrets = {
       name = [&quot;coder-ocir-secret&quot;]
      }   
     security_context {
    #   run_as_user = &quot;1000&quot;
       fs_group    = &quot;1000&quot;

     }


     init_container {
       name    = &quot;init-eclipse&quot;
       image   = &quot;busybox:latest&quot;      
       command = [ &quot;chown&quot;,&quot;-R&quot;,&quot;1000:1000&quot;,&quot;/data&quot;]

          security_context {
        run_as_user = &quot;0&quot;
        privileged = &quot;true&quot;
        allow_privilege_escalation = &quot;true&quot;
        read_only_root_filesystem = &quot;false&quot;
        run_as_non_root = &quot;false&quot;
        capabilities {
          add = [&quot;CAP_SYS_ADMIN&quot;,&quot;CHOWN&quot;,
                 &quot;FOWNER&quot;,
                  &quot;DAC_OVERRIDE&quot;]
     
        drop = [
      &quot;ALL&quot;]
        }
      }
       volume_mount {
         mount_path = &quot;/data&quot;
         name       = &quot;home-coder-vol-${data.coder_workspace.me.owner}-${lower(data.coder_workspace.me.name)}&quot;
       } 

    }    
    container {
      name    = &quot;eclipse&quot;
      image   = &quot;docker.io/manumaan/eclipsevncv2.2:latest&quot;
      command = [&quot;sh&quot;, &quot;-c&quot;, coder_agent.coder.init_script]
      image_pull_policy = &quot;Always&quot;
      security_context {
        run_as_user = &quot;1000&quot;
        # fs_group    = &quot;1000&quot;
      }
      env {
        name  = &quot;CODER_AGENT_TOKEN&quot;
        value = coder_agent.coder.token
      }
      resources {
        requests = {
          cpu    = &quot;${var.cpu}&quot;
          memory = &quot;${var.memory}G&quot;
          ephemeral-storage = &quot;2Gi&quot;
        }        
        limits = {
          cpu    = &quot;${var.cpu}&quot;
          memory = &quot;${var.memory}G&quot;
          ephemeral-storage = &quot;4Gi&quot;
        }
      }    
                
      volume_mount {
        mount_path = &quot;/home/coder&quot;
        name       = &quot;home-coder-vol-${data.coder_workspace.me.owner}-${lower(data.coder_workspace.me.name)}&quot;
      }        
    }
</code></pre>
<p>I also tried giving it inside container, after all containers etc inside spec but it does not accept it.I am going crazy!</p>
<p>Also made it not a list: No difference.</p>
<pre><code>  image_pull_secrets = {
   name = &quot;coder-ocir-secret&quot;
  } 
</code></pre>

manu muraleedharan
<p>This might be caused by a typo, <code>image_pull_secrets</code> is a block, so you don't need the <code>=</code>, neither the square brackets (<code>[]</code>) here:</p>
<pre><code>  image_pull_secrets = {
   name = [&quot;coder-ocir-secret&quot;]
  } 
</code></pre>
<p>It should be instead:</p>
<pre><code>image_pull_secrets {
  name = &quot;coder-ocir-secret&quot;
}
</code></pre>
<p>If you need to define multiple pull_secrets you can define multiple ones, or use <a href="https://developer.hashicorp.com/terraform/language/expressions/dynamic-blocks" rel="nofollow noreferrer"><code>dynamic blocks</code></a></p>
