Repository: cloud-custodian/cloud-custodian

Issue:
copy-related-tag rds-snapshot AssertionError Cross Accounts
**Describe the bug**
Attempting to run a `copy-related-tag` action for copying tags from a RDS instance to RDS snapshots. However, when the policy is run I am met with the following traceback error.

The error is the same as the closed issue #5791 . The policy is exactly the same as well. However we are running the policy across multiple accounts.

**To Reproduce**
I am running the following command to execute the command 
```
"c7n-org",
"run",
f"--output-dir={self.output_path}",
"--config=/tmp/accounts.yml",
f"--use=reliability_custodian/policies/{self.policy_name}.yml",
f"--metrics-uri=aws://master?namespace={self.cw_metrics_namespace}",
f"--cache-path={self.cache_path}",
"--verbose",
"--debug"
```
After executing this the error occurs

**Expected behavior**
I would expect this to run through with no errors and copy the tags from the RDS instance to its relevant snapshot.

**Background (please complete the following information):**
 - OS: Linux
 - Python Version: 3.8
 - Custodian Version: 0.9.11
 - c7n-org: 0.6.10
 - Cloud Provider: aws
 - Policy: 
```yaml
policies: 
   - name: copy-tags-from-rds-to-snapshot
    resource: rds-snapshot
    actions:
      - type: copy-related-tag
        resource: rds
        skip_missing: true
        key: DBInstanceIdentifier
        tags:
          - sometag
```
 - Traceback:
 ```

Traceback (most recent call last):
--
925 | File "/codebuild/output/src900726857/src/c7n_org/cli.py", line 586, in run_account
926 | resources = p.run()
927 | File "/codebuild/output/src900726857/src/c7n/policy.py", line 1184, in __call__
928 | resources = mode.run()
929 | File "/codebuild/output/src900726857/src/c7n/policy.py", line 317, in run
930 | results = a.process(resources)
931 | File "/codebuild/output/src900726857/src/c7n/tags.py", line 1012, in process
932 | related_tag_map = self.get_resource_tag_map(self.data['resource'], related_ids)
933 | File "/codebuild/output/src900726857/src/c7n/tags.py", line 1070, in get_resource_tag_map
934 | for r in manager.get_resources(list(ids))
935 | File "/codebuild/output/src900726857/src/c7n/query.py", line 559, in get_resources
936 | resources = self.source.get_resources(ids)
937 | File "/codebuild/output/src900726857/src/c7n/query.py", line 220, in get_resources
938 | return self.query.get(self.manager, ids)
939 | File "/codebuild/output/src900726857/src/c7n/query.py", line 91, in get
940 | assert len(identities) == 1, "Scalar server side filter"
941 | AssertionError: Scalar server side filter
942 |  
943 | {"Message": "Running policy", "LogLevel": "INFO", "Region": "us-east-1"}
944 | > /codebuild/output/src900726857/src/c7n/query.py(91)get()
945 | -> assert len(identities) == 1, "Scalar server side filter"
946 | (Pdb)
947 | Traceback (most recent call last):
948 | File "reliability_custodian/main/handler.py", line 70, in <module>
949 | handler()
950 | File "reliability_custodian/main/handler.py", line 65, in handler
951 | custodian_runner.run_policy()
952 | File "/codebuild/output/src900726857/src/reliability_custodian/services/custodian_runner.py", line 88, in run_policy
953 | self.policy_func()
954 | File "/codebuild/output/src900726857/src/click/core.py", line 829, in __call__
955 | return self.main(*args, **kwargs)
956 | File "/codebuild/output/src900726857/src/click/core.py", line 782, in main
957 | rv = self.invoke(ctx)
958 | File "/codebuild/output/src900726857/src/click/core.py", line 1259, in invoke
959 | return _process_result(sub_ctx.command.invoke(sub_ctx))
960 | File "/codebuild/output/src900726857/src/click/core.py", line 1066, in invoke
961 | return ctx.invoke(self.callback, **ctx.params)
962 | File "/codebuild/output/src900726857/src/click/core.py", line 610, in invoke
963 | return callback(*args, **kwargs)
964 | File "/codebuild/output/src900726857/src/c7n_org/cli.py", line 666, in run
965 | futures[w.submit(
966 | File "/codebuild/output/src900726857/src/c7n/executor.py", line 28, in submit
967 | return MainThreadFuture(func(*args, **kw))
968 | File "/codebuild/output/src900726857/src/c7n_org/cli.py", line 586, in run_account
969 | resources = p.run()
970 | File "/codebuild/output/src900726857/src/c7n/policy.py", line 1184, in __call__
971 | resources = mode.run()
972 | File "/codebuild/output/src900726857/src/c7n/policy.py", line 317, in run
973 | results = a.process(resources)
974 | File "/codebuild/output/src900726857/src/c7n/tags.py", line 1012, in process
975 | related_tag_map = self.get_resource_tag_map(self.data['resource'], related_ids)
976 | File "/codebuild/output/src900726857/src/c7n/tags.py", line 1070, in get_resource_tag_map
977 | for r in manager.get_resources(list(ids))
978 | File "/codebuild/output/src900726857/src/c7n/query.py", line 559, in get_resources
979 | resources = self.source.get_resources(ids)
980 | File "/codebuild/output/src900726857/src/c7n/query.py", line 220, in get_resources
981 | return self.query.get(self.manager, ids)
982 | File "/codebuild/output/src900726857/src/c7n/query.py", line 91, in get
983 | assert len(identities) == 1, "Scalar server side filter"
984 | AssertionError: Scalar server side filter
```



Discussion:
Since the RDS resource is declared to have a filter type of `scalar` it appears that it cannot handle multiple RDS instances in an account 
https://github.com/cloud-custodian/cloud-custodian/blob/edb3ce11db594dc7410b3a8945cc688d653b76a6/c7n/query.py#L87-L93 
Hello,
I'm having the same issue but for redshift-snapshots on custodian v0.9.14, please find the policy I'm trying to deploy below : 
```
policies:
  - name: tag-snapshots
    resource: redshift-snapshot
    description: Tag redshift snapshots according to the cluster from which they're created
    filters:
      - type: tag-count
        count: 0
    mode:
      schedule: "cron(5 * * * ? *)"
      type: periodic
      role: CUSTODIAN_ROLE
      execution-options:
        output_dir: s3://enx-ParamEnv-{region}-common/CustodianLogs/
    actions:
      - type: copy-related-tag
        resource: redshift
        skip_missing: True
        key: ClusterIdentifier
        tags: '*'
```

And the error I'm encountering : 
```
[ERROR]	2022-10-12T08:19:57.627Z	2e5f9e74-2e3a-404a-ab85-141708b6e136	Error while executing policy
Traceback (most recent call last):
  File "/var/task/c7n/policy.py", line 322, in run
    results = a.process(resources)
  File "/var/task/c7n/tags.py", line 1043, in process
    related_tag_map = self.get_resource_tag_map(self.data['resource'], related_ids)
  File "/var/task/c7n/tags.py", line 1101, in get_resource_tag_map
    for r in manager.get_resources(list(ids))
  File "/var/task/c7n/query.py", line 567, in get_resources
    resources = self.source.get_resources(ids)
  File "/var/task/c7n/query.py", line 220, in get_resources
    return self.query.get(self.manager, ids)
  File "/var/task/c7n/query.py", line 91, in get
    assert len(identities) == 1, "Scalar server side filter"
AssertionError: Scalar server side filter
```

Resolving patch:
diff --git a/c7n/resources/rds.py b/c7n/resources/rds.py
--- a/c7n/resources/rds.py
+++ b/c7n/resources/rds.py
@@ -976,6 +976,10 @@ def process(self, resources):
 
 class DescribeRDSSnapshot(DescribeSource):
 
+    def get_resources(self, ids, cache=True):
+        super_get = super().get_resources
+        return list(itertools.chain(*[super_get((i,)) for i in ids]))
+
     def augment(self, snaps):
         for s in snaps:
             s['Tags'] = s.pop('TagList', ())


Test patch: