Provider not detecting azuredevops_branch_policy_build_validation has been deleted #330
Closed
Description
opened on Mar 18, 2021
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Overview of issue
Hi there, if I manually delete a Build Validation created by Terraform it never detects that the build validation has been deleted, and never re-creates the build validation.
Terraform (and Azure DevOps Provider) Version
Terraform v0.14.7
+ provider registry.terraform.io/microsoft/azuredevops v0.1.2
Affected Resource(s)
azuredevops_branch_policy_build_validation
Terraform Configuration Files
resource "azuredevops_branch_policy_build_validation" "master_pr" {
project_id = data.azuredevops_project.REDACTED.id
enabled = true
blocking = true
settings {
display_name = "Terraform-Plan-Validation"
build_definition_id = azuredevops_build_definition.REDACTED.id
valid_duration = 720
scope {
repository_id = data.azuredevops_git_repository.REDACTED.id
repository_ref = "refs/heads/master"
match_type = "Exact"
}
}
}
Debug Output
Client project, can't provide debug.
Panic Output
Expected Behavior
Terraform should detect that the Build Validation has been manually deleted and re-create it.
Actual Behavior
State is refreshed and no changes are detected.
terraform apply
Acquiring state lock. This may take a few moments...
...
azuredevops_branch_policy_build_validation.master_pr: Refreshing state... [id=18]
...
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
Releasing state lock. This may take a few moments...
Steps to Reproduce
terraform apply
- Manually delete the build validation in Azure DevOps.
- Run
terraform plan
orterraform apply
again and there are no changes detected.
Important Factoids
I tried to taint the resource in Terraform and got the following error that the resource does not exist:
azuredevops_branch_policy_build_validation.master_pr: Destroying... [id=18]
Error: Error deleting policy in Azure DevOps: The policy configuration with ID '18' and revision '3' does not exist.
References
Kind regards,
Activity