Reputation: 856
while configuring resource configuration , is there any way I can use so that serverless wont create throw any error if resource is already present.
eg. don't throw this error if following resource is already present.
Error : An error occurred: PaymentQueue - dev_payment_cron_queue already exists in stack
resources:
Resources:
PaymentQueue:
Type: "AWS::SQS::Queue"
Properties:
QueueName: ${self:provider.stage}_payment_cron_queue
VisibilityTimeout: 40
Upvotes: 3
Views: 4417
Reputation: 238687
Sadly, there is no such way with pure CloudFormation (CFN), as this is not how CFN (or Terraform as a matter of fact) was designed to work. From CFN perspective, a given resource exists and is managed by CFN, or it does not exist at all. There is no middle ground.
If your resource already exist, you have to import it to CFN so that it gets managed by CFN. Alternatively, you have to create custom resource in the form of a lambda function. The function would perform any action you want based on the existing resources, including checking if it exists or not.
Upvotes: 4