# Terraform — kubernetes_deployment resource
resource "kubernetes_deployment" "app" {
  metadata {
    name      = "my-app"
    namespace = "production"
    labels = {
      app = "my-app"
    }
  }
  spec {
    replicas = 3
    selector {
      match_labels = {
        app = "my-app"
      }
    }
    template {
      metadata {
        labels = {
          app = "my-app"
        }
      }
      spec {
        container {
          name  = "my-app"
          image = "myapp:1.0.0"
          port {
            container_port = 8080
          }
          resources {
            limits = {
              cpu    = "0.5"
              memory = "512Mi"
            }
            requests = {
              cpu    = "250m"
              memory = "50Mi"
            }
          }
        }
      }
    }
  }
}