Repository: getmoto/moto

Issue:
EC2.Waiter.VpcPeeringConnectionDeleted times out.
## Reproduce

### Test

```
import boto3
from moto import mock_ec2


def test():
    mock_ec2().start()

    ec2 = boto3.resource('ec2', region_name='us-west-1')
    vpc = ec2.create_vpc(CidrBlock='10.0.0.0/16')
    peer_vpc = ec2.create_vpc(CidrBlock='10.1.0.0/16')
    vpc_peering_connection = ec2.create_vpc_peering_connection(
        PeerRegion='us-west-1',
        PeerVpcId=peer_vpc.id,
        VpcId=vpc.id
    )
    assert len(list(ec2.vpc_peering_connections.all())) == 1

    vpc_peering_connection.delete()
    assert len(list(ec2.vpc_peering_connections.all())) == 0

    ec2.meta.client.get_waiter('vpc_peering_connection_deleted').wait(
        VpcPeeringConnectionIds=[vpc_peering_connection.id],
        WaiterConfig={
            'Delay': 5,
            'MaxAttempts': 2
        },
    )

    mock_ec2().stop()

```

### Output:

> FAILED                            [ 0%]
test.py (test)
...
E               botocore.exceptions.WaiterError: Waiter VpcPeeringConnectionDeleted failed: Max attempts exceeded
...

## Expected

Waiter to return immediately.

## Actual

Waiter times out.

## Library versions

```
moto = { git = "git://github.com/spulec/moto.git", ref = "dfa7935e13e6065810d6fc4e1edbf3e86499aea5" }
boto3 = "==1.7.79"
botocore = "==1.10.79"
```


Discussion:
Hmmm, it looks like our deleting of peering connections logic is incorrect. Instead of removing the connection entirely, we should be keeping it and changing the state so that the deleted object can still be returned. The waiter relies on this in order to proceed.

Resolving patch:
diff --git a/moto/ec2/models.py b/moto/ec2/models.py
--- a/moto/ec2/models.py
+++ b/moto/ec2/models.py
@@ -2230,6 +2230,10 @@ def __init__(self, code='initiating-request', message=''):
         self.code = code
         self.message = message
 
+    def deleted(self):
+        self.code = 'deleted'
+        self.message = 'Deleted by {deleter ID}'
+
     def initiating(self):
         self.code = 'initiating-request'
         self.message = 'Initiating Request to {accepter ID}'
@@ -2292,9 +2296,8 @@ def get_vpc_peering_connection(self, vpc_pcx_id):
         return self.vpc_pcxs.get(vpc_pcx_id)
 
     def delete_vpc_peering_connection(self, vpc_pcx_id):
-        deleted = self.vpc_pcxs.pop(vpc_pcx_id, None)
-        if not deleted:
-            raise InvalidVPCPeeringConnectionIdError(vpc_pcx_id)
+        deleted = self.get_vpc_peering_connection(vpc_pcx_id)
+        deleted._status.deleted()
         return deleted
 
     def accept_vpc_peering_connection(self, vpc_pcx_id):


Test patch:
diff --git a/tests/test_ec2/test_vpc_peering.py b/tests/test_ec2/test_vpc_peering.py
--- a/tests/test_ec2/test_vpc_peering.py
+++ b/tests/test_ec2/test_vpc_peering.py
@@ -89,7 +89,8 @@ def test_vpc_peering_connections_delete():
     verdict.should.equal(True)
 
     all_vpc_pcxs = conn.get_all_vpc_peering_connections()
-    all_vpc_pcxs.should.have.length_of(0)
+    all_vpc_pcxs.should.have.length_of(1)
+    all_vpc_pcxs[0]._status.code.should.equal('deleted')
 
     with assert_raises(EC2ResponseError) as cm:
         conn.delete_vpc_peering_connection("pcx-1234abcd")