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

Commit

Permalink
Merge pull request #174 from ulucinar/cp0.4-fix-168
Browse files Browse the repository at this point in the history
[Backport release-0.4] Fix ecs.Cluster external name configuration
  • Loading branch information
ulucinar authored Mar 17, 2022
2 parents c8a1b16 + 7fc17a4 commit 029a0fa
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 029a0fa

Please sign in to comment.