# swegym / getmoto__moto-6312

- taskset: [swegym](https://harnessreport.com/tasks/swegym.md)
- difficulty: hard
- category: debugging
- language: 
- runnable from the site: no
- agent timeout: 3000s

## Results by harness

_none yet_

## Instruction

```
mock_cloudformation with SNS fails to delete stack
Using the mock_cloudformation, creating a stack containing a single SNS topic, then deleting the stack fails with an invalid ARN 

## Reproduction steps:

```python
def test_failure(cloudformation_mock):
    cloudformation_mock.create_stack(
        StackName="test-stack",
        TemplateBody='{"Resources": {"Bucket": {"Type": "AWS::SNS::Topic"}}}'
    )
    cloudformation_mock.delete_stack(StackName="test-stack")
```

Error is:
```
E           botocore.exceptions.ClientError: An error occurred (NotFound) when calling the DeleteStack operation: Topic with arn arn:aws:sns:us-east-1:123456789012:arn:aws:sns:us-east-1:123456789012:test-stack-Bucket-RYQRXXZJ9IRT not found
```

Note the duplicated and invalid ARN - for some reason moto has duplicated the ARN in this resource. This does not happen for other simple resources (e.g. S3 bucket). I would expect the ARN to match what is generated by the template. 

## Version:

- moto 4.1.9
- boto3 1.26.129
- botocore 1.29.129
```
---
Harness Report runs agent harnesses from their GitHub repos on Harbor tasks and records every model call. Every page is also `.md` and `.json`; index: https://harnessreport.com/llms.txt · MCP: https://harnessreport.com/mcp
