<p>I would like to deploy an application and the pod should not go to running status(it should be non-operational). User might trigger this when it really requires using Infrastructure as Code (Terraform). I am aware of using <code>kubectl scale -- replicas=0 </code>. Any other leads or info will be well appreciated.</p>

iamniki
<p>You can keep the replica count to <strong>zero</strong> for the <strong>Deployment</strong> or <strong>POD</strong> into your <strong>YAML</strong> file if you are using it.</p>
<p>Or if you are using the <strong>Terraform</strong></p>
<pre><code>resource &quot;kubernetes_deployment&quot; &quot;example&quot; {
  metadata {
    name = &quot;terraform-example&quot;
    labels = {
      test = &quot;MyExampleApp&quot;
    }
  }

  spec {
    replicas = 0

    selector {
      match_labels = {
        test = &quot;MyExampleApp&quot;
      }
    }

    template {
      metadata {
        labels = {
          test = &quot;MyExampleApp&quot;
        }
      }

      spec {
        container {
          image = &quot;nginx:1.7.8&quot;
          name  = &quot;example&quot;

          resources {
            limits = {
              cpu    = &quot;0.5&quot;
              memory = &quot;512Mi&quot;
            }
            requests = {
              cpu    = &quot;250m&quot;
              memory = &quot;50Mi&quot;
            }
          }

          liveness_probe {
            http_get {
              path = &quot;/nginx_status&quot;
              port = 80

              http_header {
                name  = &quot;X-Custom-Header&quot;
                value = &quot;Awesome&quot;
              }
            }

            initial_delay_seconds = 3
            period_seconds        = 3
          }
        }
      }
    }
  }
}
</code></pre>
<p>There is no other way around you can use the <a href="https://kubernetes.io/docs/reference/using-api/client-libraries/" rel="nofollow noreferrer">client</a> of Kubernetes to do this if don't want to use the Terraform.</p>
<p>If you want to edit the local file using the terraform checkout <strong>local-exec</strong></p>
<blockquote>
<p>This invokes a process on the machine running Terraform, not on the
resource.</p>
</blockquote>
<pre><code>resource &quot;aws_instance&quot; &quot;web&quot; {
  # ...

  provisioner &quot;local-exec&quot; {
    command = &quot;echo ${self.private_ip} &gt;&gt; private_ips.txt&quot;
  }
}
</code></pre>
<p>using <strong>sed</strong> command in <strong>local-exec</strong> or any other command you can update the YAML and apply it.</p>
<p><a href="https://www.terraform.io/docs/language/resources/provisioners/local-exec.html" rel="nofollow noreferrer">https://www.terraform.io/docs/language/resources/provisioners/local-exec.html</a></p>
