Skip to content

Commit

Permalink
Update/add references to ExternalTrafficPolicy in structure_service_spec
Browse files Browse the repository at this point in the history
  • Loading branch information
phamann committed Apr 3, 2018
1 parent 229245b commit f169008
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion kubernetes/structure_service_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}

Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}

0 comments on commit f169008

Please sign in to comment.