diff --git a/kubernetes/structure_service_spec.go b/kubernetes/structure_service_spec.go index e33c272116..aa2c18a6c7 100644 --- a/kubernetes/structure_service_spec.go +++ b/kubernetes/structure_service_spec.go @@ -56,6 +56,9 @@ func flattenServiceSpec(in v1.ServiceSpec) []interface{} { if in.ExternalName != "" { att["external_name"] = in.ExternalName } + if in.ExternalTrafficPolicy != "" { + att["external_traffic_policy"] = in.ExternalTrafficPolicy + } return []interface{}{att} } @@ -137,7 +140,7 @@ func expandServiceSpec(l []interface{}) v1.ServiceSpec { obj.ExternalName = v } if v, ok := in["external_traffic_policy"].(string); ok { - obj.ExternalName = v + obj.ExternalTrafficPolicy = v } return obj } @@ -200,5 +203,11 @@ func patchServiceSpec(keyPrefix, pathPrefix string, d *schema.ResourceData) Patc 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 }