Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Fix ecs.Cluster external name configuration
Browse files Browse the repository at this point in the history
Signed-off-by: Alper Rifat Ulucinar <[email protected]>
(cherry picked from commit 9079649)
  • Loading branch information
ulucinar committed Mar 17, 2022
1 parent c8a1b16 commit 7fc17a4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions config/ecs/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ func Configure(p *config.Provider) {
p.AddResourceConfigurator("aws_ecs_cluster", func(r *config.Resource) {
r.Version = common.VersionV1Alpha2
r.ExternalName = config.NameAsIdentifier
r.ExternalName.GetExternalNameFn = func(tfstate map[string]interface{}) (string, error) {
// expected id format: arn:aws:ecs:us-west-2:123456789123:cluster/example-cluster
w := strings.Split(tfstate["id"].(string), "/")
if len(w) != 2 {
return "", errors.New("terraform ID should be the ARN of the cluster")
}
return w[len(w)-1], nil
}
r.References = config.References{
"capacity_providers": config.Reference{
Type: "CapacityProvider",
Expand Down

0 comments on commit 7fc17a4

Please sign in to comment.