Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r/aws_appmesh_route: Add support for HTTP-header-based routing and route priorities #9964

Closed
wants to merge 10 commits into from
7 changes: 7 additions & 0 deletions aws/diff_suppress_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,10 @@ func suppressRoute53ZoneNameWithTrailingDot(k, old, new string, d *schema.Resour
}
return strings.TrimSuffix(old, ".") == strings.TrimSuffix(new, ".")
}

/*
// suppressStringsEqualFold suppresses any difference between two strings that are equal under Unicode case-folding.
func suppressStringsEqualFold(k, old, new string, d *schema.ResourceData) bool {
return strings.EqualFold(old, new)
}
*/
40 changes: 40 additions & 0 deletions aws/resource_aws_appmesh_mesh.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,43 @@ func resourceAwsAppmeshMeshDelete(d *schema.ResourceData, meta interface{}) erro

return nil
}

func expandAppmeshMeshSpec(vSpec []interface{}) *appmesh.MeshSpec {
spec := &appmesh.MeshSpec{}

if len(vSpec) == 0 || vSpec[0] == nil {
// Empty Spec is allowed.
return spec
}
mSpec := vSpec[0].(map[string]interface{})

if vEgressFilter, ok := mSpec["egress_filter"].([]interface{}); ok && len(vEgressFilter) > 0 && vEgressFilter[0] != nil {
mEgressFilter := vEgressFilter[0].(map[string]interface{})

if vType, ok := mEgressFilter["type"].(string); ok && vType != "" {
spec.EgressFilter = &appmesh.EgressFilter{
Type: aws.String(vType),
}
}
}

return spec
}

func flattenAppmeshMeshSpec(spec *appmesh.MeshSpec) []interface{} {
if spec == nil {
return []interface{}{}
}

mSpec := map[string]interface{}{}

if spec.EgressFilter != nil {
mSpec["egress_filter"] = []interface{}{
map[string]interface{}{
"type": aws.StringValue(spec.EgressFilter.Type),
},
}
}

return []interface{}{mSpec}
}
Loading