diff --git a/provisioner/template.go b/provisioner/template.go index 1699e332..727bce12 100644 --- a/provisioner/template.go +++ b/provisioner/template.go @@ -282,7 +282,8 @@ func list(args ...interface{}) []interface{} { } func eksID(id string) string { - return strings.Replace(id, ":", "--", -1) + parts := strings.Split(id, ":") + return parts[len(parts)-1] } // accountID returns just the ID part of an account diff --git a/provisioner/template_test.go b/provisioner/template_test.go index 334d3a66..f7d5fc74 100644 --- a/provisioner/template_test.go +++ b/provisioner/template_test.go @@ -284,7 +284,7 @@ func TestEKSID(t *testing.T) { `{{ eksID "aws:000000:eu-north-1:kube-1" }}`, "") require.NoError(t, err) - require.EqualValues(t, "aws--000000--eu-north-1--kube-1", result) + require.EqualValues(t, "kube-1", result) } func TestParsePortRanges(t *testing.T) {