### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

We have two different CF stacks in which we create a VPC and IGW in each of them.
First we deploy the first stack which creates a VPCa, creates a IGW and attaches the IGW to the VPCa.
Now when we create the second stack, in this stack also we create a VPCb, create a IGW and attach to the VPCb.
But when I am creating the second stack I get Internet Gateway already associated error.
The second stack creates a new internet gateway but in the attachment step it uses the gateway created in the previous stack (which causes the already associated error).
This error happens for all the subsequent stacks created after the first stack.

This is the CF snippet 

``` 
InternetGatewaySvc:
    Type: 'AWS::EC2::InternetGateway'

  VPCSvcGatewayAttachment:
    Type: 'AWS::EC2::VPCGatewayAttachment'
    DependsOn: [InternetGatewaySvc]
    Properties:
      InternetGatewayId: !GetAtt 'InternetGatewaySvc.InternetGatewayId'
      VpcId: !Ref VPCSvc
```

The `!GetAtt 'InternetGatewaySvc.InternetGatewayId'` in the above snippet returns the id of the gateway created in the first stack instead of the one created in the second stack. (same happens with !Ref also) 

The following error is raised
```Running action "create" for resource type "AWS::EC2::VPCGatewayAttachment" id "VPCSvcGatewayAttachment"
2023-02-11T20:30:54.321 DEBUG --- [uncthread367] l.s.c.e.template_deployer  : Error applying changes for CloudFormation stack "hcservices": An error occurred (Resource.AlreadyAssociated) when calling the AttachInternetGateway operation: Resource igw-4eea8dbb is already associated. Traceback (most recent call last):
  File "/opt/code/localstack/localstack/services/cloudformation/engine/template_deployer.py", line 1304, in _run
    self.do_apply_changes_in_loop(changes, stack)
  File "/opt/code/localstack/localstack/services/cloudformation/engine/template_deployer.py", line 1381, in do_apply_changes_in_loop
    self.apply_change(change, stack=stack)
  File "/opt/code/localstack/localstack/services/cloudformation/engine/template_deployer.py", line 1461, in apply_change
    result = execute_resource_action(resource_id, self, ACTION_CREATE)
  File "/opt/code/localstack/localstack/services/cloudformation/engine/template_deployer.py", line 738, in execute_resource_action
    result = func["function"](resource_id, resources, resource_type, func, stack_name)
  File "/opt/code/localstack/localstack/services/cloudformation/models/ec2.py", line 217, in _attach_gateway
    client.attach_internet_gateway(VpcId=vpc_id, InternetGatewayId=igw_id)
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/client.py", line 530, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/client.py", line 960, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (Resource.AlreadyAssociated) when calling the AttachInternetGateway operation: Resource igw-4eea8dbb is already associated.
```

### Expected Behavior

_No response_

### How are you starting LocalStack?

With the `localstack` script


### Environment

```markdown
- OS: MacOS 12 - M1
- LocalStack: 1.3.2.dev
```


### Anything else?

_No response_
@staticmethod
    def cloudformation_type():
        return "AWS::EC2::Route"
    def fetch_state(self, stack_name, resources):
        client = aws_stack.connect_to_service("ec2")
        props = self.props
        dst_cidr = props.get("DestinationCidrBlock")
        dst_cidr6 = props.get("DestinationIpv6CidrBlock")
        table_id = props.get("RouteTableId")
        route_tables = client.describe_route_tables()["RouteTables"]
        route_table = ([t for t in route_tables if t["RouteTableId"] == table_id] or [None])[0]
        if route_table:
            routes = route_table.get("Routes", [])
            route = [
                r
                for r in routes
                if r.get("DestinationCidrBlock") == (dst_cidr or "_not_set_")
                or r.get("DestinationIpv6CidrBlock") == (dst_cidr6 or "_not_set_")
            ]
            return (route or [None])[0]
    def get_physical_resource_id(self, attribute=None, **kwargs):
        props = self.props
        return generate_route_id(
            props.get("RouteTableId"),
            props.get("DestinationCidrBlock"),
            props.get("DestinationIpv6CidrBlock"),
        )
    @staticmethod
    def get_deploy_templates():