terraform-provider-mailgun
terraform-provider-mailgun copied to clipboard
Terraform plan fails when a manually deleted route is not found - Error retrieving route; Route not found
Terraform Version
1.5.7
Affected Resource(s)
- mailgun_route
Expected Behavior
recreate missing resource
Actual Behavior
Throws an error:
Error retrieving route: UnexpectedResponseError URL=https://api.mailgun.net/v3/routes/6565de540d1867150b837193 ExpectedOneOf=[]int{200, 202, 204} Got=404 Error: {"message":"Route not found"}
Steps to Reproduce
- create a new route using
mailgun_route
( in my case I used for_each, might occur on a single route )
locals{
environments = toset([
"ab",
"bc",
"cd"
])
}
resource "mailgun_route" "environments_catch_all" {
for_each = local.environments
region = "us"
priority = "999"
description = ".*@${each.key}.mywebsite.io - terraform"
expression = "match_recipient('.*@${each.key}\\.mywebsite\\.io')"
actions = [
"forward('https://${each.key}.mywebsite.io')",
"stop()"
]
}
- delete one route from the UI
- run terraform plan