jetstack / jetstack/terraform-provider-tlspc

[BUG] Deleting application blocked with wrong error

Open
#75 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
3
Forks
0
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

```
tlspc_application.app: Destroying... [id=ee9926d0-42ba-11f0-87a3-31249e61b1d7]

│ Error: Error Deleting Application

│ Could not delete Application ID ee9926d0-42ba-11f0-87a3-31249e61b1d7: Failed to delete certificate template; response was: {"errors":[{"code":20226,"message":"Unable to delete the application
│ \"tiger-response-tlspk\" as it will impact the following related resources. Please reassign or remove all related resources to proceed:
│ SERVICE_ACCOUNT(eebcf4be-42ba-11f0-ae80-16bd14caa76a)","args":["tiger-response-tlspk","SERVICE_ACCOUNT(eebcf4be-42ba-11f0-ae80-16bd14caa76a)"]}]}

```

**To Reproduce**
Steps to reproduce the behavior:

1. Create an app
2. Issue a certificate via the application
3. Attempt to destroy the app via terraform
4. See the error similar to above

To "fix" you actually need to remove the CA Templates from the app first.
After that, you can delete the app with terraform.

**Expected behavior**

1. Correct error message, which is mainly down to the TLSPC API, but we could add some vaguely more useful error instead maybe.
2. Delete the app. If I really wanted to keep it, I'd use [terraform deletion protection](https://developer.hashicorp.com/terraform/tutorials/state/resource-lifecycle#prevent-resource-deletion) feature.

**Screenshots**
Image

**Environment (please complete the following information):**

- Terraform: [e.g. 1.10.0]
- Other Providers and versions:

**Additional context**

Been using the hack of manually deleting the CAs for a while, so raising so I can remind myself to fix it.

Contributor guide

Open the contributing guide

Research direction

No repository files or tests are named. Start at the Terraform application destroy entry point and reproduce the certificate-template deletion response from the TLSPC API; determine the intended handling when related service-account resources block deletion, then verify the resulting error or deletion behavior against the reported steps.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, terraform
Domain
cloud, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.