alekc / terraform-provider-kubectl

Mozilla Public License 2.0
179 stars 9 forks source link

Extend wait_for with optional condition blocks #157

Closed jkabonickAtOlo closed 2 months ago

jkabonickAtOlo commented 3 months ago

Addresses #155.

Can be used as below, with or without the existing field block.

resource "kubectl_manifest" "test" {
    wait_for {
        condition {
            type = "ContainersReady"
            status = "True"
        }
        condition {
            type = "Ready"
            status = "True"
        }
        field {
            key = "status.containerStatuses.[0].ready"
            value = "true"
        }
        field {
            key = "status.phase"
            value = "Running"
        }
        field {
            key = "status.podIP"
            value = "^(\\d+(\\.|$)){4}"
            value_type = "regex"
        }
    }
    yaml_body = <<YAML
apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
  - name: nginx
    image: nginx:1.14.2
    readinessProbe:
      httpGet:
        path: "/"
        port: 80            
      initialDelaySeconds: 10
YAML
}
alekc commented 3 months ago

Thanks for your contribution. I will review it as soon as possible 👍

alekc commented 2 months ago

@jkabonickAtOlo sorry it took so long. I have just one minor remark, and then it should be good to go.

stevehipwell commented 2 months ago

@jkabonickAtOlo I think you're missing the README updates for this new functionality?