Repository: cloud-custodian/cloud-custodian

Issue:
Policy ran successfully in us-east-2 region throwing error in us-east-1 region
**Describe the bug**
Wrote a policy for `aws.network-addr` resource. while running --dry-run for that policy getting proper output in us-east-2 region and throwing error in us-east-1 region

**To Reproduce**
Steps to reproduce the behavior:

custodian run --dry-run -s /tmp/. --region us-east-2 shield_pro.yaml 
2020-09-25 14:29:06,748: custodian.policy:INFO policy:sheild-policy-eip resource:aws.network-addr region:us-east-2 count:9 time:14.60

custodian run --dry-run -s /tmp/. --region us-east-1 shield_pro.yaml 
2020-09-25 14:29:33,687: custodian.output:ERROR Error while executing policy
Traceback (most recent call last):


**Background:**
 - OS: Mac, debian
 - Python Version: 3.7.3
 - Custodian Version: [0.9.4 & 0.9.6]
 - Cloud Provider: [aws]
 - Policy: [please exclude any account/sensitive information]
```yaml
policies:
- name: sheild-policy-eip
  resource: aws.network-addr
  filters:
   - type: shield-enabled
     state: true
```
 - Traceback: 
```
2020-09-25 19:37:54,488: custodian.output:ERROR Error while executing policy
Traceback (most recent call last):
  File "/Users/rgopala1/custodian/lib/python3.7/site-packages/c7n/policy.py", line 291, in run
    resources = self.policy.resource_manager.resources()
  File "/Users/rgopala1/custodian/lib/python3.7/site-packages/c7n/query.py", line 509, in resources
    resources = self.filter_resources(resources)
  File "/Users/rgopala1/custodian/lib/python3.7/site-packages/c7n/manager.py", line 121, in filter_resources
    resources = f.process(resources, event)
  File "/Users/rgopala1/custodian/lib/python3.7/site-packages/c7n/resources/shield.py", line 87, in process
    for arn, r in zip(self.manager.get_arns(resources), resources):
  File "/Users/rgopala1/custodian/lib/python3.7/site-packages/c7n/query.py", line 588, in get_arns
    _id = r[id_key]
KeyError: 'AllocationId'
```




Discussion:
@kapilt Please help on this
you have a pre-vpc elastic ip in that region, custodian does not support non vpc as they are strictly legacy from a decade ago. we could potentially automatically remove them when querying elastic ips to avoid issues like this.
@kapilt Thanks for your clarification.

Resolving patch:
diff --git a/c7n/resources/vpc.py b/c7n/resources/vpc.py
--- a/c7n/resources/vpc.py
+++ b/c7n/resources/vpc.py
@@ -1956,6 +1956,12 @@ def process(self, resources, event=None):
         return results
 
 
+class DescribeElasticIp(query.DescribeSource):
+
+    def augment(self, resources):
+        return [r for r in resources if self.manager.resource_type.id in r]
+
+
 @resources.register('elastic-ip', aliases=('network-addr',))
 class NetworkAddress(query.QueryResourceManager):
 
@@ -1969,6 +1975,11 @@ class resource_type(query.TypeInfo):
         filter_type = 'list'
         config_type = "AWS::EC2::EIP"
 
+    source_mapping = {
+        'describe': DescribeElasticIp,
+        'config': query.ConfigSource
+    }
+
 
 NetworkAddress.filter_registry.register('shield-enabled', IsShieldProtected)
 NetworkAddress.action_registry.register('set-shield', SetShieldProtection)


Test patch: