diff --git a/kubernetes/structure_service_spec.go b/kubernetes/structure_service_spec.go index 2e61fbd4f8..e6a438faa3 100644 --- a/kubernetes/structure_service_spec.go +++ b/kubernetes/structure_service_spec.go @@ -58,6 +58,9 @@ func flattenServiceSpec(in v1.ServiceSpec) []interface{} { if in.ExternalName != "" { att["external_name"] = in.ExternalName } + if in.ExternalTrafficPolicy != "" { + att["external_traffic_policy"] = string(in.ExternalTrafficPolicy) + } return []interface{}{att} } @@ -139,7 +142,7 @@ func expandServiceSpec(l []interface{}) v1.ServiceSpec { obj.ExternalName = v } if v, ok := in["external_traffic_policy"].(string); ok { - obj.ExternalName = v + obj.ExternalTrafficPolicy = v1.ServiceExternalTrafficPolicyType(v) } return obj } @@ -209,5 +212,11 @@ func patchServiceSpec(keyPrefix, pathPrefix string, d *schema.ResourceData, v *v Value: d.Get(keyPrefix + "external_name").(string), }) } + if d.HasChange(keyPrefix + "external_traffic_policy") { + ops = append(ops, &ReplaceOperation{ + Path: pathPrefix + "externalTrafficPolicy", + Value: d.Get(keyPrefix + "external_traffic_policy").(string), + }) + } return ops, nil }