@@ -150,7 +150,7 @@ func Clusters() *schema.Table {
150150 Name : "tags" ,
151151 Description : "The metadata that you apply to the cluster to help you categorize and organize them" ,
152152 Type : schema .TypeJSON ,
153- Resolver : resolveClustersTags ,
153+ Resolver : client . ResolveTags ,
154154 },
155155 },
156156 Relations : []* schema.Table {
@@ -1446,7 +1446,10 @@ func fetchEcsClusters(ctx context.Context, meta schema.ClientMeta, parent *schem
14461446 if len (listClustersOutput .ClusterArns ) == 0 {
14471447 return nil
14481448 }
1449- describeClusterOutput , err := svc .DescribeClusters (ctx , & ecs.DescribeClustersInput {Clusters : listClustersOutput .ClusterArns }, func (o * ecs.Options ) {
1449+ describeClusterOutput , err := svc .DescribeClusters (ctx , & ecs.DescribeClustersInput {
1450+ Clusters : listClustersOutput .ClusterArns ,
1451+ Include : []types.ClusterField {types .ClusterFieldTags },
1452+ }, func (o * ecs.Options ) {
14501453 o .Region = region
14511454 })
14521455 if err != nil {
@@ -1484,27 +1487,7 @@ func resolveClustersStatistics(ctx context.Context, meta schema.ClientMeta, reso
14841487 }
14851488 return diag .WrapError (resource .Set (c .Name , stats ))
14861489}
1487- func resolveClustersTags (ctx context.Context , meta schema.ClientMeta , resource * schema.Resource , c schema.Column ) error {
1488- region := meta .(* client.Client ).Region
1489- svc := meta .(* client.Client ).Services ().ECS
1490- cluster , ok := resource .Item .(types.Cluster )
1491- if ! ok {
1492- return diag .WrapError (fmt .Errorf ("expected to have types.Cluster but got %T" , resource .Item ))
1493- }
1494- listTagsForResourceOutput , err := svc .ListTagsForResource (ctx , & ecs.ListTagsForResourceInput {
1495- ResourceArn : cluster .ClusterArn ,
1496- }, func (o * ecs.Options ) {
1497- o .Region = region
1498- })
1499- if err != nil {
1500- return diag .WrapError (err )
1501- }
1502- tags := make (map [string ]* string )
1503- for _ , s := range listTagsForResourceOutput .Tags {
1504- tags [* s .Key ] = s .Value
1505- }
1506- return diag .WrapError (resource .Set (c .Name , tags ))
1507- }
1490+
15081491func resolveClusterAttachmentsDetails (ctx context.Context , meta schema.ClientMeta , resource * schema.Resource , c schema.Column ) error {
15091492 attachment , ok := resource .Item .(types.Attachment )
15101493 if ! ok {
@@ -1539,6 +1522,7 @@ func fetchEcsClusterTasks(ctx context.Context, meta schema.ClientMeta, parent *s
15391522 describeServicesInput := ecs.DescribeTasksInput {
15401523 Cluster : cluster .ClusterArn ,
15411524 Tasks : listTasks .TaskArns ,
1525+ Include : []types.TaskField {types .TaskFieldTags },
15421526 }
15431527 describeTasks , err := svc .DescribeTasks (ctx , & describeServicesInput , func (o * ecs.Options ) {
15441528 o .Region = region
@@ -1587,6 +1571,7 @@ func fetchEcsClusterServices(ctx context.Context, meta schema.ClientMeta, parent
15871571 describeServicesInput := ecs.DescribeServicesInput {
15881572 Cluster : cluster .ClusterArn ,
15891573 Services : listServicesOutput .ServiceArns ,
1574+ Include : []types.ServiceField {types .ServiceFieldTags },
15901575 }
15911576 describeServicesOutput , err := svc .DescribeServices (ctx , & describeServicesInput , func (o * ecs.Options ) {
15921577 o .Region = region
@@ -1645,6 +1630,7 @@ func fetchEcsClusterContainerInstances(ctx context.Context, meta schema.ClientMe
16451630 describeServicesInput := ecs.DescribeContainerInstancesInput {
16461631 Cluster : cluster .ClusterArn ,
16471632 ContainerInstances : listContainerInstances .ContainerInstanceArns ,
1633+ Include : []types.ContainerInstanceField {types .ContainerInstanceFieldTags },
16481634 }
16491635 describeContainerInstances , err := svc .DescribeContainerInstances (ctx , & describeServicesInput , func (o * ecs.Options ) {
16501636 o .Region = region
0 commit comments