In our system we need to create many service_dependency between different systems, teams and even departments.
However there is a bug that if a service is deleted outside of the current Terraform module, planning will fail.
Consider two Terraform modules:
Module 1 contains Service A
Module 2 contains Service B and a service_dependency between Service A and Service B
If we refactor Module 1 in a way where Service A is deleted, or re-created the service_dependency between Service A and B is no longer valid and has to be rebuilt.
This is fine, however the PagerDuty provider does not handle this 404 error gracefully and causes terraform plan to fail entirely, requiring us to manually remove the service_dependency from the state of Module 2.
This is very annoying in our organisation.
Terraform Version
Terraform version 1.5.7
PagerDuty Provider version 3.8.1
resource "pagerduty_service_dependency" "A-B" {
dependency {
dependent_service {
id = pagerduty_service.A.id
type = pagerduty_service.A.type
}
supporting_service {
id = pagerduty_service.B.id
type = pagerduty_service.B.type
}
}
}
2. Manually delete either service A or service B in the PagerDuty UI
3. Run `terraform plan`
At this point, the state is broken, it's impossible to plan, apply or destroy and you have to manually fix it.
In our system we need to create many service_dependency between different systems, teams and even departments. However there is a bug that if a service is deleted outside of the current Terraform module, planning will fail.
Consider two Terraform modules:
If we refactor Module 1 in a way where Service A is deleted, or re-created the service_dependency between Service A and B is no longer valid and has to be rebuilt. This is fine, however the PagerDuty provider does not handle this 404 error gracefully and causes
terraform plan
to fail entirely, requiring us to manually remove the service_dependency from the state of Module 2.This is very annoying in our organisation.
Terraform Version
Terraform version 1.5.7 PagerDuty Provider version 3.8.1
Affected Resource(s)
Debug Output
https://gist.github.com/lukaspj/f090b0fbdd094a814a55713b86d7716b
Expected Behavior
After a dependent service has been removed outside of the current Terraform module, planning should successfully handle that external change.
Actual Behavior
The removal of the dependent service breaks planning, making Terraform unable to make any changes.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
resource "pagerduty_service" "B" { escalation_policy = pagerduty_escalation_policy.service-team.id name = "test-service-b" }
resource "pagerduty_service_dependency" "A-B" { dependency { dependent_service { id = pagerduty_service.A.id type = pagerduty_service.A.type } supporting_service { id = pagerduty_service.B.id type = pagerduty_service.B.type } } }