diff --git a/.changelog/2449.txt b/.changelog/2449.txt new file mode 100644 index 0000000000..5da09138a0 --- /dev/null +++ b/.changelog/2449.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +`kubernetes/schema_container.go`: add support of `restart_policy` option for sidecar init containers +``` \ No newline at end of file diff --git a/kubernetes/schema_container.go b/kubernetes/schema_container.go index 9d1cdedeb1..d8ae120329 100644 --- a/kubernetes/schema_container.go +++ b/kubernetes/schema_container.go @@ -587,6 +587,19 @@ func containerFields(isUpdatable bool) map[string]*schema.Schema { Schema: resourcesFieldV1(isUpdatable), }, }, + "restart_policy": { + Type: schema.TypeString, + Optional: true, + Computed: isComputed, + ForceNew: !isUpdatable, + Default: conditionalDefault(!isComputed, string(corev1.RestartPolicyAlways)), + Description: "Restart policy for init container. One of Always, OnFailure, Never. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy.", + ValidateFunc: validation.StringInSlice([]string{ + string(corev1.RestartPolicyAlways), + string(corev1.RestartPolicyOnFailure), + string(corev1.RestartPolicyNever), + }, false), + }, "security_context": { Type: schema.TypeList, Optional: true,