_This issue was originally opened by @martinisoft as hashicorp/terraform#26610. It was migrated here as a result of the provider split. The original body of the issue is below._
Terraform v0.13.4
+ provider registry.terraform.io/digitalocean/digitalocean v1.23.0
+ provider registry.terraform.io/hashicorp/helm v1.3.2
+ provider registry.terraform.io/hashicorp/kubernetes v1.13.2
+ provider registry.terraform.io/hashicorp/local v1.4.0
resource "kubernetes_secret" "frontend" {
metadata {
name = "db-password"
labels = {
app = "ecommerce"
service = "db"
}
}
data = {
pw = "password"
}
type = "Opaque"
}
resource "kubernetes_deployment" "frontend" {
metadata {
name = "frontend"
labels = {
service = "frontend"
app = "ecommerce"
}
}
spec {
replicas = 1
selector {
match_labels = {
service = "frontend"
app = "ecommerce"
}
}
strategy {
type = "RollingUpdate"
rolling_update {
max_surge = "25%"
max_unavailable = "25%"
}
}
template {
metadata {
labels = {
service = "frontend"
app = "ecommerce"
}
}
spec {
container {
name = "ecommerce-spree-observability"
image = "ddtraining/ecommerce-frontend:latest"
image_pull_policy = "Always"
port {
container_port = 3000
protocol = "TCP"
}
resources {
requests {
cpu = "100m"
memory = "100Mi"
}
limits {}
}
args = ["docker-entrypoint.sh"]
command = ["sh"]
env {
name = "DB_USERNAME"
value = "user"
}
env {
name = "DB_PASSWORD"
value_from {
secret_key_ref {
key = "pw"
name = "db-password"
}
}
}
env {
name = "DD_AGENT_HOST"
value_from {
field_ref {
field_path = "status.hostIP"
}
}
}
env {
name = "DD_LOGS_INJECTION"
value = "true"
}
env {
name = "DD_ANALYTICS_ENABLED"
value = "true"
}
}
}
}
}
}
resource "kubernetes_service" "frontend" {
metadata {
name = "frontend"
labels = {
service = "frontend"
app = "ecommerce"
}
}
spec {
selector = {
app = "ecommerce"
service = "frontend"
}
port {
port = 3000
target_port = 3000
protocol = "TCP"
}
type = "LoadBalancer"
}
}
resource "kubernetes_ingress" "frontend" {
metadata {
name = "basic-ingress"
}
spec {
backend {
service_name = "frontend"
service_port = 3000
}
}
}
https://gist.github.com/martinisoft/646e5b312717047457313dc63ce1720c
https://gist.github.com/martinisoft/646e5b312717047457313dc63ce1720c
I should have seen it apply the resource modifications to my kubernetes cluster
A crash shortly in the middle of the apply
terraform apply --auto-approveThis is an existing kubernetes cluster with these resources previously deployed, then modifying their deployment type via HCL and using terraform apply.
None
@martinisoft thanks for this report! I'm going to see if I can reproduce it and work on a fix asap.
Awesome thanks @dak1n1
I was able to reproduce the crash by taking a Deployment example I had locally and passing an empty limits{} block (similar to the example given in this issue).
A work-around for this issue is to completely omit the limits{} or specify some kind of value there. Let me know if that doesn't work and we can try something else.
Thanks for looking into this @dak1n1. I also ran into this when looking for workarounds for https://github.com/hashicorp/terraform-provider-kubernetes/issues/754
Most helpful comment
@martinisoft thanks for this report! I'm going to see if I can reproduce it and work on a fix asap.