diff --git a/config/ecs/config.go b/config/ecs/config.go index ba3ac6f73..409eae382 100644 --- a/config/ecs/config.go +++ b/config/ecs/config.go @@ -50,10 +50,10 @@ func Configure(p *config.Provider) { r.Version = common.VersionV1Alpha2 r.ExternalName = config.NameAsIdentifier r.ExternalName.GetExternalNameFn = func(tfstate map[string]interface{}) (string, error) { - // cluster-name/service-name + // expected id format: arn:aws:ecs:us-east-2:123456789123:service/hasan-test/sample-service-by-hasan w := strings.Split(tfstate["id"].(string), "/") - if len(w) != 2 { - return "", errors.New("external name should have the following format: cluster-name/service-name") + if len(w) != 3 { + return "", errors.New("terraform ID should be the ARN of the cluster") } return w[len(w)-1], nil } diff --git a/examples/ecs/service.yaml b/examples/ecs/service.yaml new file mode 100644 index 000000000..0bdeda5a4 --- /dev/null +++ b/examples/ecs/service.yaml @@ -0,0 +1,10 @@ +apiVersion: ecs.aws.jet.crossplane.io/v1alpha2 +kind: Service +metadata: + name: sample-service +spec: + forProvider: + taskDefinition: sample-task:1 + cluster: sample-cluster + region: us-east-2 + propagateTags: TASK_DEFINITION